diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-12-25 17:46:28 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-12-25 17:46:28 +0800 |
commit | 18083747fe324811dd0b25a1f0a0a50623003b40 (patch) | |
tree | 8f10a325ad01fdc141a0a43321bc84b27970bab6 /script-beta/vm/eachDef.lua | |
parent | 856a4cb27430d6d578a1ee450e7ac4aa13a5f4f1 (diff) | |
download | lua-language-server-18083747fe324811dd0b25a1f0a0a50623003b40.zip |
暂存
Diffstat (limited to 'script-beta/vm/eachDef.lua')
-rw-r--r-- | script-beta/vm/eachDef.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua index 61da11d9..92e7ec78 100644 --- a/script-beta/vm/eachDef.lua +++ b/script-beta/vm/eachDef.lua @@ -17,6 +17,21 @@ local function ofParentMT(func, callback) vm.eachDef(node, callback) end +local function checkValue(value, callback) + if not value then + return + end + local stype = value.type + if stype == 'number' + or stype == 'string' + or stype == 'function' + or stype == 'table' + or stype == 'nil' + or stype == 'boolean' then + callback(value) + end +end + local function ofLocal(loc, callback) -- 方法中的 self 使用了一个虚拟的定义位置 if loc.tag == 'self' then @@ -24,6 +39,7 @@ local function ofLocal(loc, callback) ofParentMT(func, callback) else callback(loc) + checkValue(loc.value, callback) end local refs = loc.ref if refs then @@ -31,6 +47,7 @@ local function ofLocal(loc, callback) local ref = refs[i] if vm.isSet(ref) then callback(ref) + checkValue(ref.value, callback) end end end |