diff options
author | jefersonf <jeferson.silva> | 2021-10-30 13:19:12 -0300 |
---|---|---|
committer | jefersonf <jeferson.silva> | 2021-10-30 13:19:12 -0300 |
commit | f0c5bbeb62794116b6517be51efa6054254076eb (patch) | |
tree | fee585182a7ec10e987e758a53edcbd7db9dca9b /script/parser/newparser.lua | |
parent | f41a33de696dc5ff802d2f5e540da1c87861dac9 (diff) | |
parent | 107b57cc7728824a0e9515727f9a6123c5f7c902 (diff) | |
download | lua-language-server-f0c5bbeb62794116b6517be51efa6054254076eb.zip |
Merge branch 'master' of https://github.com/sumneko/lua-language-server into pt-br-locale-support
Diffstat (limited to 'script/parser/newparser.lua')
-rw-r--r-- | script/parser/newparser.lua | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua index ca0bc66a..0b721a7a 100644 --- a/script/parser/newparser.lua +++ b/script/parser/newparser.lua @@ -1639,6 +1639,30 @@ local function parseTable() return tbl end +local function addDummySelf(node, call) + if node.type ~= 'getmethod' then + return + end + -- dummy param `self` + if not call.args then + call.args = { + type = 'callargs', + start = call.start, + finish = call.finish, + parent = call, + } + end + local newNode = {} + for k, v in next, call.node.node do + newNode[k] = v + end + newNode.mirror = call.node.node + newNode.dummy = true + newNode.parent = call.args + call.node.node.mirror = newNode + tinsert(call.args, 1, newNode) +end + local function parseSimple(node, funcName) local lastMethod while true do @@ -1740,26 +1764,7 @@ local function parseSimple(node, funcName) args.parent = call call.args = args end - if node.type == 'getmethod' then - -- dummy param `self` - if not call.args then - call.args = { - type = 'callargs', - start = call.start, - finish = call.finish, - parent = call, - } - end - local newNode = {} - for k, v in next, call.node.node do - newNode[k] = v - end - newNode.mirror = call.node.node - newNode.dummy = true - newNode.parent = call.args - call.node.node.mirror = newNode - tinsert(call.args, 1, newNode) - end + addDummySelf(node, call) node.parent = call node = call elseif token == '{' then @@ -1781,6 +1786,7 @@ local function parseSimple(node, funcName) [1] = tbl, } call.args = args + addDummySelf(node, call) tbl.parent = args node.parent = call node = call @@ -1803,6 +1809,7 @@ local function parseSimple(node, funcName) [1] = str, } call.args = args + addDummySelf(node, call) str.parent = args node.parent = call node = call @@ -1826,6 +1833,7 @@ local function parseSimple(node, funcName) [1] = str, } call.args = args + addDummySelf(node, call) str.parent = args node.parent = call node = call |