diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-12-16 22:01:04 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-12-16 22:01:04 +0800 |
commit | 1fcdba8cba71e6db67272550071c4e37aceb1994 (patch) | |
tree | f055926b62576a1c5b9fbbd34e20ad41863614d0 | |
parent | bbb604519b3fa84fccc6e58e68c96764a2b9b161 (diff) | |
download | lua-language-server-1fcdba8cba71e6db67272550071c4e37aceb1994.zip |
修正一些bug
-rw-r--r-- | script-beta/vm/refOf.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/script-beta/vm/refOf.lua b/script-beta/vm/refOf.lua index 8fdf85de..f31c0ec8 100644 --- a/script-beta/vm/refOf.lua +++ b/script-beta/vm/refOf.lua @@ -3,6 +3,15 @@ local guide = require 'parser.guide' local files = require 'files' local library = require 'library' +local function ofSelf(state, loc, callback) + -- self 的2个特殊引用位置: + -- 1. 当前方法定义时的对象(mt) + local method = loc.method + local node = method.node + callback(node) + -- 2. 调用该方法时传入的对象 +end + local function ofLocal(state, loc, callback) if state[loc] then return @@ -38,6 +47,9 @@ local function ofLocal(state, loc, callback) end end end + if loc.tag == 'self' then + ofSelf(state, loc, callback) + end end local function ofGlobal(state, source, callback) @@ -367,7 +379,7 @@ local function checkValue(state, source, callback) end end -local function checkSetValue(value, callback) +local function checkSetValue(state, value, callback) if value.type == 'field' or value.type == 'method' then value = value.parent @@ -438,6 +450,9 @@ function vm.refOf(state, source, callback) ofValue(state, source, callback) elseif stype == 'select' then ofSelect(state, source, callback) + elseif stype == 'call' then + ofCall(state, source.node, 1, callback) + ofSpecialCall(state, source, source.node, 1, callback) elseif stype == 'main' then ofMain(state, source, callback) elseif stype == 'paren' then |