diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-10-28 16:36:50 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-10-28 16:36:50 +0800 |
commit | 8c3389778db135c4fef78db2ba5cb50d4cb5b448 (patch) | |
tree | 2c729526aad0f562edfe6794dba81f1136e5b46d /server-beta/src/parser | |
parent | 13a9025d969bc416cd4c1057865448812f00e00b (diff) | |
download | lua-language-server-8c3389778db135c4fef78db2ba5cb50d4cb5b448.zip |
支持函数返回值
Diffstat (limited to 'server-beta/src/parser')
-rw-r--r-- | server-beta/src/parser/compile.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/server-beta/src/parser/compile.lua b/server-beta/src/parser/compile.lua index 2bcb7e46..51803753 100644 --- a/server-beta/src/parser/compile.lua +++ b/server-beta/src/parser/compile.lua @@ -194,6 +194,13 @@ local vmMap = { finish = obj.finish, } end + local func = guide.getParentFunction(obj) + if func then + if not func.returns then + func.returns = {} + end + func.returns[#func.returns+1] = obj + end end, ['label'] = function (obj) local block = guide.getBlock(obj) @@ -281,7 +288,13 @@ local vmMap = { Block = lastBlock end, ['break'] = function (obj) - if not guide.getBreakBlock(obj) then + local block = guide.getBreakBlock(obj) + if block then + if not block.breaks then + block.breaks = {} + end + block.breaks[#block.breaks+1] = obj + else pushError { type = 'BREAK_OUTSIDE', start = obj.start, |