gitnexus 1.6.10-rc.76 → 1.6.10-rc.77
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.
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
const REF_PREFIX_RE = /^&\s*(mut\s+)?/;
|
|
2
2
|
const PTR_PREFIX_RE = /^\*\s*(const|mut)?\s*/;
|
|
3
|
+
const DYN_PREFIX_RE = /^dyn\s+/;
|
|
3
4
|
const ENUM_VARIANT_NAMES = new Set(['Some', 'None', 'Ok', 'Err']);
|
|
5
|
+
// `dyn Trait`, `&dyn Trait`, `Box<dyn Trait>` all name a trait object whose
|
|
6
|
+
// receiver-dispatch target is the trait itself (#2604) — strip the `dyn`
|
|
7
|
+
// keyword and any auto-trait/lifetime bound list (`dyn Trait + Send`) down to
|
|
8
|
+
// the principal trait name. Reference/pointer sigils are stripped by the
|
|
9
|
+
// caller first; wrapper unwrapping (Box<T> etc.) runs before this so the
|
|
10
|
+
// unwrapped inner text still gets the same treatment.
|
|
11
|
+
function stripDynBound(t) {
|
|
12
|
+
if (!DYN_PREFIX_RE.test(t))
|
|
13
|
+
return t;
|
|
14
|
+
t = t.replace(DYN_PREFIX_RE, '');
|
|
15
|
+
const plus = t.indexOf('+');
|
|
16
|
+
if (plus !== -1)
|
|
17
|
+
t = t.slice(0, plus);
|
|
18
|
+
return t.trim();
|
|
19
|
+
}
|
|
4
20
|
// ─── interpretImport ──────────────────────────────────────────────────────
|
|
5
21
|
export function interpretRustImport(captures) {
|
|
6
22
|
const kind = captures['@import.kind']?.text;
|
|
@@ -104,6 +120,7 @@ export function normalizeRustTypeName(text) {
|
|
|
104
120
|
if (inner !== null)
|
|
105
121
|
t = inner;
|
|
106
122
|
}
|
|
123
|
+
t = stripDynBound(t);
|
|
107
124
|
const bracket = t.indexOf('<');
|
|
108
125
|
if (bracket !== -1)
|
|
109
126
|
t = t.slice(0, bracket);
|
|
@@ -168,6 +185,7 @@ function normalizeRustReturnType(text) {
|
|
|
168
185
|
}
|
|
169
186
|
}
|
|
170
187
|
}
|
|
188
|
+
t = stripDynBound(t);
|
|
171
189
|
const bracket = t.indexOf('<');
|
|
172
190
|
if (bracket !== -1)
|
|
173
191
|
t = t.slice(0, bracket);
|
|
@@ -9,6 +9,7 @@ const RUST_SCOPE_QUERY = `
|
|
|
9
9
|
(enum_item) @scope.class
|
|
10
10
|
(union_item) @scope.class
|
|
11
11
|
(function_item) @scope.function
|
|
12
|
+
(function_signature_item) @scope.function
|
|
12
13
|
(closure_expression) @scope.function
|
|
13
14
|
(block) @scope.block
|
|
14
15
|
(if_expression) @scope.block
|
|
@@ -54,6 +55,14 @@ const RUST_SCOPE_QUERY = `
|
|
|
54
55
|
(function_item
|
|
55
56
|
name: (identifier) @declaration.name) @declaration.function
|
|
56
57
|
|
|
58
|
+
;; Declarations — trait method signature (required method, no body,
|
|
59
|
+
;; e.g. fn foo(self) -> T; inside a trait body). Without this, an abstract
|
|
60
|
+
;; trait method is invisible to scope resolution — never owned by its
|
|
61
|
+
;; trait's Class scope, so a dyn Trait receiver can never dispatch to
|
|
62
|
+
;; it (#2604).
|
|
63
|
+
(function_signature_item
|
|
64
|
+
name: (identifier) @declaration.name) @declaration.function
|
|
65
|
+
|
|
57
66
|
;; Declarations — struct fields
|
|
58
67
|
(field_declaration
|
|
59
68
|
name: (field_identifier) @declaration.name
|
|
@@ -411,8 +411,15 @@ export interface RepoMeta {
|
|
|
411
411
|
* `Record` node and its `HAS_METHOD` edges for every unchanged record file
|
|
412
412
|
* (same v7 contract: new nodes/edges the incremental path would otherwise
|
|
413
413
|
* never backfill); force a full re-analyze instead.
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
* v11: Rust abstract trait methods (`fn foo(&self) -> T;`, no body) now get a
|
|
415
|
+
* scope + declaration capture (#2604): RUST_SCOPE_QUERY had no
|
|
416
|
+
* `function_signature_item` pattern, so a `&dyn Trait` receiver could never
|
|
417
|
+
* dispatch a CALLS edge to the trait's own method. Same v7/v10 contract: the
|
|
418
|
+
* incremental write set only covers changed files, so a top-up against a
|
|
419
|
+
* pre-v11 index would keep silently missing these CALLS edges for every
|
|
420
|
+
* unchanged Rust trait file; force a full re-analyze instead.
|
|
421
|
+
*/
|
|
422
|
+
export declare const INCREMENTAL_SCHEMA_VERSION = 11;
|
|
416
423
|
export interface IndexedRepo {
|
|
417
424
|
repoPath: string;
|
|
418
425
|
storagePath: string;
|
|
@@ -132,8 +132,15 @@ export const cloneDirBelongsToEntry = (cloneDir, entryPath) => registryPathEqual
|
|
|
132
132
|
* `Record` node and its `HAS_METHOD` edges for every unchanged record file
|
|
133
133
|
* (same v7 contract: new nodes/edges the incremental path would otherwise
|
|
134
134
|
* never backfill); force a full re-analyze instead.
|
|
135
|
+
* v11: Rust abstract trait methods (`fn foo(&self) -> T;`, no body) now get a
|
|
136
|
+
* scope + declaration capture (#2604): RUST_SCOPE_QUERY had no
|
|
137
|
+
* `function_signature_item` pattern, so a `&dyn Trait` receiver could never
|
|
138
|
+
* dispatch a CALLS edge to the trait's own method. Same v7/v10 contract: the
|
|
139
|
+
* incremental write set only covers changed files, so a top-up against a
|
|
140
|
+
* pre-v11 index would keep silently missing these CALLS edges for every
|
|
141
|
+
* unchanged Rust trait file; force a full re-analyze instead.
|
|
135
142
|
*/
|
|
136
|
-
export const INCREMENTAL_SCHEMA_VERSION =
|
|
143
|
+
export const INCREMENTAL_SCHEMA_VERSION = 11;
|
|
137
144
|
const GITNEXUS_DIR = '.gitnexus';
|
|
138
145
|
const GITNEXUS_EXCLUDE_ENTRY = `${GITNEXUS_DIR}/`;
|
|
139
146
|
export const INDEX_METADATA_FILE = 'gitnexus.json';
|
package/package.json
CHANGED