summaryrefslogtreecommitdiff
path: root/script/vm/field.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-01 03:35:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-01 03:35:40 +0800
commitb9fdfac7c33478161dc17b8e41a0bd46b6f23621 (patch)
treec9e748de4a93fa892851f8592545aadb20690009 /script/vm/field.lua
parentd8e7c0b4b388c5ca125d17554814be68444ce1aa (diff)
downloadlua-language-server-b9fdfac7c33478161dc17b8e41a0bd46b6f23621.zip
update
Diffstat (limited to 'script/vm/field.lua')
-rw-r--r--script/vm/field.lua22
1 files changed, 3 insertions, 19 deletions
diff --git a/script/vm/field.lua b/script/vm/field.lua
index c30e112d..52c56e7f 100644
--- a/script/vm/field.lua
+++ b/script/vm/field.lua
@@ -7,26 +7,10 @@ local localID = require 'vm.local-id'
local globalMgr = require 'vm.global-manager'
local nodeMgr = require 'vm.node'
-local searchNodeSwitch = util.switch()
- : case 'table'
- : call(function (node, pushResult)
- for _, field in ipairs(node) do
- if field.type == 'tablefield'
- or field.type == 'tableindex' then
- pushResult(field)
- end
- end
- end)
-
local function searchByNode(source, pushResult)
- local node = compiler.compileNode(source)
- if not node then
- return
- end
-
- for n in nodeMgr.eachNode(node) do
- searchNodeSwitch(n.type, n, pushResult)
- end
+ compiler.compileByParentNode(source, nil, function (field)
+ pushResult(field)
+ end)
end
---@param source parser.object