summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-08-08 21:02:36 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-08-08 21:02:36 +0800
commit13bb2c666342b7dbe14e6118f761738711491539 (patch)
tree606d87b8cb7f7fb59c130882c422060ea1c055a5 /script/parser
parent9b5ac5353c6c63e09d7b8862fb9f5535d5f014fb (diff)
downloadlua-language-server-13bb2c666342b7dbe14e6118f761738711491539.zip
fix #1422
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/compile.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/script/parser/compile.lua b/script/parser/compile.lua
index 8b2ae1e3..915a2764 100644
--- a/script/parser/compile.lua
+++ b/script/parser/compile.lua
@@ -1767,6 +1767,23 @@ local function addDummySelf(node, call)
tinsert(call.args, 1, self)
end
+local function checkAmbiguityCall(call, parenPos)
+ if State.version ~= 'Lua 5.1' then
+ return
+ end
+ local node = call.node
+ local nodeRow = guide.rowColOf(node.finish)
+ local callRow = guide.rowColOf(parenPos)
+ if nodeRow == callRow then
+ return
+ end
+ pushError {
+ type = 'AMBIGUOUS_SYNTAX',
+ start = parenPos,
+ finish = call.finish,
+ }
+end
+
local function parseSimple(node, funcName)
local lastMethod
while true do
@@ -1869,6 +1886,7 @@ local function parseSimple(node, funcName)
call.args = args
end
addDummySelf(node, call)
+ checkAmbiguityCall(call, startPos)
node.parent = call
node = call
elseif token == '{' then