summaryrefslogtreecommitdiff
path: root/script/vm/field.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm/field.lua')
-rw-r--r--script/vm/field.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/script/vm/field.lua b/script/vm/field.lua
index 52c56e7f..563c7868 100644
--- a/script/vm/field.lua
+++ b/script/vm/field.lua
@@ -7,9 +7,21 @@ local localID = require 'vm.local-id'
local globalMgr = require 'vm.global-manager'
local nodeMgr = require 'vm.node'
+local searchByNodeSwitch = util.switch()
+ : case 'global'
+ ---@param global vm.node.global
+ : call(function (global, pushResult)
+ for _, set in ipairs(global:getSets()) do
+ pushResult(set)
+ end
+ end)
+ : default(function (source, pushResult)
+ pushResult(source)
+ end)
+
local function searchByNode(source, pushResult)
compiler.compileByParentNode(source, nil, function (field)
- pushResult(field)
+ searchByNodeSwitch(field.type, field, pushResult)
end)
end