diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-17 23:37:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-17 23:37:01 +0800 |
commit | e8ea5f90e60e36833b3e2d98e66d89e6098faacc (patch) | |
tree | 7526305acc1f65c5ab818bcae99896b0e9b5d8cf /server-beta/src | |
parent | 0805814ac575b0f610c4831548cb7f74b39ee37c (diff) | |
download | lua-language-server-e8ea5f90e60e36833b3e2d98e66d89e6098faacc.zip |
修正一些bug
Diffstat (limited to 'server-beta/src')
-rw-r--r-- | server-beta/src/parser/ast.lua | 12 | ||||
-rw-r--r-- | server-beta/src/parser/grammar.lua | 3 | ||||
-rw-r--r-- | server-beta/src/parser/guide.lua | 1 | ||||
-rw-r--r-- | server-beta/src/searcher/eachRef.lua | 9 |
4 files changed, 6 insertions, 19 deletions
diff --git a/server-beta/src/parser/ast.lua b/server-beta/src/parser/ast.lua index c5303796..dfd7656d 100644 --- a/server-beta/src/parser/ast.lua +++ b/server-beta/src/parser/ast.lua @@ -970,18 +970,6 @@ local Defs = { end return obj end, - Index = function (start, index, finish) - local obj = { - type = 'index', - start = start, - finish = finish - 1, - index = index, - } - if index then - index.parent = obj - end - return obj - end, NewIndex = function (start, index, value, finish) local obj = { type = 'tableindex', diff --git a/server-beta/src/parser/grammar.lua b/server-beta/src/parser/grammar.lua index 48e2f86e..fd699bd4 100644 --- a/server-beta/src/parser/grammar.lua +++ b/server-beta/src/parser/grammar.lua @@ -362,8 +362,7 @@ TableField <- COMMA / NewIndex / NewField / Exp -Index <- ({} BL DirtyExp DirtyBR {}) - -> Index +Index <- BL DirtyExp DirtyBR NewIndex <- Sp ({} Index NeedAssign DirtyExp {}) -> NewIndex NewField <- Sp ({} MustName ASSIGN DirtyExp {}) diff --git a/server-beta/src/parser/guide.lua b/server-beta/src/parser/guide.lua index 4750fcaf..3c8bc3fc 100644 --- a/server-beta/src/parser/guide.lua +++ b/server-beta/src/parser/guide.lua @@ -44,7 +44,6 @@ m.childMap = { ['return'] = {'#'}, ['do'] = {'#'}, ['select'] = {'vararg'}, - ['index'] = {'index'}, ['table'] = {'#'}, ['tableindex'] = {'index', 'value'}, ['tablefield'] = {'value'}, diff --git a/server-beta/src/searcher/eachRef.lua b/server-beta/src/searcher/eachRef.lua index eb6fc992..24f2ea77 100644 --- a/server-beta/src/searcher/eachRef.lua +++ b/server-beta/src/searcher/eachRef.lua @@ -321,7 +321,8 @@ end local function ofField(source, callback) local parent = source.parent local key = guide.getKeyName(source) - if parent.type == 'tablefield' then + if parent.type == 'tablefield' + or parent.type == 'tableindex' then local tbl = parent.parent searcher.eachField(tbl, function (info) if key == info.key then @@ -356,7 +357,8 @@ local function ofLiteral(source, callback) return end if parent.type == 'setindex' - or parent.type == 'getindex' then + or parent.type == 'getindex' + or parent.type == 'tableindex' then ofField(source, callback) end end @@ -422,8 +424,7 @@ local function eachRef(source, callback) or stype == 'getglobal' then ofGlobal(source, callback) elseif stype == 'field' - or stype == 'method' - or stype == 'index' then + or stype == 'method' then ofField(source, callback) elseif stype == 'setfield' or stype == 'getfield' |