diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-03 14:10:31 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-03 14:10:31 +0800 |
commit | cab0b6dbf953aae890a2e7e413b94643191f176a (patch) | |
tree | 3de9d1170cae1097b2593c4f8fc8907dc628e57e | |
parent | a17ae2a2d51e2decce0c793771a52999a1953270 (diff) | |
download | lua-language-server-cab0b6dbf953aae890a2e7e413b94643191f176a.zip |
每一层都检查一次表达式
-rw-r--r-- | server/src/matcher/definition.lua | 5 | ||||
-rw-r--r-- | server/test/definition/bug.lua | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua index 4b7b04c5..453dc291 100644 --- a/server/src/matcher/definition.lua +++ b/server/src/matcher/definition.lua @@ -137,16 +137,17 @@ function mt:searchSimple(simple) var = self:getVar(name[1], name) self:checkVar(var, name) end + self:searchExp(simple[1]) for i = 2, #simple do local obj = simple[i] local tp = obj.type + self:searchExp(obj) if tp == 'call' then var = self:searchCall(obj, simple, i) elseif tp == ':' then elseif tp == 'name' then if obj.index then var = nil - self:searchExp(obj) else var = self:getField(var, obj[1], obj) self:checkVar(var, obj) @@ -156,8 +157,6 @@ function mt:searchSimple(simple) if obj.type == 'string' or obj.type == 'number' or obj.type == 'boolean' then var = self:getField(var, obj[1], obj) self:checkVar(var, obj) - else - self:searchExp(obj) end else var = nil diff --git a/server/test/definition/bug.lua b/server/test/definition/bug.lua index eeca98da..24dd14b0 100644 --- a/server/test/definition/bug.lua +++ b/server/test/definition/bug.lua @@ -29,3 +29,8 @@ function _(...) end end ]] + +TEST [[ +local <!a!> +(<?a?> / b)() +]] |