diff options
-rw-r--r-- | script-beta/core/semantic-tokens.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/script-beta/core/semantic-tokens.lua b/script-beta/core/semantic-tokens.lua index fa037610..21a251be 100644 --- a/script-beta/core/semantic-tokens.lua +++ b/script-beta/core/semantic-tokens.lua @@ -67,11 +67,15 @@ Care['getlocal'] = function (source, results) end -- 3. 不是函数的局部变量 local hasFunc - for _, def in ipairs(vm.getDefs(loc)) do - if def.type == 'function' - or (def.type == 'library' and def.value.type == 'function') then - hasFunc = true - break + local node = loc.node + if node then + for _, ref in ipairs(node.ref) do + local def = ref.value + if def.type == 'function' + or (def.type == 'library' and def.value.type == 'function') then + hasFunc = true + break + end end end if hasFunc then |