diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-25 15:49:29 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-25 15:50:51 -0800 |
| commit | a1b559a3a269bbee1ae9a33061b08a868ea52f5c (patch) | |
| tree | 51f2368c6542efe47dd2a4007ba92e22650236b9 /syntax_tree.moon | |
| parent | 1713a0e38f12f8ed167575ac5a84a0eb8dd59a44 (diff) | |
Added metatables for bool, number, function, coroutine. Added
run-time check to make sure precompiled code used the same version of
Lua. Methods can now be used in (* compiles to *), etc.
Diffstat (limited to 'syntax_tree.moon')
| -rw-r--r-- | syntax_tree.moon | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/syntax_tree.moon b/syntax_tree.moon index eb9c87c..278e22b 100644 --- a/syntax_tree.moon +++ b/syntax_tree.moon @@ -72,10 +72,10 @@ class SyntaxTree assert(@type == "Action" or @type == "MethodCall", "Only actions and method calls have arguments") args = {} if @type == "MethodCall" - assert(#@ == 2, "Can't get arguments for multiple method calls at once.") args[1] = @[1] - for tok in *@[2] - if type(tok) != 'string' then args[#args+1] = tok + for i=2,#@ + for tok in *@[i] + if type(tok) != 'string' then args[#args+1] = tok else for tok in *@ if type(tok) != 'string' then args[#args+1] = tok @@ -83,8 +83,7 @@ class SyntaxTree get_stub: => if @type == "MethodCall" - assert(#@ == 2, "Can't get the stubs of multiple method calls at once.") - return @[2]\get_stub! + return "0, "..table.concat([@[i]\get_stub! for i=2,#@], "; ") stub_bits = {} arg_i = 1 for a in *@ |
