diff options
Diffstat (limited to 'server-beta')
-rw-r--r-- | server-beta/src/parser/ast.lua | 4 | ||||
-rw-r--r-- | server-beta/src/parser/compile.lua | 34 |
2 files changed, 32 insertions, 6 deletions
diff --git a/server-beta/src/parser/ast.lua b/server-beta/src/parser/ast.lua index f22033db..3ee264c1 100644 --- a/server-beta/src/parser/ast.lua +++ b/server-beta/src/parser/ast.lua @@ -898,6 +898,7 @@ local Defs = { end local loc = createLocal(name, start, actions) + loc.localfunction = true return loc end, @@ -1038,6 +1039,9 @@ local Defs = { elseif key.type == 'getfield' then key.type = 'setfield' key.value = getValue(values, i) + elseif key.type == 'getindex' then + key.type = 'setindex' + key.value = getValue(values, i) end end return tableUnpack(keys) diff --git a/server-beta/src/parser/compile.lua b/server-beta/src/parser/compile.lua index 0e6b4848..457af42c 100644 --- a/server-beta/src/parser/compile.lua +++ b/server-beta/src/parser/compile.lua @@ -120,6 +120,21 @@ local vmMap = { end return id end, + ['setindex'] = function (obj) + Root[#Root+1] = obj + local id = #Root + local node = obj.node + obj.node = Compile(node, id) + local index = obj.index + if index then + obj.index = Compile(index, id) + end + local value = obj.value + if value then + obj.value = Compile(value, id) + end + return id + end, ['getmethod'] = function (obj) Root[#Root+1] = obj local id = #Root @@ -259,11 +274,20 @@ local vmMap = { end Block.locals[#Block.locals+1] = id end - local value = obj.value - if value then - obj.value = Compile(value, id) + if obj.localfunction then + obj.localfunction = nil + Cache[obj] = id + local value = obj.value + if value then + obj.value = Compile(value, id) + end + else + local value = obj.value + if value then + obj.value = Compile(value, id) + end + Cache[obj] = id end - Cache[obj] = id return id end, ['localattr'] = function (obj) @@ -274,10 +298,8 @@ local vmMap = { Root[#Root+1] = obj local id = #Root local node = obj.node - local field = obj.field local value = obj.value obj.node = Compile(node, id) - obj.field = Compile(field, id) obj.value = Compile(value, id) return id end, |