diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 21:25:24 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 21:25:24 +0800 |
commit | c38b64f0c5cba3e75d1ba7e43c3f042410dc5058 (patch) | |
tree | a80b18332d95c58be67be8cda7570ae817c4bdea /server/src | |
parent | f1f288a72fa02b2bd73e2e7230412067ce102f43 (diff) | |
download | lua-language-server-c38b64f0c5cba3e75d1ba7e43c3f042410dc5058.zip |
支持更多脏语法
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/matcher/vm.lua | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index b9907804..f2494432 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -1087,12 +1087,14 @@ function mt:doFunction(action) local name = action.name local var, object local source - if name.type == 'simple' then - var, object = self:getSimple(name, 'field') - source = name[#name] - else - var = self:getName(name[1], name) - source = name + if name then + if name.type == 'simple' then + var, object = self:getSimple(name, 'field') + source = name[#name] + else + var = self:getName(name[1], name) + source = name + end end local func = self:buildFunction(action, object) self:setValue(var, func, source) @@ -1100,9 +1102,19 @@ end function mt:doLocalFunction(action) local name = action.name - local var = self:createLocal(name[1], name) - local func = self:buildFunction(action) - self:setValue(var, func, name) + local var, object + local source + if name then + if name.type == 'simple' then + var, object = self:getSimple(name, 'field') + source = name[#name] + else + var = self:createLocal(name[1], name) + source = name + end + end + local func = self:buildFunction(action, object) + self:setValue(var, func, source) end function mt:doAction(action) |