diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-12-14 17:42:31 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-12-14 17:42:31 +0800 |
commit | 8a28e876dd001daec94eb12cf037968f99dc4efe (patch) | |
tree | 4a3344a38462630f72c139f7a6815460c59736af /script-beta/parser/guide.lua | |
parent | a70dda951670e48b6fadc1263deccbbc8b948bea (diff) | |
download | lua-language-server-8a28e876dd001daec94eb12cf037968f99dc4efe.zip |
eachDef的一些想法
Diffstat (limited to 'script-beta/parser/guide.lua')
-rw-r--r-- | script-beta/parser/guide.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 2592955a..7680168d 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -588,9 +588,9 @@ end ---@return string|boolean mode ---@return table|nil pathA ---@return table|nil pathB -function m.getPath(a, b) +function m.getPath(a, b, sameFunction) --- 首先测试双方在同一个函数内 - if m.getParentFunction(a) ~= m.getParentFunction(b) then + if not sameFunction and m.getParentFunction(a) ~= m.getParentFunction(b) then return false end local mode @@ -612,14 +612,14 @@ function m.getPath(a, b) for _ = 1, 1000 do objA = m.getParentBlock(objA) pathA[#pathA+1] = objA - if objA.type == 'function' or objA.type == 'main' then + if (not sameFunction and objA.type == 'function') or objA.type == 'main' then break end end for _ = 1, 1000 do objB = m.getParentBlock(objB) pathB[#pathB+1] = objB - if objB.type == 'function' or objB.type == 'main' then + if (not sameFunction and objA.type == 'function') or objB.type == 'main' then break end end |