Commit Graph

8 Commits

Author SHA1 Message Date
K. Lange
997e1a8d2a length should determine truthiness where relevent 2021-01-09 13:58:46 +09:00
K Lange
ff8ed02ebd Make print() a function before it's too late 2021-01-04 23:34:10 +09:00
K. Lange
d87fd9b1bd Commit results of test cases as of now (not sure if they're all correctly) 2021-01-04 21:50:20 +09:00
K. Lange
7dfa32f471 Fix some exceptional edge cases 2021-01-03 18:26:55 +09:00
K. Lange
2ee154ecf7 Add argument expansions... 2021-01-03 18:13:17 +09:00
K. Lange
93af369b8c Quietly pretend we didn't just do that different from Python for no reason 2021-01-03 09:29:09 +09:00
K. Lange
b676df69da Add method decorators
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")
2021-01-03 08:43:32 +09:00
K. Lange
1de1fbc150 Basic non-method decorator support? 2021-01-02 21:58:24 +09:00