@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,325 @@
|
|
|
1
|
+
-- Workspace package lookup is query-owned. Discover manifests from indexed
|
|
2
|
+
-- directories; never walk node_modules, execute package scripts, or guess src/.
|
|
3
|
+
local M = { MAX_CONFIG_BYTES = 1048576, MAX_TOTAL_BYTES = 8388608, MAX_CONFIGS = 1024,
|
|
4
|
+
MAX_DIRECTORIES = 4096, MAX_PACKAGES = 512, MAX_PATTERNS = 256 }
|
|
5
|
+
local control = require('codeoutline.control')
|
|
6
|
+
local paths = require('codeoutline.path')
|
|
7
|
+
local function dir(p) return p:match('^(.*)/[^/]+$') or '' end
|
|
8
|
+
local function join(a, b) return a == '' and b or a .. '/' .. b end
|
|
9
|
+
local function object(t) return type(t) == 'table' and getmetatable(t) ~= xutils.json_array_mt end
|
|
10
|
+
local function safe(s)
|
|
11
|
+
if type(s) ~= 'string' or s == '' or s:find('[\\%%:%z]') or s:sub(1, 1) == '/' then return false end
|
|
12
|
+
for part in (s .. '/'):gmatch('(.-)/') do
|
|
13
|
+
if part == '' or part == '.' or part == '..' or part == 'node_modules' then return false end
|
|
14
|
+
end
|
|
15
|
+
return true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
-- Keep JSON property order for conditional exports. No source or tokens survive
|
|
19
|
+
-- the read, and no custom properties are inserted into the decoded manifest.
|
|
20
|
+
local function json(raw)
|
|
21
|
+
local ok, data = pcall(xutils.json_unpack, raw)
|
|
22
|
+
if not ok or not object(data) then error('invalid workspace package.json', 0) end
|
|
23
|
+
local T = require('codeoutline.lang.js').lang:tokenize(raw)
|
|
24
|
+
local order = {}
|
|
25
|
+
local function visit(node, i, depth)
|
|
26
|
+
if depth > 64 then error('workspace JSON nesting limit reached', 0) end
|
|
27
|
+
if T:text(i) == '{' then
|
|
28
|
+
local keys, seen, j = {}, {}, i + 1
|
|
29
|
+
order[node] = keys
|
|
30
|
+
while j < T.m[i] do
|
|
31
|
+
local key = xutils.json_unpack(T:text(j))
|
|
32
|
+
if seen[key] then error('duplicate workspace JSON key', 0) end
|
|
33
|
+
seen[key] = true; keys[#keys + 1] = key
|
|
34
|
+
j = visit(node[key], j + 2, depth + 1)
|
|
35
|
+
if T:text(j) == ',' then j = j + 1 end
|
|
36
|
+
end
|
|
37
|
+
return T.m[i] + 1
|
|
38
|
+
elseif T:text(i) == '[' then
|
|
39
|
+
local j, k = i + 1, 1
|
|
40
|
+
while j < T.m[i] do
|
|
41
|
+
j = visit(node[k], j, depth + 1); k = k + 1
|
|
42
|
+
if T:text(j) == ',' then j = j + 1 end
|
|
43
|
+
end
|
|
44
|
+
return T.m[i] + 1
|
|
45
|
+
end
|
|
46
|
+
return i + 1
|
|
47
|
+
end
|
|
48
|
+
visit(data, 1, 0)
|
|
49
|
+
return { data = data, order = order }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
local function patterns(value)
|
|
53
|
+
if type(value) ~= 'table' or #value > M.MAX_PATTERNS then error('unsupported workspace patterns', 0) end
|
|
54
|
+
for k in pairs(value) do
|
|
55
|
+
if type(k) ~= 'number' or k < 1 or k > #value or k % 1 ~= 0 then error('unsupported workspace patterns', 0) end
|
|
56
|
+
end
|
|
57
|
+
local result = {}
|
|
58
|
+
for _, pattern in ipairs(value) do
|
|
59
|
+
if type(pattern) ~= 'string' or pattern:find('[{}%[%]\\%%:%z]') then error('unsupported workspace glob', 0) end
|
|
60
|
+
local excluded = pattern:sub(1, 1) == '!'
|
|
61
|
+
if excluded then pattern = pattern:sub(2) end
|
|
62
|
+
local segments = {}
|
|
63
|
+
if pattern:sub(1, 1) == '/' then error('workspace glob escapes project', 0) end
|
|
64
|
+
for segment in pattern:gmatch('[^/]+') do
|
|
65
|
+
if segment == '..' then error('workspace glob escapes project', 0)
|
|
66
|
+
elseif segment ~= '.' then segments[#segments + 1] = segment end
|
|
67
|
+
end
|
|
68
|
+
if #segments > 64 then error('workspace glob depth limit reached', 0) end
|
|
69
|
+
result[#result + 1] = { segments = segments, excluded = excluded }
|
|
70
|
+
end
|
|
71
|
+
return result
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
local function matches(segments, path)
|
|
75
|
+
local parts, memo = {}, {}
|
|
76
|
+
for part in path:gmatch('[^/]+') do parts[#parts + 1] = part end
|
|
77
|
+
local function match(i, j)
|
|
78
|
+
local key = i .. ':' .. j
|
|
79
|
+
if memo[key] ~= nil then return memo[key] end
|
|
80
|
+
local result = false
|
|
81
|
+
if i > #segments then result = j > #parts
|
|
82
|
+
elseif segments[i] == '**' then
|
|
83
|
+
result = match(i + 1, j) or j <= #parts and parts[j]:sub(1, 1) ~= '.' and match(i, j + 1)
|
|
84
|
+
elseif j <= #parts then
|
|
85
|
+
local pattern = segments[i]
|
|
86
|
+
if parts[j]:sub(1, 1) ~= '.' or pattern:sub(1, 1) == '.' then
|
|
87
|
+
pattern = pattern:gsub('([^%w*?])', '%%%1'):gsub('%*', '.*'):gsub('%?', '.')
|
|
88
|
+
result = parts[j]:match('^' .. pattern .. '$') ~= nil and match(i + 1, j + 1)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
memo[key] = result; return result
|
|
92
|
+
end
|
|
93
|
+
return match(1, 1)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
-- A finite YAML subset: a block or JSON flow list of quoted/plain string globs.
|
|
97
|
+
-- Other settings are ignored; anchors, aliases and expressions in packages fail closed.
|
|
98
|
+
local function pnpm(raw)
|
|
99
|
+
local list, active, seen = {}, false, false
|
|
100
|
+
for line in (raw .. '\n'):gmatch('(.-)\r?\n') do
|
|
101
|
+
local rest = line:match('^packages:%s*(.-)%s*$')
|
|
102
|
+
if rest then
|
|
103
|
+
if seen then error('duplicate pnpm packages field', 0) end
|
|
104
|
+
active, seen = true, true
|
|
105
|
+
rest = rest:gsub('%s+#.*$', '')
|
|
106
|
+
if rest ~= '' and rest:sub(1, 1) ~= '#' then
|
|
107
|
+
local ok, array = pcall(xutils.json_unpack, rest)
|
|
108
|
+
if not ok or type(array) ~= 'table' or getmetatable(array) ~= xutils.json_array_mt then
|
|
109
|
+
error('unsupported pnpm packages list', 0)
|
|
110
|
+
end
|
|
111
|
+
list, active = array, false
|
|
112
|
+
end
|
|
113
|
+
elseif active and line:match('^%S') then active = false
|
|
114
|
+
elseif active and not line:match('^%s*#') and not line:match('^%s*$') then
|
|
115
|
+
local item = line:match('^%s+%-%s+(.+)%s*$')
|
|
116
|
+
if not item then error('unsupported pnpm packages list', 0) end
|
|
117
|
+
local quote = item:sub(1, 1)
|
|
118
|
+
if quote == '"' then
|
|
119
|
+
local last, escaped = nil, false
|
|
120
|
+
for i = 2, #item do
|
|
121
|
+
local c = item:sub(i, i)
|
|
122
|
+
if c == '"' and not escaped then last = i; break end
|
|
123
|
+
escaped = c == '\\' and not escaped
|
|
124
|
+
end
|
|
125
|
+
local tail = last and item:sub(last + 1) or '?'
|
|
126
|
+
if not tail:match('^%s*$') and not tail:match('^%s+#') then error('unsupported pnpm workspace glob', 0) end
|
|
127
|
+
local ok, decoded = pcall(xutils.json_unpack, last and item:sub(1, last) or '')
|
|
128
|
+
if not ok then error('unsupported pnpm workspace glob', 0) end
|
|
129
|
+
item = decoded
|
|
130
|
+
elseif quote == "'" then
|
|
131
|
+
local decoded, tail = item:match("^'(.-)'(.*)$")
|
|
132
|
+
if not tail or not tail:match('^%s*$') and not tail:match('^%s+#') then
|
|
133
|
+
error('unsupported pnpm workspace glob', 0)
|
|
134
|
+
end
|
|
135
|
+
item = decoded
|
|
136
|
+
else
|
|
137
|
+
item = item:gsub('%s+#.*$', ''):gsub('%s+$', '')
|
|
138
|
+
if item:find('[&|>{}%[%]]') or item:sub(1, 1) == '*' then error('unsupported pnpm workspace glob', 0) end
|
|
139
|
+
end
|
|
140
|
+
list[#list + 1] = item
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
return patterns(list)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
local function context(G, ctx)
|
|
147
|
+
if ctx.workspace then return ctx.workspace end
|
|
148
|
+
local C = { configs = {}, workspaces = {}, owners = {}, probes = 0, bytes = 0 }
|
|
149
|
+
local stats = ctx.workspace_stats
|
|
150
|
+
local function fail(message) ctx.workspace_incomplete = true; error(message, 0) end
|
|
151
|
+
function C.read(rel)
|
|
152
|
+
if C.configs[rel] ~= nil then return C.configs[rel] or nil end
|
|
153
|
+
control.check()
|
|
154
|
+
C.probes = C.probes + 1
|
|
155
|
+
if C.probes > M.MAX_CONFIGS then fail('workspace configuration limit reached') end
|
|
156
|
+
local absolute = join(G.root, rel)
|
|
157
|
+
local real = xutils.realpath(absolute)
|
|
158
|
+
if not real then C.configs[rel] = false; return nil end
|
|
159
|
+
if not paths.contains(G.root, paths.normalize(real)) then fail('workspace configuration escapes project') end
|
|
160
|
+
local f = io.open(absolute, 'rb')
|
|
161
|
+
if not f then C.configs[rel] = false; return nil end
|
|
162
|
+
local raw = f:read(M.MAX_CONFIG_BYTES + 1); f:close()
|
|
163
|
+
if #raw > M.MAX_CONFIG_BYTES then fail('workspace configuration exceeds size limit') end
|
|
164
|
+
C.bytes = C.bytes + #raw; stats.reads = stats.reads + 1; stats.bytes = C.bytes
|
|
165
|
+
if C.bytes > M.MAX_TOTAL_BYTES then fail('workspace configuration budget reached') end
|
|
166
|
+
local value = rel:match('%.json$') and json(raw) or { patterns = pnpm(raw) }
|
|
167
|
+
C.configs[rel] = value
|
|
168
|
+
return value
|
|
169
|
+
end
|
|
170
|
+
function C.owner(file)
|
|
171
|
+
local directory = dir(G.files[file].path)
|
|
172
|
+
if C.owners[directory] ~= nil then return C.owners[directory] or nil end
|
|
173
|
+
local current = directory
|
|
174
|
+
while true do
|
|
175
|
+
local yaml = C.read(join(current, 'pnpm-workspace.yaml'))
|
|
176
|
+
local manifest = C.read(join(current, 'package.json'))
|
|
177
|
+
if yaml or manifest and manifest.data.workspaces ~= nil then
|
|
178
|
+
local spec = yaml and yaml.patterns
|
|
179
|
+
if not spec then
|
|
180
|
+
local value = manifest.data.workspaces
|
|
181
|
+
spec = patterns(object(value) and value.packages or value)
|
|
182
|
+
end
|
|
183
|
+
local result = { root = current, patterns = spec }
|
|
184
|
+
C.owners[directory] = result; return result
|
|
185
|
+
end
|
|
186
|
+
if current == '' then break end
|
|
187
|
+
current = dir(current)
|
|
188
|
+
end
|
|
189
|
+
C.owners[directory] = false
|
|
190
|
+
end
|
|
191
|
+
function C.packages(workspace)
|
|
192
|
+
if C.workspaces[workspace.root] then return C.workspaces[workspace.root] end
|
|
193
|
+
local directories, count = { [workspace.root] = true }, 1
|
|
194
|
+
local function add(directory)
|
|
195
|
+
control.check()
|
|
196
|
+
if ('/' .. directory .. '/'):find('/node_modules/', 1, true) then return end
|
|
197
|
+
if workspace.root ~= '' and directory ~= workspace.root
|
|
198
|
+
and directory:sub(1, #workspace.root + 1) ~= workspace.root .. '/' then return end
|
|
199
|
+
while directory ~= '' do
|
|
200
|
+
if directories[directory] then return end
|
|
201
|
+
if count >= M.MAX_DIRECTORIES then fail('workspace directory limit reached') end
|
|
202
|
+
directories[directory] = true; count = count + 1
|
|
203
|
+
directory = dir(directory)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
for directory in pairs(G.dir_files) do add(directory) end
|
|
207
|
+
for _, f in ipairs(G.new_files or {}) do add(dir(G.files[f].path)) end
|
|
208
|
+
local ordered = {}
|
|
209
|
+
for directory in pairs(directories) do ordered[#ordered + 1] = directory end
|
|
210
|
+
table.sort(ordered)
|
|
211
|
+
local packages, entries = {}, 0
|
|
212
|
+
for _, directory in ipairs(ordered) do
|
|
213
|
+
control.check()
|
|
214
|
+
local relative = workspace.root == '' and directory
|
|
215
|
+
or directory:sub(1, #workspace.root + 1) == workspace.root .. '/' and directory:sub(#workspace.root + 2)
|
|
216
|
+
local include = directory == workspace.root
|
|
217
|
+
if relative and relative ~= '' then
|
|
218
|
+
local excluded = false
|
|
219
|
+
for _, pattern in ipairs(workspace.patterns) do
|
|
220
|
+
if matches(pattern.segments, relative) then
|
|
221
|
+
if pattern.excluded then excluded = true else include = true end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
include = include and not excluded
|
|
225
|
+
end
|
|
226
|
+
if include then
|
|
227
|
+
local config = C.read(join(directory, 'package.json'))
|
|
228
|
+
local name = config and config.data.name
|
|
229
|
+
if type(name) == 'string' then
|
|
230
|
+
entries = entries + 1
|
|
231
|
+
if entries > M.MAX_PACKAGES then fail('workspace package limit reached') end
|
|
232
|
+
if packages[name] then packages[name] = false
|
|
233
|
+
elseif packages[name] == nil then packages[name] = { root = directory, config = config } end
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
stats.directories, stats.packages = count, entries
|
|
238
|
+
C.workspaces[workspace.root] = packages; return packages
|
|
239
|
+
end
|
|
240
|
+
ctx.workspace = C
|
|
241
|
+
return C
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
local function selected(value, order, conditions, depth)
|
|
245
|
+
if depth > 16 then return nil, 'workspace export depth limit reached' end
|
|
246
|
+
if type(value) == 'string' then return value end
|
|
247
|
+
if value == xutils.json_null then return nil, 'workspace export is blocked' end
|
|
248
|
+
if type(value) ~= 'table' then return nil, 'unsupported workspace export' end
|
|
249
|
+
if not object(value) then
|
|
250
|
+
-- Do not substitute a later target merely because the first is unindexed.
|
|
251
|
+
if #value > 0 then return selected(value[1], order, conditions, depth + 1) end
|
|
252
|
+
return nil, 'workspace export has no target'
|
|
253
|
+
end
|
|
254
|
+
for _, condition in ipairs(order[value] or {}) do
|
|
255
|
+
if condition:sub(1, 1) == '.' then return nil, 'mixed workspace export map' end
|
|
256
|
+
if conditions[condition] then
|
|
257
|
+
local target, reason = selected(value[condition], order, conditions, depth + 1)
|
|
258
|
+
if target or reason ~= 'workspace export has no supported condition' then return target, reason end
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
return nil, 'workspace export has no supported condition'
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
function M.resolve(G, f, spec, ctx, mode, find)
|
|
265
|
+
if not G.root or spec:sub(1, 1) == '.' or spec:find('[\\%%:%z]') then return nil end
|
|
266
|
+
local package, subpath
|
|
267
|
+
if spec:sub(1, 1) == '@' then package, subpath = spec:match('^(@[^/]+/[^/]+)(.*)$')
|
|
268
|
+
else package, subpath = spec:match('^([^/]+)(.*)$') end
|
|
269
|
+
if not package or not safe(package) or subpath ~= '' and not safe(subpath:sub(2)) then return nil end
|
|
270
|
+
local C = context(G, ctx)
|
|
271
|
+
local workspace = C.owner(f)
|
|
272
|
+
if not workspace then return nil end
|
|
273
|
+
local packages = C.packages(workspace)
|
|
274
|
+
if packages[package] == false then return nil, 'ambiguous workspace package: ' .. package end
|
|
275
|
+
local entry = packages[package]
|
|
276
|
+
if not entry then return nil end
|
|
277
|
+
local manifest, target, reason = entry.config.data
|
|
278
|
+
if manifest.exports ~= nil then
|
|
279
|
+
local value, capture = manifest.exports, nil
|
|
280
|
+
local key = subpath == '' and '.' or '.' .. subpath
|
|
281
|
+
if object(value) then
|
|
282
|
+
local subpaths, conditions = false, false
|
|
283
|
+
for name in pairs(value) do if name:sub(1, 1) == '.' then subpaths = true else conditions = true end end
|
|
284
|
+
if subpaths and conditions then return nil, 'mixed workspace export map: ' .. package end
|
|
285
|
+
if subpaths then
|
|
286
|
+
if value[key] ~= nil then value = value[key]
|
|
287
|
+
else
|
|
288
|
+
local best, suffix_length = nil, -1
|
|
289
|
+
for pattern in pairs(value) do
|
|
290
|
+
local pre, post = pattern:match('^(.-)%*(.-)$')
|
|
291
|
+
if pre and not post:find('*', 1, true) and key:sub(1, #pre) == pre
|
|
292
|
+
and (#post == 0 or key:sub(-#post) == post) and #key >= #pre + #post
|
|
293
|
+
and (not best or #pre > #best or #pre == #best and #post > suffix_length) then
|
|
294
|
+
best, suffix_length = pre, #post
|
|
295
|
+
capture, target = key:sub(#pre + 1, #key - #post), value[pattern]
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
value = target
|
|
299
|
+
end
|
|
300
|
+
elseif key ~= '.' then value = nil end
|
|
301
|
+
elseif key ~= '.' then value = nil end
|
|
302
|
+
if value == nil then return nil, 'workspace subpath is not exported: ' .. spec end
|
|
303
|
+
local active = { default = true, node = true, import = mode ~= 'require', require = mode == 'require',
|
|
304
|
+
types = G.files[f].language == 'typescript' or G.files[f].language == 'arkts' }
|
|
305
|
+
target, reason = selected(value, entry.config.order, active, 0)
|
|
306
|
+
if not target then return nil, (reason or 'workspace export unresolved') .. ': ' .. spec end
|
|
307
|
+
if capture then
|
|
308
|
+
if not safe(capture) then return nil, 'invalid workspace export capture: ' .. spec end
|
|
309
|
+
target = target:gsub('%*', function() return capture end)
|
|
310
|
+
elseif target:find('*', 1, true) then return nil, 'unsupported workspace export target: ' .. spec end
|
|
311
|
+
if target:sub(1, 2) ~= './' then return nil, 'workspace export target must start with ./: ' .. spec end
|
|
312
|
+
elseif subpath ~= '' then target = subpath:sub(2)
|
|
313
|
+
else
|
|
314
|
+
if G.files[f].language == 'typescript' or G.files[f].language == 'arkts' then target = manifest.types or manifest.typings end
|
|
315
|
+
target = target or (mode ~= 'require' and manifest.module) or manifest.main or 'index'
|
|
316
|
+
end
|
|
317
|
+
if type(target) ~= 'string' then return nil, 'unsupported workspace package entry: ' .. spec end
|
|
318
|
+
target = target:gsub('^%./', '')
|
|
319
|
+
if not safe(target) then return nil, 'workspace target escapes package or is invalid: ' .. spec end
|
|
320
|
+
local id = find(join(entry.root, target))
|
|
321
|
+
if not id then return nil, 'workspace target is not indexed: ' .. spec end
|
|
322
|
+
return id
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
return M
|
|
@@ -45,10 +45,23 @@ body_cfg.directive, body_cfg.pp_first_branch = nil, nil
|
|
|
45
45
|
local body_lang = xscan.lang(body_cfg)
|
|
46
46
|
|
|
47
47
|
-- Names that look like a call but decorate a declaration.
|
|
48
|
-
local
|
|
48
|
+
local SAL = { In = true, Out = true, Inout = true, Outptr = true, Ret = true,
|
|
49
|
+
Pre = true, Post = true, At = true, When = true, Success = true, Check = true,
|
|
50
|
+
Analysis = true, Deref = true, Field = true, Group = true, Always = true,
|
|
51
|
+
Maybe = true, Use = true, Struct = true, On = true }
|
|
52
|
+
local ATTR = setmetatable({
|
|
49
53
|
__attribute__ = true, __attribute = true, __declspec = true, __asm__ = true,
|
|
50
54
|
__asm = true, asm = true, alignas = true, _Alignas = true,
|
|
51
|
-
|
|
55
|
+
_CRT_INSECURE_DEPRECATE_MEMORY = true, _CRT_INSECURE_DEPRECATE = true,
|
|
56
|
+
_CRT_INSECURE_DEPRECATE_CORE = true, _CRT_NONSTDC_DEPRECATE = true,
|
|
57
|
+
_CRT_DEPRECATE_TEXT = true,
|
|
58
|
+
}, { __index = function(_, name)
|
|
59
|
+
-- Microsoft SAL annotates declarations with nested function-like groups.
|
|
60
|
+
-- Recognize the annotation family, never the decorated API's name.
|
|
61
|
+
if type(name) == 'string' and name:sub(1, 1) == '_' and name:sub(-1) == '_' then
|
|
62
|
+
return SAL[name:match('^_([%a]+)_')]
|
|
63
|
+
end
|
|
64
|
+
end })
|
|
52
65
|
local AGGREGATE = { struct = true, union = true, enum = true }
|
|
53
66
|
|
|
54
67
|
local function is(T, i, s) return T.k[i] == 'op' and T:text(i) == s end
|
|
@@ -40,8 +40,7 @@ M.config = {
|
|
|
40
40
|
|
|
41
41
|
M.lang = xscan.lang(M.config)
|
|
42
42
|
|
|
43
|
-
local ATTR = {}
|
|
44
|
-
for k in pairs(c.ATTR) do ATTR[k] = true end
|
|
43
|
+
local ATTR = setmetatable({}, { __index = c.ATTR })
|
|
45
44
|
ATTR.decltype = true
|
|
46
45
|
|
|
47
46
|
local ACCESS = { public = true, private = true, protected = true }
|
|
@@ -205,14 +204,16 @@ local function cpp_decl(T, r, i, j, parent)
|
|
|
205
204
|
local first = T:text(i)
|
|
206
205
|
if first == 'typedef' then return c.declaration(T, r, i, j, parent) end
|
|
207
206
|
if first == 'using' then
|
|
207
|
+
if T:text(i + 1) == 'namespace' then r.cpp_using_directives = true end
|
|
208
208
|
if T.k[i + 1] == 'id' and is(T, i + 2, '=') then
|
|
209
209
|
common.add_node(r, T, { kind = 'typedef', name = T:text(i + 1), ni = i + 1, parent = parent, ti = i, tj = j, sig = common.sig(T, i, j) })
|
|
210
|
-
end
|
|
210
|
+
else r.cpp_imports = true end
|
|
211
211
|
return
|
|
212
212
|
end
|
|
213
213
|
if first == 'friend' or first == 'static_assert' or first == 'namespace' then return end
|
|
214
214
|
if first == 'enum' then return end -- enum class X : int;
|
|
215
215
|
if T.k[i] == 'kw' and CLASSLIKE[first] and j - i <= 3 then
|
|
216
|
+
r.cpp_imports = true
|
|
216
217
|
return -- class X; (struct X *p; still falls through)
|
|
217
218
|
end
|
|
218
219
|
local is_extern = first == 'extern' and T.k[i + 1] ~= 'str'
|
|
@@ -224,24 +225,35 @@ local function cpp_decl(T, r, i, j, parent)
|
|
|
224
225
|
if is(T, y, '=') and not eq and d == 0 and not kw(T, y - 1, 'operator') then eq = y end
|
|
225
226
|
if is(T, y, '(') and T.m[y] then
|
|
226
227
|
if not eq and d == 0 then
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
-- A function-pointer declarator is a field/variable, not a
|
|
229
|
+
-- function prototype: void (*callback)(int).
|
|
230
|
+
local close = T.m[y]
|
|
231
|
+
if is(T, y + 1, '*') and T.k[y + 2] == 'id' and close == y + 3
|
|
232
|
+
and is(T, close + 1, '(') and T.m[close + 1] then
|
|
233
|
+
names[#names + 1] = y + 2
|
|
234
|
+
y = T.m[close + 1] + 1
|
|
235
|
+
else
|
|
236
|
+
local info = name_before_paren(T, y, i)
|
|
237
|
+
if info and info.first > i - 1 and not ATTR[info.name] then
|
|
238
|
+
local ctor = parent and r.nodes[parent].name == info.name
|
|
239
|
+
if info.first == i and #info.quals == 0 and not info.name:find('^[~o]') and not ctor then
|
|
240
|
+
common.add_calls(r, T, i, j) -- MACRO(args);
|
|
241
|
+
return
|
|
242
|
+
end
|
|
243
|
+
common.add_node(r, T, {
|
|
244
|
+
kind = 'prototype', name = info.name, ni = info.ni, nj = info.nj, parent = parent,
|
|
245
|
+
ti = i, tj = j, sig = common.sig(T, i, T.m[y]),
|
|
246
|
+
quals = #info.quals > 0 and info.quals or nil,
|
|
247
|
+
static = first == 'static' or nil,
|
|
248
|
+
})
|
|
249
|
+
common.add_calls(r, T, T.m[y] + 1, j) -- default member initializers etc.
|
|
232
250
|
return
|
|
233
251
|
end
|
|
234
|
-
|
|
235
|
-
kind = 'prototype', name = info.name, ni = info.ni, nj = info.nj, parent = parent,
|
|
236
|
-
ti = i, tj = j, sig = common.sig(T, i, T.m[y]),
|
|
237
|
-
quals = #info.quals > 0 and info.quals or nil,
|
|
238
|
-
static = first == 'static' or nil,
|
|
239
|
-
})
|
|
240
|
-
common.add_calls(r, T, T.m[y] + 1, j) -- default member initializers etc.
|
|
241
|
-
return
|
|
252
|
+
y = T.m[y] + 1
|
|
242
253
|
end
|
|
254
|
+
else
|
|
255
|
+
y = T.m[y] + 1
|
|
243
256
|
end
|
|
244
|
-
y = T.m[y] + 1
|
|
245
257
|
elseif (is(T, y, '[') or is(T, y, '{')) and T.m[y] then
|
|
246
258
|
if T.k[y - 1] == 'id' and is(T, y, '{') and not eq and d == 0 then names[#names + 1] = y - 1 end
|
|
247
259
|
y = T.m[y] + 1
|
|
@@ -390,6 +402,7 @@ cpp_range = function(T, r, a, b, parent)
|
|
|
390
402
|
cpp_range(T, r, j + 1, close - 1, node)
|
|
391
403
|
i = close + 1
|
|
392
404
|
else
|
|
405
|
+
if is(T, j, '=') then r.cpp_imports = true end
|
|
393
406
|
while j <= b and not is(T, j, ';') do j = j + 1 end -- namespace alias
|
|
394
407
|
i = j + 1
|
|
395
408
|
end
|
|
@@ -533,8 +546,9 @@ end
|
|
|
533
546
|
-- A .h file is C++ when it uses C++-only syntax; otherwise the C parser
|
|
534
547
|
-- keeps handling it (C code may use `new`/`class` as plain identifiers).
|
|
535
548
|
function M.looks_cpp(src)
|
|
536
|
-
return src:find('%f[%w_]namespace%s+[%w_]*%s*{') or src:find('%f[%w_]class%s+[%w_]+%s*[:{]')
|
|
549
|
+
return src:find('%f[%w_]namespace%s+[%w_:]*%s*{') or src:find('%f[%w_]class%s+[%w_]+%s*[:{]')
|
|
537
550
|
or src:find('%f[%w_]template%s*<') or src:find('%f[%w_]public%s*:') or src:find('%f[%w_]std::')
|
|
551
|
+
or src:find('%f[%w_]namespace%s+[%w_]+%s*=') or src:find('%f[%w_]using%s+[%w_:]+')
|
|
538
552
|
end
|
|
539
553
|
|
|
540
554
|
return M
|
|
@@ -198,7 +198,7 @@ parse_members = function(T, r, a, b, parent, class_name)
|
|
|
198
198
|
local target = x
|
|
199
199
|
if T:text(x) == 'global' and is(T, x + 1, '::') then x = x + 2 end
|
|
200
200
|
local path = dotted(T, x)
|
|
201
|
-
if path ~= '' or global then r.imports[#r.imports + 1] = { path = path, line = T:line(i), global = global or nil } end
|
|
201
|
+
if path ~= '' or global then r.imports[#r.imports + 1] = { path = path, alias = alias, line = T:line(i), global = global or nil } end
|
|
202
202
|
if r.ordinary_bindings and (not parent or r.nodes[parent].kind == 'namespace') then
|
|
203
203
|
local owner = parent and r.nodes[parent]
|
|
204
204
|
r.csharp_usings = r.csharp_usings or {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
-- lang/js.lua — index-level JavaScript / TypeScript parser: functions,
|
|
1
|
+
-- lang/js.lua — index-level JavaScript / TypeScript / ArkTS parser: functions,
|
|
2
2
|
-- arrow functions bound to names, classes (+ members: methods, accessors,
|
|
3
3
|
-- fields, constructors), TS interfaces, type aliases, enums, namespaces,
|
|
4
4
|
-- `a.b = function` assignments, module-level constants, ES imports /
|
|
@@ -159,8 +159,43 @@ end
|
|
|
159
159
|
|
|
160
160
|
local parse_class_body
|
|
161
161
|
|
|
162
|
+
-- Decorator names are bounded: adjacent identifiers belong to the member.
|
|
163
|
+
local function skip_decorator(T, i, defs)
|
|
164
|
+
local x = i + 1
|
|
165
|
+
if T.k[x] ~= 'id' then return x end
|
|
166
|
+
defs[x] = true
|
|
167
|
+
x = x + 1
|
|
168
|
+
while is(T, x, '.') and T.k[x + 1] == 'id' do
|
|
169
|
+
defs[x + 1] = true
|
|
170
|
+
x = x + 2
|
|
171
|
+
end
|
|
172
|
+
if is(T, x, '(') and T.m[x] then x = T.m[x] + 1 end
|
|
173
|
+
return x
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
-- One linear pass distinguishes object methods from ArkUI child blocks.
|
|
177
|
+
-- Keep only candidate tokens, transiently; backward scans at every comma
|
|
178
|
+
-- would make long argument lists and array literals quadratic.
|
|
179
|
+
local function arkts_context(T, defs)
|
|
180
|
+
local members, stack, objects = {}, {}, {}
|
|
181
|
+
for i = 1, T.n do
|
|
182
|
+
if is(T, i, '@') then skip_decorator(T, i, defs) end
|
|
183
|
+
if is(T, i, '{') then
|
|
184
|
+
local prev = T:text(i - 1)
|
|
185
|
+
stack[#stack + 1] = i
|
|
186
|
+
objects[i] = prev == '=' or prev == '(' or prev == '[' or prev == ',' or prev == ':' or prev == 'return'
|
|
187
|
+
elseif is(T, i, '}') then
|
|
188
|
+
stack[#stack] = nil
|
|
189
|
+
elseif T.k[i] == 'id' and (is(T, i + 1, '(') or is(T, i + 1, '<'))
|
|
190
|
+
and objects[stack[#stack]] then
|
|
191
|
+
members[i] = true
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
return members
|
|
195
|
+
end
|
|
196
|
+
|
|
162
197
|
-- Scan [a, b] for definitions; `parent` is the enclosing node (if any).
|
|
163
|
-
local function scan(T, r, a, b, parent, defs,
|
|
198
|
+
local function scan(T, r, a, b, parent, defs, members)
|
|
164
199
|
local i = a
|
|
165
200
|
while i <= b do
|
|
166
201
|
local k, t = T.k[i], T:text(i)
|
|
@@ -180,14 +215,15 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
180
215
|
defs[name_tok] = true
|
|
181
216
|
local node = common.add_node(r, T, { kind = 'function', name = T:text(name_tok), ni = name_tok, parent = parent,
|
|
182
217
|
ti = start, tj = close, sig = common.sig(T, start, body and body - 1 or T.m[p], 200) })
|
|
183
|
-
if body then scan(T, r, body + 1, close - 1, node, defs,
|
|
218
|
+
if body then scan(T, r, body + 1, close - 1, node, defs, members) end
|
|
184
219
|
i = close + 1
|
|
185
220
|
handled = true
|
|
186
221
|
end
|
|
187
222
|
end
|
|
188
223
|
elseif (k == 'kw' and t == 'class' and (T.k[i + 1] == 'id' or kw(T, i + 1, 'extends') or is(T, i + 1, '{'))
|
|
189
224
|
and not is(T, i - 1, '.') and not is(T, i - 1, '<')) -- not JSX `class="..."`
|
|
190
|
-
or ((t == 'interface'
|
|
225
|
+
or ((t == 'interface' or (r.language == 'arkts' and t == 'struct'))
|
|
226
|
+
and k == 'id' and T.k[i + 1] == 'id' and not is(T, i - 1, '.')) then
|
|
191
227
|
local name_tok = T.k[i + 1] == 'id' and i + 1 or nil
|
|
192
228
|
if name_tok and T:text(name_tok) == 'extends' then name_tok = nil end
|
|
193
229
|
local x = i + 1
|
|
@@ -211,7 +247,8 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
211
247
|
mode[#mode + 1] = nm
|
|
212
248
|
end
|
|
213
249
|
end
|
|
214
|
-
|
|
250
|
+
-- Components share class member/receiver/call resolution.
|
|
251
|
+
local kind = t == 'interface' and 'interface' or 'class'
|
|
215
252
|
local node = common.add_node(r, T, {
|
|
216
253
|
kind = kind, name = name_tok and T:text(name_tok) or (is(T, i - 1, '=') and T:text(i - 2)) or 'default',
|
|
217
254
|
ni = name_tok or i,
|
|
@@ -219,7 +256,7 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
219
256
|
extends = #extends > 0 and extends or nil, implements = #implements > 0 and implements or nil,
|
|
220
257
|
})
|
|
221
258
|
if name_tok then defs[name_tok] = true end
|
|
222
|
-
parse_class_body(T, r, x, T.m[x], node, defs,
|
|
259
|
+
parse_class_body(T, r, x, T.m[x], node, defs, members)
|
|
223
260
|
i = T.m[x] + 1
|
|
224
261
|
handled = true
|
|
225
262
|
end
|
|
@@ -254,7 +291,7 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
254
291
|
if is(T, x, '{') and T.m[x] then
|
|
255
292
|
local nm = common.sig(T, i + 1, x - 1):gsub('%s', ''):gsub('^["\']', ''):gsub('["\']$', '')
|
|
256
293
|
local node = common.add_node(r, T, { kind = 'namespace', name = nm, ni = i + 1, nj = x - 1, parent = parent, ti = i, tj = T.m[x] })
|
|
257
|
-
scan(T, r, x + 1, T.m[x] - 1, node, defs,
|
|
294
|
+
scan(T, r, x + 1, T.m[x] - 1, node, defs, members)
|
|
258
295
|
i = T.m[x] + 1
|
|
259
296
|
handled = true
|
|
260
297
|
end
|
|
@@ -275,7 +312,7 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
275
312
|
defs[name_tok] = true
|
|
276
313
|
local node = common.add_node(r, T, { kind = 'function', name = T:text(name_tok), ni = name_tok, parent = parent,
|
|
277
314
|
ti = start, tj = fe, sig = common.sig(T, start, math.max(fb - 1, name_tok), 200) })
|
|
278
|
-
if fb and is(T, fb, '{') then scan(T, r, fb + 1, fe - 1, node, defs,
|
|
315
|
+
if fb and is(T, fb, '{') then scan(T, r, fb + 1, fe - 1, node, defs, members) end
|
|
279
316
|
i = fe + 1
|
|
280
317
|
handled = true
|
|
281
318
|
elseif not parent then
|
|
@@ -293,13 +330,14 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
293
330
|
defs[i] = true
|
|
294
331
|
local node = common.add_node(r, T, { kind = 'function', name = t, parent = parent,
|
|
295
332
|
ti = i, tj = fe, sig = common.sig(T, i, math.max(fb - 1, i), 200) })
|
|
296
|
-
if is(T, fb, '{') then scan(T, r, fb + 1, fe - 1, node, defs,
|
|
333
|
+
if is(T, fb, '{') then scan(T, r, fb + 1, fe - 1, node, defs, members) end
|
|
297
334
|
i = fe + 1
|
|
298
335
|
handled = true
|
|
299
336
|
elseif k == 'id' and not defs[i] and (is(T, i + 1, '(') or is(T, i + 1, '<'))
|
|
300
337
|
and (is(T, i - 1, '{') or is(T, i - 1, ',')
|
|
301
338
|
or ((word(T, i - 1, 'async') or word(T, i - 1, 'get') or word(T, i - 1, 'set') or is(T, i - 1, '*'))
|
|
302
339
|
and (is(T, i - 2, '{') or is(T, i - 2, ','))))
|
|
340
|
+
and (not members or members[i])
|
|
303
341
|
and (function()
|
|
304
342
|
local p = skip_angle(T, i + 1, b)
|
|
305
343
|
if not (is(T, p, '(') and T.m[p]) then return false end
|
|
@@ -313,7 +351,7 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
313
351
|
defs[i] = true
|
|
314
352
|
local node = common.add_node(r, T, { kind = 'method', name = t, parent = parent,
|
|
315
353
|
ti = i, tj = close, sig = common.sig(T, i, body - 1, 200) })
|
|
316
|
-
scan(T, r, body + 1, close - 1, node, defs,
|
|
354
|
+
scan(T, r, body + 1, close - 1, node, defs, members)
|
|
317
355
|
i = close + 1
|
|
318
356
|
handled = true
|
|
319
357
|
elseif k == 'id' and is(T, i + 1, '=') and is(T, i - 1, '.') and not defs[i] then
|
|
@@ -329,7 +367,7 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
329
367
|
local node = common.add_node(r, T, { kind = 'function', name = T:text(i), ni = i, parent = parent,
|
|
330
368
|
ti = y, tj = fe, sig = common.sig(T, y, math.max(fb - 1, i), 200) })
|
|
331
369
|
r.nodes[node].qualified = table.concat(parts, '.')
|
|
332
|
-
if fb and is(T, fb, '{') then scan(T, r, fb + 1, fe - 1, node, defs,
|
|
370
|
+
if fb and is(T, fb, '{') then scan(T, r, fb + 1, fe - 1, node, defs, members) end
|
|
333
371
|
i = fe + 1
|
|
334
372
|
handled = true
|
|
335
373
|
end
|
|
@@ -359,16 +397,14 @@ local function scan(T, r, a, b, parent, defs, stem)
|
|
|
359
397
|
end
|
|
360
398
|
|
|
361
399
|
-- Members of a class / interface body between '{' o and '}' c.
|
|
362
|
-
parse_class_body = function(T, r, o, c, parent, defs,
|
|
400
|
+
parse_class_body = function(T, r, o, c, parent, defs, members)
|
|
363
401
|
local x = o + 1
|
|
364
402
|
while x < c do
|
|
365
403
|
if is(T, x, ';') or is(T, x, ',') then
|
|
366
404
|
x = x + 1
|
|
367
405
|
elseif is(T, x, '@') then
|
|
368
406
|
-- decorator: @name, @a.b, @name(...)
|
|
369
|
-
x = x
|
|
370
|
-
while T.k[x] == 'id' or is(T, x, '.') do x = x + 1 end
|
|
371
|
-
if is(T, x, '(') and T.m[x] then x = T.m[x] + 1 end
|
|
407
|
+
x = skip_decorator(T, x, defs)
|
|
372
408
|
else
|
|
373
409
|
local start = x
|
|
374
410
|
-- a modifier word is only a modifier when another member name follows
|
|
@@ -413,7 +449,7 @@ parse_class_body = function(T, r, o, c, parent, defs, stem)
|
|
|
413
449
|
local node = common.add_node(r, T, { kind = kind, name = name, ni = name_tok, parent = parent,
|
|
414
450
|
ti = start, tj = close, sig = common.sig(T, start, body and body - 1 or T.m[y], 200),
|
|
415
451
|
abstract = (not body) or nil })
|
|
416
|
-
if body then scan(T, r, body + 1, close - 1, node, defs,
|
|
452
|
+
if body then scan(T, r, body + 1, close - 1, node, defs, members) end
|
|
417
453
|
end
|
|
418
454
|
x = close + 1
|
|
419
455
|
else
|
|
@@ -434,12 +470,12 @@ parse_class_body = function(T, r, o, c, parent, defs, stem)
|
|
|
434
470
|
if fs then
|
|
435
471
|
local node = common.add_node(r, T, { kind = 'method', name = name, ni = name_tok, parent = parent,
|
|
436
472
|
ti = start, tj = fe, sig = common.sig(T, start, math.max(fb - 1, name_tok), 200) })
|
|
437
|
-
if is(T, fb, '{') then scan(T, r, fb + 1, fe - 1, node, defs,
|
|
473
|
+
if is(T, fb, '{') then scan(T, r, fb + 1, fe - 1, node, defs, members) end
|
|
438
474
|
stop = math.max(stop, fe)
|
|
439
475
|
else
|
|
440
476
|
common.add_node(r, T, { kind = 'field', name = name, ni = name_tok, parent = parent,
|
|
441
477
|
ti = start, tj = stop, sig = common.sig(T, start, stop, 120) })
|
|
442
|
-
if eq then scan(T, r, eq + 1, stop, parent, defs,
|
|
478
|
+
if eq then scan(T, r, eq + 1, stop, parent, defs, members) end
|
|
443
479
|
end
|
|
444
480
|
end
|
|
445
481
|
x = stop + 1
|
|
@@ -453,8 +489,8 @@ function M.parse(path, src, language, opts)
|
|
|
453
489
|
local T = M.lang:tokenize(src)
|
|
454
490
|
local r = common.new(path, language or 'javascript', opts)
|
|
455
491
|
local defs = {}
|
|
456
|
-
local
|
|
457
|
-
scan(T, r, 1, T.n, nil, defs,
|
|
492
|
+
local members = r.language == 'arkts' and arkts_context(T, defs) or nil
|
|
493
|
+
scan(T, r, 1, T.n, nil, defs, members)
|
|
458
494
|
common.add_calls(r, T, 1, T.n)
|
|
459
495
|
local kept = {}
|
|
460
496
|
for _, ref in ipairs(r.refs) do
|