diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-09-30 11:46:56 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-09-30 11:46:56 +0800 |
commit | dd545508bb79e1db16b071a9eb7424590fd6f561 (patch) | |
tree | 9ad0e8a9f6ec2b2a0e97d1bc775855783965a3c9 /server-beta/src/parser | |
parent | c4eb4df1a64c595ebcba9b1f2f01d626e447c8d6 (diff) | |
download | lua-language-server-dd545508bb79e1db16b071a9eb7424590fd6f561.zip |
暂存
Diffstat (limited to 'server-beta/src/parser')
-rw-r--r-- | server-beta/src/parser/guide.lua | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/server-beta/src/parser/guide.lua b/server-beta/src/parser/guide.lua index 37dd8061..f89b1f5f 100644 --- a/server-beta/src/parser/guide.lua +++ b/server-beta/src/parser/guide.lua @@ -359,7 +359,7 @@ function m.getKeyName(obj) end --- 获取对象所有field的key与valueObj -function m.eachField(obj, callback) +function m.eachChildValue(obj, callback) local vref = obj.vref if not vref then return @@ -378,7 +378,7 @@ function m.eachField(obj, callback) end --- 获取对象所有指定field的key与valueObj -function m.eachFieldOf(obj, field, callback) +function m.eachChildValueOf(obj, field, callback) local vref = obj.vref if not vref then return @@ -397,6 +397,29 @@ function m.eachFieldOf(obj, field, callback) end end +--- 获取对象所有field的引用 +function m.eachChildRef(obj, callback) + local vref = obj.vref + if not vref then + return + end + for x = 1, #vref do + local v = vref[x] + local cref = v.ref + if cref then + for y = 1, #cref do + local co = cref[y] + local ref = co.ref + if ref then + for i = 1, #ref do + callback(ref[i]) + end + end + end + end + end +end + --- 获取对象的所有引用 function m.eachRef(obj, callback) local ref = obj.ref |