summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-18 17:45:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-18 17:45:13 +0800
commit1f05b4561e043e6c40f1d82391280bb04f53393a (patch)
tree23660370f24353d5b78cae4d3b60bcf10141ae88 /script-beta
parent7c43e3361536dc92c807608ed0e9ca90be54dbaf (diff)
downloadlua-language-server-1f05b4561e043e6c40f1d82391280bb04f53393a.zip
重新设计 return
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/parser/guide.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index 2d68cd7a..fd229098 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -1359,10 +1359,11 @@ function m.checkCallMark(status, a, mark)
if not status.cache.callMark then
status.cache.callMark = {}
end
- if status.cache.callMark[a] then
- return true
+ if mark then
+ status.cache.callMark[a] = mark
+ else
+ return status.cache.callMark[a]
end
- status.cache.callMark[a] = mark
return false
end
@@ -1370,10 +1371,11 @@ function m.checkReturnMark(status, a, mark)
if not status.cache.returnMark then
status.cache.returnMark = {}
end
- if status.cache.returnMark[a] then
- return true
+ if mark then
+ status.cache.returnMark[a] = mark
+ else
+ return status.cache.returnMark[a]
end
- status.cache.returnMark[a] = mark
return false
end
@@ -1506,7 +1508,8 @@ function m.pushResult(status, mode, ref, simple)
if ref.node.special == 'rawset' then
results[#results+1] = ref
end
- elseif ref.parent.type == 'return' then
+ end
+ if ref.parent.type == 'return' then
if m.getParentFunction(ref) ~= m.getParentFunction(simple.first) then
results[#results+1] = ref
end
@@ -1537,6 +1540,9 @@ function m.pushResult(status, mode, ref, simple)
results[#results+1] = ref
end
end
+ if ref.parent.type == 'return' then
+ results[#results+1] = ref
+ end
elseif mode == 'field' then
if ref.type == 'setfield'
or ref.type == 'getfield'