This required a new approach for handling function arguments.
Methods remain the same: the callee object is on the stack and positioned
to be "argument 0". Non-methods have changed so that "argument 0" is the
first argument, with the function still remaining before that. When a
non-method is called, we track this fact so that we can continue to restore
the stack to the correct height to get rid of the function. This allows
a method decorator to be defined exactly like it would be in Python
def methodDecorator(func):
def wrappedMethod(instance, someOtherArg):
print "Do something with the arg:", someOtherArg
func(instance)
class Foo():
@methodDecorator
def func():
print "I only take an implicit self:", self
let f = Foo()
f.func("but that other arg is needed")