diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-28 15:12:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-28 15:12:57 +0800 |
commit | 599b44716801aea385e5726a37c788cdf674f78a (patch) | |
tree | e9c6ab184c87113355a8e39e37041a2bb198f1f5 /script | |
parent | d5327b0fc28e638ff79845846981358938deb9f2 (diff) | |
download | lua-language-server-599b44716801aea385e5726a37c788cdf674f78a.zip |
fix #1242
wrong `sindex` in multi-assign which last exp is `call` or `varargs`
Diffstat (limited to 'script')
-rw-r--r-- | script/parser/compile.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/script/parser/compile.lua b/script/parser/compile.lua index ac599030..83153614 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -2767,11 +2767,15 @@ local function parseMultiVars(n1, parser, isLocal) missExp() end end - bindValue(n1, v1, 1, nil, isLocal, isSet) + local index = 1 + bindValue(n1, v1, index, nil, isLocal, isSet) local lastValue = v1 if n2 then max = 2 - bindValue(n2, v2, 2, lastValue, isLocal, isSet) + if not v2 then + index = 2 + end + bindValue(n2, v2, index, lastValue, isLocal, isSet) lastValue = v2 or lastValue pushActionIntoCurrentChunk(n2) end @@ -2780,7 +2784,10 @@ local function parseMultiVars(n1, parser, isLocal) local n = nrest[i] local v = vrest and vrest[i] max = i + 2 - bindValue(n, v, max, lastValue, isLocal, isSet) + if not v then + index = index + 1 + end + bindValue(n, v, index, lastValue, isLocal, isSet) lastValue = v or lastValue pushActionIntoCurrentChunk(n) end |