blob: 11a644218a7e1f1ed1c1f6a1e1ee252d983fd582 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
local util = require 'utility'
---@class vm
local vm = require 'vm.vm'
local simpleMap = util.switch()
: case 'local'
: call(function (source, results)
results[#results+1] = source
end)
: case 'getlocal'
: case 'setlocal'
: call(function (source, results)
results[#results+1] = source.node
end)
: getMap()
function vm.getDefs(source, field)
local results = {}
local simple = simpleMap[source.type]
if simple then
simple(source, results)
end
return results
end
function vm.getAllDefs(source, field)
return vm.getDefs(source, field)
end
|