blob: abc765cb7bd5bc8fe00a90965bc7617cc8af10b2 (
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 collector = require 'core.collector'
local vm = require 'vm.vm'
local noder = require 'core.noder'
function vm.hasGlobalSets(name)
local id = ('def:g:%q'):format(name)
return collector.has(id)
end
function vm.getGlobalSets(name)
local cache = vm.getCache 'getGlobalSets'
if cache[name] then
return cache[name]
end
local results = {}
cache[name] = results
local id
if name == '*' then
id = 'def:g:'
else
id = ('def:g:%q'):format(name)
end
for node in collector.each(id) do
noder.eachSource(node, function (source)
results[#results+1] = source
end)
end
return results
end
|