@codua/codeoutline-win32-x64 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -3
- package/README.zh-CN.md +40 -2
- package/bin/xnet.exe +0 -0
- package/build-info.json +1 -1
- package/package.json +1 -1
- package/scripts/codeoutline/affected.lua +145 -0
- package/scripts/codeoutline/automatic_events.lua +202 -0
- package/scripts/codeoutline/cache_repairs.lua +47 -0
- package/scripts/codeoutline/callers.lua +56 -16
- package/scripts/codeoutline/cargo_toml.lua +125 -0
- package/scripts/codeoutline/command.lua +26 -4
- package/scripts/codeoutline/common.lua +48 -7
- package/scripts/codeoutline/completion.lua +126 -22
- package/scripts/codeoutline/coverage.lua +63 -0
- package/scripts/codeoutline/cpp_bindings.lua +46 -11
- package/scripts/codeoutline/cpp_fragments.lua +143 -0
- package/scripts/codeoutline/cpp_implementations.lua +340 -0
- package/scripts/codeoutline/cpp_includes.lua +156 -0
- package/scripts/codeoutline/cpp_macros.lua +279 -0
- package/scripts/codeoutline/cpp_receivers.lua +342 -0
- package/scripts/codeoutline/cpp_types.lua +285 -29
- package/scripts/codeoutline/definition_candidates.lua +186 -0
- package/scripts/codeoutline/dispatch_aliases.lua +10 -5
- package/scripts/codeoutline/documents.lua +22 -9
- package/scripts/codeoutline/explore.lua +243 -122
- package/scripts/codeoutline/external_headers.lua +176 -0
- package/scripts/codeoutline/foreign.lua +23 -3
- package/scripts/codeoutline/function_values.lua +69 -0
- package/scripts/codeoutline/go_methods.lua +931 -0
- package/scripts/codeoutline/go_modules.lua +329 -0
- package/scripts/codeoutline/graph.lua +322 -67
- package/scripts/codeoutline/implementations.lua +403 -0
- package/scripts/codeoutline/index.lua +161 -28
- package/scripts/codeoutline/index_worker.lua +11 -4
- package/scripts/codeoutline/indirect.lua +4 -2
- package/scripts/codeoutline/js_evidence.lua +2 -1
- package/scripts/codeoutline/js_resolution.lua +40 -12
- package/scripts/codeoutline/js_workspace.lua +325 -0
- package/scripts/codeoutline/lang/c.lua +15 -2
- package/scripts/codeoutline/lang/cpp.lua +32 -18
- package/scripts/codeoutline/lang/csharp.lua +1 -1
- package/scripts/codeoutline/lang/js.lua +56 -20
- package/scripts/codeoutline/lang/rust.lua +9 -1
- package/scripts/codeoutline/language_detect.lua +100 -0
- package/scripts/codeoutline/lsp.lua +173 -23
- package/scripts/codeoutline/lua_bindings.lua +151 -47
- package/scripts/codeoutline/lua_callback_loops.lua +210 -0
- package/scripts/codeoutline/main.lua +32 -7
- package/scripts/codeoutline/mcp.lua +52 -9
- package/scripts/codeoutline/navigation.lua +351 -65
- package/scripts/codeoutline/on_demand.lua +93 -0
- package/scripts/codeoutline/ordinary_bindings.lua +210 -34
- package/scripts/codeoutline/parse.lua +18 -2
- package/scripts/codeoutline/parse_pool.lua +1 -1
- package/scripts/codeoutline/parse_worker.lua +1 -1
- package/scripts/codeoutline/python_bindings.lua +2 -2
- package/scripts/codeoutline/query_filters.lua +65 -0
- package/scripts/codeoutline/query_report.lua +56 -19
- package/scripts/codeoutline/resolution.lua +23 -0
- package/scripts/codeoutline/rust_packages.lua +203 -0
- package/scripts/codeoutline/rust_resolution.lua +301 -0
- package/scripts/codeoutline/search_ranking.lua +70 -0
- package/scripts/codeoutline/service.lua +47 -7
- package/scripts/codeoutline/shared_events.lua +369 -0
- package/scripts/codeoutline/static_dispatch.lua +46 -11
- package/scripts/codeoutline/text.lua +3 -2
- package/scripts/codeoutline/ts_implementations.lua +81 -0
- package/scripts/codeoutline/type_bases.lua +61 -0
- package/scripts/codeoutline/type_hierarchy.lua +324 -0
- package/scripts/codeoutline/type_references.lua +291 -0
- package/scripts/codeoutline/type_uses.lua +260 -0
- package/scripts/codeoutline/update_sequence.lua +1 -1
- package/scripts/codeoutline/version.lua +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
-- Per-query search policy. Directory penalties never change graph visibility.
|
|
2
|
+
local rules = require('codeoutline.rules')
|
|
3
|
+
local text = require('codeoutline.text')
|
|
4
|
+
local M = { MAX_DIRECTORIES = 32, MAX_PATH_BYTES = 1024, PENALTY = 6 }
|
|
5
|
+
local defaults = { '/3rd/', '^3rd/', '/third_party/', '^third_party/', '/thirdparty/',
|
|
6
|
+
'/vendor/', '^vendor/', '/node_modules/', '/external/', '^external/', '/deps/', '^deps/' }
|
|
7
|
+
|
|
8
|
+
local function directory(value)
|
|
9
|
+
assert(type(value) == 'string' and value:find('%S') and #value <= M.MAX_PATH_BYTES
|
|
10
|
+
and not value:find('[%z\r\n]') and text.valid(value) == value,
|
|
11
|
+
'deprioritize must contain non-empty UTF-8 directory paths up to 1024 bytes without NUL or newlines')
|
|
12
|
+
value = value:gsub('\\', '/')
|
|
13
|
+
assert(value:sub(1, 1) ~= '/' and not value:find(':', 1, true) and not value:find('[%*%?]'),
|
|
14
|
+
'deprioritize requires project-relative directory prefixes, not absolute paths or globs')
|
|
15
|
+
local parts = {}
|
|
16
|
+
for part in value:gmatch('[^/]+') do
|
|
17
|
+
assert(part ~= '..', 'deprioritize directories must stay inside the project')
|
|
18
|
+
if part ~= '.' then parts[#parts + 1] = part end
|
|
19
|
+
end
|
|
20
|
+
assert(#parts > 0, 'deprioritize must name a directory, not the project root')
|
|
21
|
+
return table.concat(parts, '/') .. '/'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
function M.policy(root)
|
|
25
|
+
local value = rules.read(root).deprioritize
|
|
26
|
+
local prefixes, seen = {}, {}
|
|
27
|
+
local configured = value ~= nil
|
|
28
|
+
if configured then
|
|
29
|
+
assert(type(value) == 'table' and #value <= M.MAX_DIRECTORIES,
|
|
30
|
+
'deprioritize must be an array of at most 32 directory paths')
|
|
31
|
+
local count = 0
|
|
32
|
+
for k in pairs(value) do
|
|
33
|
+
assert(type(k) == 'number' and k % 1 == 0 and k >= 1 and k <= #value, 'deprioritize must be an array')
|
|
34
|
+
count = count + 1
|
|
35
|
+
end
|
|
36
|
+
assert(count == #value, 'deprioritize must be an array')
|
|
37
|
+
for _, path in ipairs(value) do
|
|
38
|
+
local prefix = directory(path)
|
|
39
|
+
if not seen[prefix] then prefixes[#prefixes + 1] = prefix; seen[prefix] = true end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
local cache = {}
|
|
43
|
+
local P = { configured = configured, stats = { configured = configured,
|
|
44
|
+
rules = configured and #prefixes or #defaults, checked_files = 0, matched_files = 0 } }
|
|
45
|
+
function P.penalty(path, explicit)
|
|
46
|
+
-- Keep legacy scores unchanged without configuration. A configured
|
|
47
|
+
-- directory never penalizes an explicitly qualified symbol request.
|
|
48
|
+
if configured and explicit then return 0 end
|
|
49
|
+
local amount = cache[path]
|
|
50
|
+
if amount == nil then
|
|
51
|
+
amount = 0
|
|
52
|
+
if configured then
|
|
53
|
+
for _, prefix in ipairs(prefixes) do
|
|
54
|
+
if path:sub(1, #prefix) == prefix then amount = M.PENALTY; break end
|
|
55
|
+
end
|
|
56
|
+
else
|
|
57
|
+
for _, pattern in ipairs(defaults) do
|
|
58
|
+
if path:find(pattern) then amount = M.PENALTY; break end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
cache[path] = amount
|
|
62
|
+
P.stats.checked_files = P.stats.checked_files + 1
|
|
63
|
+
if amount > 0 then P.stats.matched_files = P.stats.matched_files + 1 end
|
|
64
|
+
end
|
|
65
|
+
return amount
|
|
66
|
+
end
|
|
67
|
+
return P
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
return M
|
|
@@ -14,14 +14,21 @@ local watch = false
|
|
|
14
14
|
-- last one. A resident index makes the heap large, so the garbage of polls
|
|
15
15
|
-- and requests (and a dropped project's whole index) would build up toward
|
|
16
16
|
-- the index's own size; hosts collect it on idle ticks with M.collect.
|
|
17
|
-
local gc = { live = collectgarbage('count'), running = false }
|
|
18
|
-
--
|
|
17
|
+
local gc = { live = collectgarbage('count'), running = false, again = false }
|
|
18
|
+
-- Limit incremental work per idle tick. The collector's atomic phase can take
|
|
19
|
+
-- longer than an ordinary step, so this is not a hard wall-time bound.
|
|
19
20
|
M.GC_MIN_KB, M.GC_STEP_KB = 16384, 512
|
|
20
21
|
|
|
22
|
+
local function reclaim_later()
|
|
23
|
+
-- A cycle already in progress may have marked the index we just dropped.
|
|
24
|
+
-- Finish it, then run a complete new cycle after the owner's stack unwinds.
|
|
25
|
+
gc.running, gc.again = true, true
|
|
26
|
+
end
|
|
27
|
+
|
|
21
28
|
local function drop(key)
|
|
22
29
|
local p = projects[key]
|
|
23
30
|
projects[key] = nil
|
|
24
|
-
if p then p.idx:close();
|
|
31
|
+
if p then p.idx:close(); reclaim_later() end
|
|
25
32
|
end
|
|
26
33
|
|
|
27
34
|
function M.configure(opts)
|
|
@@ -64,13 +71,17 @@ end
|
|
|
64
71
|
-- Run one bounded incremental GC step on an idle tick; returns whether a cycle
|
|
65
72
|
-- is still in progress. A cycle starts once the garbage since the last one
|
|
66
73
|
-- reaches a sixteenth of the live heap (at least GC_MIN_KB), or a project is
|
|
67
|
-
-- dropped, and then advances one step per call until it completes.
|
|
74
|
+
-- dropped/replaced, and then advances one step per call until it completes.
|
|
75
|
+
-- Dropped indexes also need a follow-up cycle to reclaim already-marked objects.
|
|
68
76
|
function M.collect()
|
|
69
77
|
if not gc.running then
|
|
70
78
|
if collectgarbage('count') - gc.live < math.max(M.GC_MIN_KB, gc.live / 16) then return false end
|
|
71
79
|
gc.running = true
|
|
72
80
|
end
|
|
73
|
-
if collectgarbage('step', M.GC_STEP_KB) then
|
|
81
|
+
if collectgarbage('step', M.GC_STEP_KB) then
|
|
82
|
+
if gc.again then gc.again = false
|
|
83
|
+
else gc.running, gc.live = false, collectgarbage('count') end
|
|
84
|
+
end
|
|
74
85
|
return gc.running
|
|
75
86
|
end
|
|
76
87
|
|
|
@@ -151,7 +162,20 @@ local function run_query(engine, root, query, opts)
|
|
|
151
162
|
local ok, result = pcall(function()
|
|
152
163
|
while true do
|
|
153
164
|
-- A GBK repair commits the decoded file, which renumbers its nodes.
|
|
154
|
-
local
|
|
165
|
+
local symbols, source_index, dynamic = idx:symbols(), idx, nil
|
|
166
|
+
if engine == explore then symbols, source_index, dynamic = require('codeoutline.on_demand').open(symbols, idx, query) end
|
|
167
|
+
local output, details = engine.run(symbols, source_index, query, opts)
|
|
168
|
+
if dynamic then
|
|
169
|
+
details.on_demand_files, details.on_demand_rejected, details.on_demand_truncated = dynamic.files, dynamic.rejected, dynamic.truncated
|
|
170
|
+
if output and #dynamic.files > 0 then
|
|
171
|
+
local notices = {}
|
|
172
|
+
for _, file in ipairs(dynamic.files) do
|
|
173
|
+
notices[#notices + 1] = string.format('On-demand source: %s (%s, %s); not stored in the index.', file.path, file.language, file.basis)
|
|
174
|
+
end
|
|
175
|
+
output, details.truncated = require('codeoutline.text').limit(table.concat(notices, '\n') .. '\n' .. output,
|
|
176
|
+
opts and opts.budget or explore.DEFAULT_BUDGET, details.truncated or dynamic.truncated)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
155
179
|
control.check()
|
|
156
180
|
if not details.encoding_retry then return { text = output, info = details } end
|
|
157
181
|
end
|
|
@@ -163,6 +187,10 @@ local function run_query(engine, root, query, opts)
|
|
|
163
187
|
stats.cache_saved, stats.cache_error = saved, err
|
|
164
188
|
end
|
|
165
189
|
result.info.refresh = stats
|
|
190
|
+
result.info.coverage = require('codeoutline.coverage').summarize(result.info)
|
|
191
|
+
result.info.resolution = result.info.query_stats and result.info.query_stats.resolution
|
|
192
|
+
result.info.generation = idx.generation
|
|
193
|
+
result.info.projectPath = idx.root
|
|
166
194
|
return result.text, result.info
|
|
167
195
|
end
|
|
168
196
|
|
|
@@ -174,6 +202,18 @@ function M.callers(root, query, opts)
|
|
|
174
202
|
return run_query(require('codeoutline.callers'), root, query, opts)
|
|
175
203
|
end
|
|
176
204
|
|
|
205
|
+
function M.affected(root, files, opts)
|
|
206
|
+
return run_query(require('codeoutline.affected'), root, files, opts)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
function M.type_hierarchy(root, query, opts)
|
|
210
|
+
return run_query(require('codeoutline.type_hierarchy'), root, query, opts)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
function M.type_references(root, query, opts)
|
|
214
|
+
return run_query(require('codeoutline.type_references'), root, query, opts)
|
|
215
|
+
end
|
|
216
|
+
|
|
177
217
|
function M.status(root, opts)
|
|
178
218
|
local idx, G, stats = M.get(root, opts)
|
|
179
219
|
local languages = {}
|
|
@@ -208,7 +248,7 @@ function M.rebuild(root, opts)
|
|
|
208
248
|
projects[key] = previous
|
|
209
249
|
error(result, 2)
|
|
210
250
|
end
|
|
211
|
-
if previous then previous.idx:close() end
|
|
251
|
+
if previous then previous.idx:close(); reclaim_later() end
|
|
212
252
|
return result
|
|
213
253
|
end
|
|
214
254
|
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
-- Query-owned ES module EventEmitter identities. Indexing keeps only role bits.
|
|
2
|
+
local M = { MAX_FILES = 32, MAX_BYTES = 2097152, MAX_FILE_BYTES = 262144,
|
|
3
|
+
MAX_SITES = 512, MAX_TARGETS = 64, MAX_DEPTH = 8, MAX_MS = 200 }
|
|
4
|
+
local control = require('codeoutline.control')
|
|
5
|
+
local methods = { emit = 1, on = 2, once = 2, addListener = 2,
|
|
6
|
+
off = 4, removeListener = 4, removeAllListeners = 4 }
|
|
7
|
+
local function supported(r) return r.language == 'javascript' or r.language == 'typescript' end
|
|
8
|
+
local function builtin(path) return path == 'events' or path == 'node:events' end
|
|
9
|
+
|
|
10
|
+
function M.roles(r, calls)
|
|
11
|
+
if not supported(r) then return 0 end
|
|
12
|
+
local found = {}
|
|
13
|
+
for name in pairs(calls) do
|
|
14
|
+
local role = methods[name:match('%.([%w_$]+)$')]
|
|
15
|
+
if role then found[role] = true end
|
|
16
|
+
end
|
|
17
|
+
for _, imp in ipairs(r.js_imports or {}) do if builtin(imp.path) then found[8] = true end end
|
|
18
|
+
return (found[1] and 1 or 0) + (found[2] and 2 or 0) + (found[4] and 4 or 0) + (found[8] and 8 or 0)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
local function has(r, role)
|
|
22
|
+
if not supported(r) then return false end
|
|
23
|
+
local roles = r.event_roles
|
|
24
|
+
if roles == nil then
|
|
25
|
+
local calls = {}; for _, name in ipairs(r.dispatch_calls or {}) do calls[name] = true end
|
|
26
|
+
roles = M.roles(r, calls)
|
|
27
|
+
end
|
|
28
|
+
if role == 7 then return roles % 8 ~= 0 end
|
|
29
|
+
return math.floor(roles / role) % 2 == 1
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
local function literal(T, i)
|
|
33
|
+
local s = T:text(i)
|
|
34
|
+
if T.k[i] == 'str' and (s:sub(1, 1) == '"' or s:sub(1, 1) == "'")
|
|
35
|
+
and s:sub(-1) == s:sub(1, 1) and not s:find('[\\$]') then return s:sub(2, -2) end
|
|
36
|
+
end
|
|
37
|
+
local function ending(T, i)
|
|
38
|
+
return T:text(i + 1) == ';' or T:text(i + 1) == '' or T:text(i + 1) == '}'
|
|
39
|
+
or T.l[i + 1] and T.l[i + 1] > T.l[i] and T.k[i + 1] ~= 'op'
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
function M.collect(r, T)
|
|
43
|
+
if not supported(r) or not r.js_imports or #r.js_imports == 0 then return end
|
|
44
|
+
local candidate, imported = false, {}
|
|
45
|
+
for _, imp in ipairs(r.js_imports) do
|
|
46
|
+
imported[imp.local_name] = true
|
|
47
|
+
if builtin(imp.path) then candidate = true end
|
|
48
|
+
end
|
|
49
|
+
if not candidate then
|
|
50
|
+
for _, ref in ipairs(r.refs) do if ref.recv and methods[ref.name] then candidate = true; break end end
|
|
51
|
+
for _, export in ipairs(r.js_exports or {}) do
|
|
52
|
+
if not export.path and imported[export.local_name] then candidate = true; break end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
if not candidate then return end
|
|
56
|
+
local expand, binding = require('codeoutline.dispatch_aliases').prepare(r, T)
|
|
57
|
+
local result = { objects = {}, exports = {}, entities = {}, sites = {}, weight = 0 }
|
|
58
|
+
r.shared_events = result
|
|
59
|
+
local headers, classes, skip, objects, refs, variables = {}, {}, {}, {}, {}, {}
|
|
60
|
+
for id, n in ipairs(r.nodes) do
|
|
61
|
+
if not n.parent and n.kind == 'variable' then variables[n.name] = id end
|
|
62
|
+
if n.kind == 'class' or n.kind == 'interface' then classes[n.name] = true end
|
|
63
|
+
if n.kind == 'function' or n.kind == 'method' or n.kind == 'constructor' then
|
|
64
|
+
for i = n.ti, n.tj do
|
|
65
|
+
if T:text(i) == 'function' or T:text(i) == '=>' then headers[i] = true end
|
|
66
|
+
if T:text(i) == '{' then break end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
for _, ref in ipairs(r.refs) do refs[ref.tok] = ref end
|
|
71
|
+
for i = 1, T.n do
|
|
72
|
+
if i % 4096 == 0 then control.check() end
|
|
73
|
+
local word = T:text(i)
|
|
74
|
+
if (word == 'function' or word == '=>') and not headers[i] then result.unsupported = true; return end
|
|
75
|
+
if word == 'import' and T:text(i + 1) ~= '(' or word == 'export' and T:text(i + 1) == '{' then
|
|
76
|
+
local j = i + 1
|
|
77
|
+
while j <= T.n do
|
|
78
|
+
skip[j] = true
|
|
79
|
+
if T.m[j] and T.m[j] > j then
|
|
80
|
+
for x = j, T.m[j] do skip[x] = true end
|
|
81
|
+
j = T.m[j]
|
|
82
|
+
end
|
|
83
|
+
if T:text(j) == ';' or T.k[j] == 'str' or T:text(j) == '}' or j > i + 1 and (T.l[j + 1] or math.huge) > T.l[j] then break end
|
|
84
|
+
j = j + 1
|
|
85
|
+
end
|
|
86
|
+
elseif word == 'export' and T:text(i + 1) == 'default' and T.k[i + 2] == 'id' then skip[i + 2] = true end
|
|
87
|
+
if T:text(i - 1) == 'const' and T.k[i] == 'id' and T:text(i + 1) == '='
|
|
88
|
+
and T:text(i + 2) == 'new' and T.k[i + 3] == 'id' then
|
|
89
|
+
local last = i + 3
|
|
90
|
+
if T:text(last + 1) == '.' and T.k[last + 2] == 'id' then last = last + 2 end
|
|
91
|
+
local open = last + 1
|
|
92
|
+
local factory = expand({ symbol = T.src:sub(T.s[i + 3], T.e[last]):gsub('%s+', '') }, i + 3)
|
|
93
|
+
local token, scope = binding(T:text(i), i)
|
|
94
|
+
if token == i and scope == 0 and not classes[T:text(i + 3)] and factory and factory.import
|
|
95
|
+
and builtin(factory.import.path) and (factory.member == 'EventEmitter' or factory.member == 'default')
|
|
96
|
+
and T:text(open) == '(' and T.m[open] == open + 1 and ending(T, T.m[open]) then
|
|
97
|
+
local object = { name = T:text(i), token = i }
|
|
98
|
+
object.node = variables[object.name]
|
|
99
|
+
if object.node then objects[i] = object end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
local entities = {}
|
|
104
|
+
local function entity(name, at)
|
|
105
|
+
local token = binding(name, at)
|
|
106
|
+
local object = token and objects[token]
|
|
107
|
+
local value = not object and expand({ symbol = name }, at)
|
|
108
|
+
local key, descriptor
|
|
109
|
+
if object then key, descriptor = 'local:' .. token, { object = object.name }
|
|
110
|
+
elseif value and value.import and not builtin(value.import.path) and value.member:match('^[%w_$]+$') then
|
|
111
|
+
key, descriptor = value.import.path .. '\0' .. value.member, { path = value.import.path, member = value.member }
|
|
112
|
+
else return end
|
|
113
|
+
if not entities[key] then
|
|
114
|
+
if #result.entities >= M.MAX_SITES then result.incomplete = true; return end
|
|
115
|
+
descriptor.name = name; result.entities[#result.entities + 1] = descriptor
|
|
116
|
+
entities[key] = descriptor; result.weight = result.weight + 256
|
|
117
|
+
end
|
|
118
|
+
return entities[key]
|
|
119
|
+
end
|
|
120
|
+
for i = 1, T.n do
|
|
121
|
+
if i % 4096 == 0 then control.check() end
|
|
122
|
+
if not skip[i] and T.k[i] == 'id' and T:text(i - 1) ~= '.' and T:text(i - 1) ~= '?.'
|
|
123
|
+
and T:text(i - 1) ~= 'const' and not objects[i] then
|
|
124
|
+
local e = entity(T:text(i), i)
|
|
125
|
+
if e then
|
|
126
|
+
local method, ref, open = T:text(i + 2), refs[i + 2], i + 3
|
|
127
|
+
local before = T:text(i - 1)
|
|
128
|
+
local start = before == '' or before == ';' or before == '{' or before == '}'
|
|
129
|
+
or T.l[i] > T.l[i - 1] and T.k[i - 1] ~= 'op'
|
|
130
|
+
-- Simple local aliases of an imported binding reuse lexical validation.
|
|
131
|
+
local alias = e.path and before == '=' and T:text(i - 3) == 'const' and ending(T, i)
|
|
132
|
+
if alias then
|
|
133
|
+
elseif not start or T:text(i + 1) ~= '.' or not ref or T:text(open) ~= '('
|
|
134
|
+
or not T.m[open] or not ending(T, T.m[open]) or not methods[method] or methods[method] == 4 then e.invalid = true
|
|
135
|
+
else
|
|
136
|
+
local close, event = T.m[open], literal(T, open + 1)
|
|
137
|
+
local handler
|
|
138
|
+
if methods[method] == 2 and T:text(open + 2) == ',' then
|
|
139
|
+
local text = T.src:sub(T.s[open + 3] or 1, T.e[close - 1] or 0):gsub('%s+', '')
|
|
140
|
+
handler = text:match('^[%a_$][%w_$.]*$') and not classes[text:match('^[%w_$]+')]
|
|
141
|
+
and expand({ symbol = text }, open + 3)
|
|
142
|
+
if not handler or not (handler.node or handler.import) or ref.from ~= 0 then e.invalid = true end
|
|
143
|
+
end
|
|
144
|
+
if not event or T:text(open + 2) ~= ',' and open + 2 ~= close then e.invalid = true end
|
|
145
|
+
if not e.invalid and (method == 'emit' or handler) then
|
|
146
|
+
if #result.sites >= M.MAX_SITES then result.incomplete = true; break end
|
|
147
|
+
result.sites[#result.sites + 1] = { entity = e, event = event, method = method, handler = handler,
|
|
148
|
+
from = ref.from, line = ref.line, first = T.s[open + 1] - 1, last = T.e[open + 1] }
|
|
149
|
+
result.weight = result.weight + 512
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
for token, object in pairs(objects) do
|
|
156
|
+
local e = entity(object.name, T.n)
|
|
157
|
+
if e and not e.invalid then result.objects[object.name] = object end
|
|
158
|
+
end
|
|
159
|
+
for _, export in ipairs(r.js_exports or {}) do
|
|
160
|
+
if not export.path and export.local_name then
|
|
161
|
+
local e = entity(export.local_name, T.n)
|
|
162
|
+
result.exports[export.local_name] = e
|
|
163
|
+
if e and e.object and result.objects[e.object] then result.objects[e.object].exported = true end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
function M.context(G, ctx, report)
|
|
169
|
+
if ctx.shared_event_context then return ctx.shared_event_context end
|
|
170
|
+
local reasons = {}
|
|
171
|
+
local C = { incomplete = false, stats = { files = 0, bytes = 0, sites = 0, links = 0, identities = 0,
|
|
172
|
+
incomplete_reasons = reasons } }
|
|
173
|
+
local function incomplete(reason) C.incomplete = true; reasons[reason] = true end
|
|
174
|
+
ctx.shared_event_context = C
|
|
175
|
+
local js = require('codeoutline.js_resolution')
|
|
176
|
+
local cache, identities, buses, started = {}, {}, {}, nil
|
|
177
|
+
local all_files, emitting = nil, {}
|
|
178
|
+
local function files()
|
|
179
|
+
if not all_files then
|
|
180
|
+
all_files = {}; local seen = {}
|
|
181
|
+
for _, list in ipairs({ G.file_order, G.new_files or {} }) do for _, f in ipairs(list) do
|
|
182
|
+
if not seen[f] then seen[f] = true; all_files[#all_files + 1] = f end
|
|
183
|
+
end end
|
|
184
|
+
table.sort(all_files, function(a,b) return G.files[a].path < G.files[b].path end)
|
|
185
|
+
end
|
|
186
|
+
return all_files
|
|
187
|
+
end
|
|
188
|
+
local function emits(f)
|
|
189
|
+
if not emitting[f] then
|
|
190
|
+
local found, refs = {}, G.files[f].refs
|
|
191
|
+
for i, name in ipairs(refs.name) do
|
|
192
|
+
if i % 128 == 0 then control.check() end
|
|
193
|
+
if name == 'emit' and refs.recv[i] and refs.from[i] > 0 then
|
|
194
|
+
found[G.id_of[f][refs.from[i]]] = true
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
emitting[f] = found
|
|
198
|
+
end
|
|
199
|
+
return emitting[f]
|
|
200
|
+
end
|
|
201
|
+
local function allowed()
|
|
202
|
+
control.check(); started = started or xtimer.now_ms()
|
|
203
|
+
if xtimer.now_ms() - started > M.MAX_MS then incomplete('time_limit'); return false end
|
|
204
|
+
return true
|
|
205
|
+
end
|
|
206
|
+
local function data(f)
|
|
207
|
+
if cache[f] ~= nil then return cache[f] or nil end
|
|
208
|
+
local rec = G.files[f]
|
|
209
|
+
if not supported(rec) or not allowed() then return end
|
|
210
|
+
local size = ctx.ordinary.source_size(f) or 0
|
|
211
|
+
if C.stats.files >= M.MAX_FILES then incomplete('file_limit'); return end
|
|
212
|
+
if size > M.MAX_FILE_BYTES then incomplete('file_size_limit'); return end
|
|
213
|
+
if C.stats.bytes + size > M.MAX_BYTES then incomplete('source_byte_limit'); return end
|
|
214
|
+
C.stats.files, C.stats.bytes = C.stats.files + 1, C.stats.bytes + size
|
|
215
|
+
local d = ctx.ordinary.data(f).shared_events
|
|
216
|
+
if d and d.unsupported then incomplete('unsupported_syntax'); d = nil end
|
|
217
|
+
if d and d.incomplete then incomplete('site_limit'); d = nil end
|
|
218
|
+
if d and C.stats.sites + #d.sites + #d.entities > M.MAX_SITES then incomplete('site_limit'); d = nil end
|
|
219
|
+
if d then C.stats.sites = C.stats.sites + #d.sites + #d.entities end
|
|
220
|
+
cache[f] = d or false; return d
|
|
221
|
+
end
|
|
222
|
+
local identity, descriptor
|
|
223
|
+
descriptor = function(f, e, seen, depth)
|
|
224
|
+
if not e or e.invalid or not allowed() then return end
|
|
225
|
+
if e.object then
|
|
226
|
+
local d = data(f); local object = d and d.objects[e.object]
|
|
227
|
+
if object and object.exported then return { key = f .. '\0' .. object.node, file = f, node = G.id_of[f][object.node] } end
|
|
228
|
+
elseif e.path then
|
|
229
|
+
local target = js.module(G, f, e.path, ctx)
|
|
230
|
+
if target then return identity(target, e.member, seen, depth + 1) end
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
identity = function(f, name, seen, depth)
|
|
234
|
+
if depth > M.MAX_DEPTH then incomplete('depth_limit'); return end
|
|
235
|
+
if not allowed() then return end
|
|
236
|
+
local key = f .. '\0' .. name
|
|
237
|
+
if identities[key] ~= nil then return identities[key] or nil end
|
|
238
|
+
if seen[key] then incomplete('cyclic_export'); return end
|
|
239
|
+
seen[key] = true; C.stats.identities = C.stats.identities + 1
|
|
240
|
+
local entries, explicit, found, ambiguous = G.files[f].js_exports or {}, false, nil, false
|
|
241
|
+
for _, e in ipairs(entries) do if e.name == name then explicit = true end end
|
|
242
|
+
for _, e in ipairs(entries) do
|
|
243
|
+
if e.name == name or not explicit and e.name == '*' and name ~= 'default' then
|
|
244
|
+
local value, want = nil, e.local_name == '*' and name or e.local_name
|
|
245
|
+
if e.path then
|
|
246
|
+
local target = js.module(G, f, e.path, ctx)
|
|
247
|
+
if target then value = identity(target, want, seen, depth + 1) end
|
|
248
|
+
else
|
|
249
|
+
local d = data(f)
|
|
250
|
+
value = d and descriptor(f, d.exports[want], seen, depth)
|
|
251
|
+
end
|
|
252
|
+
if value then
|
|
253
|
+
if found and found.key ~= value.key then ambiguous = true else found = value end
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
seen[key] = nil
|
|
258
|
+
if ambiguous then incomplete('ambiguous_binding'); found = nil end
|
|
259
|
+
identities[key] = found or false; return found
|
|
260
|
+
end
|
|
261
|
+
local function handler(f, value)
|
|
262
|
+
if value.node then return { G.id_of[f][value.node] } end
|
|
263
|
+
return js.imported(G, f, value.import.path, value.member, ctx)
|
|
264
|
+
end
|
|
265
|
+
local function load_bus(owner)
|
|
266
|
+
if buses[owner.key] then return buses[owner.key] end
|
|
267
|
+
local out, emits, registrations, invalid = {}, {}, {}, false
|
|
268
|
+
buses[owner.key] = out
|
|
269
|
+
local related = ctx.ordinary.candidates({ [owner.node] = true })
|
|
270
|
+
for _, f in ipairs(files()) do
|
|
271
|
+
if related[f] and has(G.files[f], 7) then
|
|
272
|
+
if not allowed() then return {} end
|
|
273
|
+
local d = data(f)
|
|
274
|
+
if d then
|
|
275
|
+
local selected = {}
|
|
276
|
+
for _, e in ipairs(d.entities) do
|
|
277
|
+
-- Resolve identity even for poisoned uses, so remove/escape
|
|
278
|
+
-- in one consumer invalidates this bus's whole result.
|
|
279
|
+
local copy = {}; for k, v in pairs(e) do if k ~= 'invalid' then copy[k] = v end end
|
|
280
|
+
local value = descriptor(f, copy, {}, 0)
|
|
281
|
+
if value and value.key == owner.key then selected[e] = true; invalid = invalid or e.invalid end
|
|
282
|
+
end
|
|
283
|
+
for _, site in ipairs(d.sites) do if selected[site.entity] then
|
|
284
|
+
local value = { file = f, site = site }
|
|
285
|
+
if site.method == 'emit' and site.from > 0 then emits[#emits + 1] = value
|
|
286
|
+
elseif site.method ~= 'emit' then registrations[#registrations + 1] = value end
|
|
287
|
+
end end
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
if C.incomplete or invalid then return out end
|
|
292
|
+
local seen = {}
|
|
293
|
+
for _, emit in ipairs(emits) do for _, reg in ipairs(registrations) do
|
|
294
|
+
if emit.file ~= reg.file and emit.site.event == reg.site.event then
|
|
295
|
+
local ids = handler(reg.file, reg.site.handler)
|
|
296
|
+
if #ids == 1 and (G.nodes[ids[1]].kind == 'function' or G.nodes[ids[1]].kind == 'method') then
|
|
297
|
+
local source = G.id_of[emit.file][emit.site.from]
|
|
298
|
+
local key = source .. ':' .. ids[1] .. ':' .. emit.site.line
|
|
299
|
+
if not seen[key] then
|
|
300
|
+
if C.stats.links >= M.MAX_TARGETS then incomplete('target_limit'); buses[owner.key] = {}; return {} end
|
|
301
|
+
seen[key] = true; C.stats.links = C.stats.links + 1
|
|
302
|
+
out[#out + 1] = { source = source, target = ids[1], line = emit.site.line,
|
|
303
|
+
kind = 'automatic:event', site = emit.site, registered_at = G.files[reg.file].path .. ':' .. reg.site.line }
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
end end
|
|
308
|
+
return out
|
|
309
|
+
end
|
|
310
|
+
local function edges_for(f, site)
|
|
311
|
+
local owner = descriptor(f, site.entity, {}, 0)
|
|
312
|
+
return owner and load_bus(owner) or {}
|
|
313
|
+
end
|
|
314
|
+
local function publish(edge)
|
|
315
|
+
if report then report:add({ source = edge.source, target = edge.target, line = edge.line,
|
|
316
|
+
call = edge.site.entity.name .. '.emit', kind = 'possible event delivery (shared imported Node EventEmitter and literal event)',
|
|
317
|
+
registered_at = edge.registered_at }) end
|
|
318
|
+
end
|
|
319
|
+
function C.outgoing(id)
|
|
320
|
+
local f, out, seen = G.node_file[id], {}, {}
|
|
321
|
+
if not has(G.files[f], 1) or not emits(f)[id] then return out end
|
|
322
|
+
local d = data(f)
|
|
323
|
+
for _, site in ipairs(d and d.sites or {}) do
|
|
324
|
+
if site.method == 'emit' and G.id_of[f][site.from] == id then
|
|
325
|
+
for _, edge in ipairs(edges_for(f, site)) do
|
|
326
|
+
if edge.source == id and edge.site == site and not seen[edge] then seen[edge] = true; out[#out + 1] = edge; publish(edge) end
|
|
327
|
+
end
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
return out
|
|
331
|
+
end
|
|
332
|
+
function C.incoming(wanted)
|
|
333
|
+
local related, out, seen = ctx.ordinary.candidates(wanted), {}, {}
|
|
334
|
+
for _, f in ipairs(files()) do if related[f] and has(G.files[f], 2) then
|
|
335
|
+
local d = data(f)
|
|
336
|
+
for _, site in ipairs(d and d.sites or {}) do if site.handler then
|
|
337
|
+
local ids, relevant = handler(f, site.handler), false
|
|
338
|
+
for _, id in ipairs(ids) do if wanted[id] then relevant = true end end
|
|
339
|
+
if relevant then for _, edge in ipairs(edges_for(f, site)) do
|
|
340
|
+
if wanted[edge.target] and not seen[edge] then
|
|
341
|
+
seen[edge] = true; out[edge.source] = out[edge.source] or {}; out[edge.source][#out[edge.source] + 1] = edge; publish(edge)
|
|
342
|
+
end
|
|
343
|
+
end end
|
|
344
|
+
end end
|
|
345
|
+
end end
|
|
346
|
+
return out
|
|
347
|
+
end
|
|
348
|
+
function C.definition(f, offset, line)
|
|
349
|
+
if not has(G.files[f], 1) then return {} end
|
|
350
|
+
if line then
|
|
351
|
+
local found, refs = false, G.files[f].refs
|
|
352
|
+
for i, name in ipairs(refs.name) do if name == 'emit' and refs.line[i] == line then found = true; break end end
|
|
353
|
+
if not found then return {} end
|
|
354
|
+
end
|
|
355
|
+
local d, out, seen, recognized = data(f), {}, {}, false
|
|
356
|
+
for _, site in ipairs(d and d.sites or {}) do
|
|
357
|
+
if site.method == 'emit' and site.first <= offset and offset < site.last and site.from > 0 then
|
|
358
|
+
recognized = true
|
|
359
|
+
for _, edge in ipairs(C.outgoing(G.id_of[f][site.from])) do
|
|
360
|
+
if edge.site == site and not seen[edge.target] then seen[edge.target] = true; out[#out + 1] = edge.target end
|
|
361
|
+
end
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
return out, recognized
|
|
365
|
+
end
|
|
366
|
+
return C
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
return M
|
|
@@ -63,6 +63,7 @@ function M.collect(r, T)
|
|
|
63
63
|
local executable
|
|
64
64
|
for _, node in ipairs(r.nodes) do if callable[node.kind] then executable = true; break end end
|
|
65
65
|
if not executable then return end
|
|
66
|
+
local loops = lua and r.ordinary_bindings and require('codeoutline.lua_callback_loops').tokens_candidate(T)
|
|
66
67
|
-- Reject cheap negatives before collecting compact query hints.
|
|
67
68
|
for i = 1, T.n do
|
|
68
69
|
if i % 4096 == 0 then control.check() end
|
|
@@ -76,8 +77,22 @@ function M.collect(r, T)
|
|
|
76
77
|
r.static_dispatch_candidate = true; break
|
|
77
78
|
end
|
|
78
79
|
end
|
|
79
|
-
if not r.static_dispatch_candidate then return end
|
|
80
|
-
if not has_dispatch(T, lua) then
|
|
80
|
+
if not r.static_dispatch_candidate and not loops then return end
|
|
81
|
+
if r.static_dispatch_candidate and not has_dispatch(T, lua) then
|
|
82
|
+
r.static_dispatch_candidate = nil
|
|
83
|
+
if not loops then return end
|
|
84
|
+
end
|
|
85
|
+
-- Full indexing retains only a syntax candidate. Scope, registry writes
|
|
86
|
+
-- and resolved registrations belong to an open-file/query parse.
|
|
87
|
+
if not r.collect_static_dispatch and (r.defer_analysis or not r.ordinary_bindings and not r.ranges) then
|
|
88
|
+
local targets = {}
|
|
89
|
+
for _, i in ipairs(T:idents(1, T.n)) do
|
|
90
|
+
local prev = T:text(i - 1)
|
|
91
|
+
if prev == '=' or prev == '&' or prev == '{' or prev == ',' then targets[T:text(i)] = true end
|
|
92
|
+
end
|
|
93
|
+
r.static_dispatch_candidate = { targets = targets, syntax = true }
|
|
94
|
+
return
|
|
95
|
+
end
|
|
81
96
|
local scopes, ends, stack, owners = {}, { [0] = T.n }, {}, {}
|
|
82
97
|
local opens = { ['function'] = true, ['if'] = true, ['do'] = true, ['repeat'] = true }
|
|
83
98
|
for i = 1, T.n do
|
|
@@ -94,6 +109,11 @@ function M.collect(r, T)
|
|
|
94
109
|
-- Only executable owners: an initializer belongs to no caller function.
|
|
95
110
|
local ordered = {}
|
|
96
111
|
for id, n in ipairs(r.nodes) do if callable[n.kind] then ordered[#ordered + 1] = id end end
|
|
112
|
+
local functions_by_token
|
|
113
|
+
if loops then
|
|
114
|
+
functions_by_token = {}
|
|
115
|
+
for _, id in ipairs(ordered) do functions_by_token[r.nodes[id].ti] = id end
|
|
116
|
+
end
|
|
97
117
|
table.sort(ordered, function(a, b) return r.nodes[a].ti < r.nodes[b].ti end)
|
|
98
118
|
local cursor = 1; stack = {}
|
|
99
119
|
for i = 1, T.n do
|
|
@@ -135,6 +155,10 @@ function M.collect(r, T)
|
|
|
135
155
|
end
|
|
136
156
|
if depth > 0 and b.invalid then return nil end
|
|
137
157
|
if not b.function_name then return nil end
|
|
158
|
+
if functions_by_token then
|
|
159
|
+
local id = functions_by_token[b.token]
|
|
160
|
+
return id and r.nodes[id].name == name and id or nil
|
|
161
|
+
end
|
|
138
162
|
for id, n in ipairs(r.nodes) do
|
|
139
163
|
if callable[n.kind] and n.name == name and n.ti == b.token then return id end
|
|
140
164
|
end
|
|
@@ -413,6 +437,10 @@ function M.collect(r, T)
|
|
|
413
437
|
end
|
|
414
438
|
::continue::
|
|
415
439
|
end
|
|
440
|
+
if loops then require('codeoutline.lua_callback_loops').collect(r, T, {
|
|
441
|
+
binding = binding, parts = parts, scopes = scopes, ends = ends,
|
|
442
|
+
owners = owners, function_target = function_target, assignment_end = assignment_end,
|
|
443
|
+
}) end
|
|
416
444
|
-- Flatten shared temporary tables; no tokens/source survive query parsing.
|
|
417
445
|
for _, site in ipairs(data.sites) do
|
|
418
446
|
local entries = site.name and site.slots[site.name]
|
|
@@ -425,7 +453,7 @@ function M.collect(r, T)
|
|
|
425
453
|
site.registrations = valid and entries and not entries.unknown and entries or {}
|
|
426
454
|
site.slots, site.binding = nil, nil
|
|
427
455
|
end
|
|
428
|
-
if not r.collect_static_dispatch then
|
|
456
|
+
if not r.collect_static_dispatch and not r.ordinary_bindings and not r.ranges then
|
|
429
457
|
local targets, members = {}, {}
|
|
430
458
|
for _, site in ipairs(data.sites) do
|
|
431
459
|
if site.name then members[site_key(site.from, site.line, site.ref_recv, site.name)] = true end
|
|
@@ -436,15 +464,26 @@ function M.collect(r, T)
|
|
|
436
464
|
end
|
|
437
465
|
end
|
|
438
466
|
|
|
439
|
-
function M.query(G, report)
|
|
467
|
+
function M.query(G, report, ctx)
|
|
440
468
|
local graph = require('codeoutline.graph')
|
|
441
469
|
local cache, entries = {}, 0
|
|
442
470
|
local empty = { sites = {} }
|
|
471
|
+
local function remember(f, result)
|
|
472
|
+
entries = entries + 1 + #result.sites
|
|
473
|
+
for _, site in ipairs(result.sites) do entries = entries + #site.registrations end
|
|
474
|
+
assert(entries <= (M.max_query_entries or 100000), 'static dispatch query limit exceeded; narrow the project scope')
|
|
475
|
+
cache[f] = result
|
|
476
|
+
return result
|
|
477
|
+
end
|
|
443
478
|
local function data(f)
|
|
444
479
|
local rec = G.files[f]
|
|
445
480
|
if rec.static_dispatch then return rec.static_dispatch end
|
|
446
481
|
if not rec.static_dispatch_candidate or not G.root then return empty end
|
|
447
482
|
if cache[f] then return cache[f] end
|
|
483
|
+
if ctx and ctx.ordinary then
|
|
484
|
+
local result = ctx.ordinary.data(f).static_dispatch or empty
|
|
485
|
+
return remember(f, result)
|
|
486
|
+
end
|
|
448
487
|
local h = assert(io.open(G.root .. '/' .. rec.path, 'rb'), 'cannot read static dispatch source: ' .. rec.path)
|
|
449
488
|
local raw = h:read('a'); h:close()
|
|
450
489
|
local crc = xcompress and xcompress.crc32 and xcompress.crc32(raw) or xutils.sha256_hex(raw)
|
|
@@ -454,17 +493,13 @@ function M.query(G, report)
|
|
|
454
493
|
source = assert(xutils.to_utf8(raw, rec.encoding == 'gbk' and 'gbk' or 'auto'))
|
|
455
494
|
end
|
|
456
495
|
local parsed = require('codeoutline.parse').parse(rec.path, source,
|
|
457
|
-
{ ranges = false, dispatch_only = true, static_dispatch = true })
|
|
496
|
+
{ ranges = false, dispatch_only = true, static_dispatch = true, language = rec.language })
|
|
458
497
|
assert(#parsed.nodes == #rec.nodes, 'source encoding changed; refresh index: ' .. rec.path)
|
|
459
498
|
for i, n in ipairs(parsed.nodes) do
|
|
460
499
|
assert(n.qualified == rec.nodes[i].qualified and n.line == rec.nodes[i].line, 'source encoding changed; refresh index: ' .. rec.path)
|
|
461
500
|
end
|
|
462
501
|
local result = parsed.static_dispatch or { sites = {} }
|
|
463
|
-
|
|
464
|
-
for _, site in ipairs(result.sites) do entries = entries + #site.registrations end
|
|
465
|
-
assert(entries <= (M.max_query_entries or 100000), 'static dispatch query limit exceeded; narrow the project scope')
|
|
466
|
-
cache[f] = result
|
|
467
|
-
return result
|
|
502
|
+
return remember(f, result)
|
|
468
503
|
end
|
|
469
504
|
local function scan(f, only, wanted)
|
|
470
505
|
local result, deps, paired = {}
|
|
@@ -519,7 +554,7 @@ function M.query(G, report)
|
|
|
519
554
|
local refs = G.files[f].refs
|
|
520
555
|
if refs.kind[i] ~= 'member_call' then return false end
|
|
521
556
|
local hint = G.files[f].static_dispatch_candidate
|
|
522
|
-
if type(hint) == 'table' then
|
|
557
|
+
if type(hint) == 'table' and hint.members then
|
|
523
558
|
return hint.members[site_key(refs.from[i], refs.line[i], refs.recv[i], refs.name[i])] == true
|
|
524
559
|
end
|
|
525
560
|
for _, site in ipairs(data(f).sites) do
|