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.lua | |
| 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.lua')
| -rw-r--r-- | syntax_tree.lua | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/syntax_tree.lua b/syntax_tree.lua index b9668e7..b7b7f83 100644 --- a/syntax_tree.lua +++ b/syntax_tree.lua @@ -147,13 +147,14 @@ do assert(self.type == "Action" or self.type == "MethodCall", "Only actions and method calls have arguments") local args = { } if self.type == "MethodCall" then - assert(#self == 2, "Can't get arguments for multiple method calls at once.") args[1] = self[1] - local _list_0 = self[2] - for _index_0 = 1, #_list_0 do - local tok = _list_0[_index_0] - if type(tok) ~= 'string' then - args[#args + 1] = tok + for i = 2, #self do + local _list_0 = self[i] + for _index_0 = 1, #_list_0 do + local tok = _list_0[_index_0] + if type(tok) ~= 'string' then + args[#args + 1] = tok + end end end else @@ -168,8 +169,15 @@ do end, get_stub = function(self) if self.type == "MethodCall" then - assert(#self == 2, "Can't get the stubs of multiple method calls at once.") - return self[2]:get_stub() + return "0, " .. table.concat((function() + local _accum_0 = { } + local _len_0 = 1 + for i = 2, #self do + _accum_0[_len_0] = self[i]:get_stub() + _len_0 = _len_0 + 1 + end + return _accum_0 + end)(), "; ") end local stub_bits = { } local arg_i = 1 |
