diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-27 00:06:48 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-27 00:06:48 +0800 |
commit | c50a20ddad4adb3e0f8ead37a2e6a9960fe3000d (patch) | |
tree | bbb1a4f02ae6e2f659dfc48c7339d7bb01de18b1 /script/vm/runner.lua | |
parent | 031dc060e3cf2096e9171e168f15346e7d481f41 (diff) | |
download | lua-language-server-c50a20ddad4adb3e0f8ead37a2e6a9960fe3000d.zip |
fix #1235 don't drop node in `for`/`while`...
Diffstat (limited to 'script/vm/runner.lua')
-rw-r--r-- | script/vm/runner.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/script/vm/runner.lua b/script/vm/runner.lua index acf5427d..0dd33595 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -137,19 +137,20 @@ function mt:_lookInto(action, topNode, outNode) set = action action = value end - if action.type == 'function' - or action.type == 'loop' + if action.type == 'function' then + self:_launchBlock(action, topNode:copy()) + elseif action.type == 'loop' or action.type == 'in' or action.type == 'repeat' or action.type == 'for' then - self:_launchBlock(action, topNode:copy()) + topNode = self:_launchBlock(action, topNode:copy()) elseif action.type == 'while' then local blockNode, mainNode = self:_lookInto(action.filter, topNode:copy(), topNode:copy()) if action.filter then self:_fastWard(action.filter.finish, blockNode) end - self:_launchBlock(action, blockNode:copy()) - topNode = mainNode + blockNode = self:_launchBlock(action, blockNode:copy()) + topNode = mainNode:merge(blockNode) elseif action.type == 'if' then local hasElse local mainNode = topNode:copy() |