clast-ai 0.1.2 → 0.2.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/.claude-plugin/marketplace.json +14 -0
- package/.claude-plugin/plugin.json +11 -9
- package/README.md +447 -401
- package/bench/ab/onair-concept.json +22 -0
- package/bench/ab/onair-deadcode.json +7 -0
- package/bench/ab/onair-hard.json +32 -0
- package/bench/ab/onair-impact.json +17 -0
- package/bench/ab/onair-refactors.json +18 -0
- package/bench/ab/onair-survey.json +17 -0
- package/bench/ab/onair-tasks.json +20 -0
- package/bench/ab/onair.json +52 -0
- package/bench/ab/vscode-concept.json +22 -0
- package/bench/ab/vscode-hard.json +32 -0
- package/bench/ab/vscode-impact.json +17 -0
- package/bench/ab/vscode-refactors.json +18 -0
- package/bench/ab/vscode-tasks.json +20 -0
- package/bench/ab/vscode.json +52 -0
- package/bench/ab.mjs +213 -0
- package/bench/bench.mjs +98 -0
- package/bench/resolution.mjs +75 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +257 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/defaults.d.ts +12 -2
- package/dist/config/defaults.js +38 -31
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +26 -14
- package/dist/config/index.js.map +1 -1
- package/dist/db/index.d.ts +73 -13
- package/dist/db/index.js +481 -39
- package/dist/db/index.js.map +1 -1
- package/dist/engine.d.ts +15 -0
- package/dist/engine.js +28 -0
- package/dist/engine.js.map +1 -0
- package/dist/indexer/imports.d.ts +6 -0
- package/dist/indexer/imports.js +254 -0
- package/dist/indexer/imports.js.map +1 -0
- package/dist/indexer/index.d.ts +63 -0
- package/dist/indexer/index.js +360 -0
- package/dist/indexer/index.js.map +1 -0
- package/dist/indexer/process.d.ts +22 -0
- package/dist/indexer/process.js +42 -0
- package/dist/indexer/process.js.map +1 -0
- package/dist/indexer/scan.d.ts +43 -0
- package/dist/indexer/scan.js +223 -0
- package/dist/indexer/scan.js.map +1 -0
- package/dist/indexer/worker.d.ts +1 -0
- package/dist/indexer/worker.js +23 -0
- package/dist/indexer/worker.js.map +1 -0
- package/dist/llm/comment-generator.d.ts +17 -19
- package/dist/llm/comment-generator.js +46 -80
- package/dist/llm/comment-generator.js.map +1 -1
- package/dist/llm/index.d.ts +0 -1
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/prompts.d.ts +0 -1
- package/dist/llm/prompts.js +16 -16
- package/dist/parser/extractor.d.ts +21 -16
- package/dist/parser/extractor.js +700 -228
- package/dist/parser/extractor.js.map +1 -1
- package/dist/parser/index.d.ts +17 -21
- package/dist/parser/index.js +115 -171
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/langs/c.d.ts +3 -0
- package/dist/parser/langs/c.js +879 -0
- package/dist/parser/langs/c.js.map +1 -0
- package/dist/parser/langs/csharp.d.ts +2 -0
- package/dist/parser/langs/csharp.js +548 -0
- package/dist/parser/langs/csharp.js.map +1 -0
- package/dist/parser/langs/dart.d.ts +2 -0
- package/dist/parser/langs/dart.js +893 -0
- package/dist/parser/langs/dart.js.map +1 -0
- package/dist/parser/langs/go.d.ts +2 -0
- package/dist/parser/langs/go.js +455 -0
- package/dist/parser/langs/go.js.map +1 -0
- package/dist/parser/langs/java.d.ts +2 -0
- package/dist/parser/langs/java.js +390 -0
- package/dist/parser/langs/java.js.map +1 -0
- package/dist/parser/langs/php.d.ts +2 -0
- package/dist/parser/langs/php.js +486 -0
- package/dist/parser/langs/php.js.map +1 -0
- package/dist/parser/langs/python.d.ts +2 -0
- package/dist/parser/langs/python.js +216 -0
- package/dist/parser/langs/python.js.map +1 -0
- package/dist/parser/langs/ruby.d.ts +2 -0
- package/dist/parser/langs/ruby.js +602 -0
- package/dist/parser/langs/ruby.js.map +1 -0
- package/dist/parser/langs/rust.d.ts +2 -0
- package/dist/parser/langs/rust.js +931 -0
- package/dist/parser/langs/rust.js.map +1 -0
- package/dist/parser/langs/swift.d.ts +2 -0
- package/dist/parser/langs/swift.js +616 -0
- package/dist/parser/langs/swift.js.map +1 -0
- package/dist/parser/langs/typescript.d.ts +4 -0
- package/dist/parser/langs/typescript.js +535 -0
- package/dist/parser/langs/typescript.js.map +1 -0
- package/dist/parser/registry.d.ts +16 -0
- package/dist/parser/registry.js +87 -0
- package/dist/parser/registry.js.map +1 -0
- package/dist/parser/returns.d.ts +9 -0
- package/dist/parser/returns.js +152 -0
- package/dist/parser/returns.js.map +1 -0
- package/dist/parser/spec.d.ts +165 -0
- package/dist/parser/spec.js +188 -0
- package/dist/parser/spec.js.map +1 -0
- package/dist/query/arity.d.ts +27 -0
- package/dist/query/arity.js +187 -0
- package/dist/query/arity.js.map +1 -0
- package/dist/query/callgraph.d.ts +113 -0
- package/dist/query/callgraph.js +332 -0
- package/dist/query/callgraph.js.map +1 -0
- package/dist/query/format.d.ts +36 -0
- package/dist/query/format.js +136 -0
- package/dist/query/format.js.map +1 -0
- package/dist/query/hierarchy.d.ts +44 -0
- package/dist/query/hierarchy.js +441 -0
- package/dist/query/hierarchy.js.map +1 -0
- package/dist/query/resolve.d.ts +265 -0
- package/dist/query/resolve.js +1957 -0
- package/dist/query/resolve.js.map +1 -0
- package/dist/query/search.d.ts +35 -0
- package/dist/query/search.js +379 -0
- package/dist/query/search.js.map +1 -0
- package/dist/query/words.d.ts +30 -0
- package/dist/query/words.js +201 -0
- package/dist/query/words.js.map +1 -0
- package/dist/server/index.d.ts +1 -3
- package/dist/server/index.js +313 -73
- package/dist/server/index.js.map +1 -1
- package/dist/tools/context.d.ts +35 -0
- package/dist/tools/context.js +79 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/explore.d.ts +51 -0
- package/dist/tools/explore.js +779 -0
- package/dist/tools/explore.js.map +1 -0
- package/dist/tools/impact.d.ts +21 -0
- package/dist/tools/impact.js +743 -0
- package/dist/tools/impact.js.map +1 -0
- package/dist/tools/search.d.ts +59 -0
- package/dist/tools/search.js +843 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/stats.d.ts +26 -0
- package/dist/tools/stats.js +604 -0
- package/dist/tools/stats.js.map +1 -0
- package/dist/types.d.ts +95 -40
- package/dist/types.js +9 -1
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/watcher/index.d.ts +18 -16
- package/dist/watcher/index.js +94 -77
- package/dist/watcher/index.js.map +1 -1
- package/package.json +21 -24
- package/plugin/server.mjs +50 -0
- package/skills/audit/SKILL.md +37 -0
- package/skills/deadcode/SKILL.md +33 -0
- package/skills/explore/SKILL.md +54 -0
- package/skills/impact/SKILL.md +24 -0
- package/skills/status/SKILL.md +11 -0
- package/src/cli.ts +256 -0
- package/src/config/defaults.ts +50 -32
- package/src/config/index.ts +23 -14
- package/src/db/index.ts +540 -43
- package/src/engine.ts +30 -0
- package/src/indexer/imports.ts +241 -0
- package/src/indexer/index.ts +369 -0
- package/src/indexer/process.ts +63 -0
- package/src/indexer/scan.ts +226 -0
- package/src/indexer/worker.ts +24 -0
- package/src/llm/comment-generator.ts +52 -103
- package/src/llm/index.ts +80 -80
- package/src/llm/prompts.ts +95 -95
- package/src/parser/extractor.ts +643 -256
- package/src/parser/index.ts +105 -205
- package/src/parser/langs/c.ts +860 -0
- package/src/parser/langs/csharp.ts +519 -0
- package/src/parser/langs/dart.ts +820 -0
- package/src/parser/langs/go.ts +437 -0
- package/src/parser/langs/java.ts +361 -0
- package/src/parser/langs/php.ts +450 -0
- package/src/parser/langs/python.ts +206 -0
- package/src/parser/langs/ruby.ts +554 -0
- package/src/parser/langs/rust.ts +904 -0
- package/src/parser/langs/swift.ts +590 -0
- package/src/parser/langs/typescript.ts +499 -0
- package/src/parser/registry.ts +88 -0
- package/src/parser/returns.ts +137 -0
- package/src/parser/spec.ts +309 -0
- package/src/query/arity.ts +173 -0
- package/src/query/callgraph.ts +473 -0
- package/src/query/format.ts +136 -0
- package/src/query/hierarchy.ts +447 -0
- package/src/query/resolve.ts +1972 -0
- package/src/query/search.ts +430 -0
- package/src/query/words.ts +183 -0
- package/src/server/index.ts +390 -79
- package/src/tools/context.ts +82 -0
- package/src/tools/explore.ts +860 -0
- package/src/tools/impact.ts +748 -0
- package/src/tools/search.ts +886 -0
- package/src/tools/stats.ts +633 -0
- package/src/types.ts +113 -45
- package/src/version.ts +2 -0
- package/src/watcher/index.ts +82 -88
- package/tsconfig.json +7 -4
- package/.mcp.json +0 -8
- package/commands/clast-status.md +0 -9
- package/dist/config/defaults.d.ts.map +0 -1
- package/dist/config/index.d.ts.map +0 -1
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/queries.d.ts +0 -44
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js +0 -251
- package/dist/db/queries.js.map +0 -1
- package/dist/db/schema.d.ts +0 -3
- package/dist/db/schema.d.ts.map +0 -1
- package/dist/db/schema.js +0 -94
- package/dist/db/schema.js.map +0 -1
- package/dist/db/types.d.ts +0 -44
- package/dist/db/types.d.ts.map +0 -1
- package/dist/db/types.js +0 -2
- package/dist/db/types.js.map +0 -1
- package/dist/llm/comment-generator.d.ts.map +0 -1
- package/dist/llm/index.d.ts.map +0 -1
- package/dist/llm/prompts.d.ts.map +0 -1
- package/dist/parser/call-resolver.d.ts +0 -15
- package/dist/parser/call-resolver.d.ts.map +0 -1
- package/dist/parser/call-resolver.js +0 -16
- package/dist/parser/call-resolver.js.map +0 -1
- package/dist/parser/extractor.d.ts.map +0 -1
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/languages.d.ts +0 -11
- package/dist/parser/languages.d.ts.map +0 -1
- package/dist/parser/languages.js +0 -74
- package/dist/parser/languages.js.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/register-tools.d.ts +0 -7
- package/dist/server/register-tools.d.ts.map +0 -1
- package/dist/server/register-tools.js +0 -17
- package/dist/server/register-tools.js.map +0 -1
- package/dist/server/tools/clast-call-graph.d.ts +0 -4
- package/dist/server/tools/clast-call-graph.d.ts.map +0 -1
- package/dist/server/tools/clast-call-graph.js +0 -70
- package/dist/server/tools/clast-call-graph.js.map +0 -1
- package/dist/server/tools/clast-comment.d.ts +0 -5
- package/dist/server/tools/clast-comment.d.ts.map +0 -1
- package/dist/server/tools/clast-comment.js +0 -64
- package/dist/server/tools/clast-comment.js.map +0 -1
- package/dist/server/tools/clast-file-summary.d.ts +0 -4
- package/dist/server/tools/clast-file-summary.d.ts.map +0 -1
- package/dist/server/tools/clast-file-summary.js +0 -42
- package/dist/server/tools/clast-file-summary.js.map +0 -1
- package/dist/server/tools/clast-get-context.d.ts +0 -4
- package/dist/server/tools/clast-get-context.d.ts.map +0 -1
- package/dist/server/tools/clast-get-context.js +0 -80
- package/dist/server/tools/clast-get-context.js.map +0 -1
- package/dist/server/tools/clast-reindex.d.ts +0 -5
- package/dist/server/tools/clast-reindex.d.ts.map +0 -1
- package/dist/server/tools/clast-reindex.js +0 -36
- package/dist/server/tools/clast-reindex.js.map +0 -1
- package/dist/server/tools/clast-search.d.ts +0 -4
- package/dist/server/tools/clast-search.d.ts.map +0 -1
- package/dist/server/tools/clast-search.js +0 -29
- package/dist/server/tools/clast-search.js.map +0 -1
- package/dist/server/tools/clast-status.d.ts +0 -5
- package/dist/server/tools/clast-status.d.ts.map +0 -1
- package/dist/server/tools/clast-status.js +0 -23
- package/dist/server/tools/clast-status.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/watcher/gitignore.d.ts +0 -9
- package/dist/watcher/gitignore.d.ts.map +0 -1
- package/dist/watcher/gitignore.js +0 -38
- package/dist/watcher/gitignore.js.map +0 -1
- package/dist/watcher/index.d.ts.map +0 -1
- package/skills/clast-explore/SKILL.md +0 -41
- package/src/db/queries.ts +0 -332
- package/src/db/schema.ts +0 -106
- package/src/db/types.ts +0 -47
- package/src/parser/call-resolver.ts +0 -17
- package/src/parser/languages.ts +0 -86
- package/src/server/register-tools.ts +0 -30
- package/src/server/tools/clast-call-graph.ts +0 -82
- package/src/server/tools/clast-comment.ts +0 -76
- package/src/server/tools/clast-file-summary.ts +0 -59
- package/src/server/tools/clast-get-context.ts +0 -97
- package/src/server/tools/clast-reindex.ts +0 -52
- package/src/server/tools/clast-search.ts +0 -38
- package/src/server/tools/clast-status.ts +0 -37
- package/src/watcher/gitignore.ts +0 -42
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import type { ClastDb } from '../db/index.js';
|
|
2
|
+
import { type SymbolKind, type SymbolRow } from '../types.js';
|
|
3
|
+
export declare function langFamily(lang: string): string;
|
|
4
|
+
export declare const KIND_WEIGHT: Record<SymbolKind, number>;
|
|
5
|
+
export interface SymbolRef {
|
|
6
|
+
name: string;
|
|
7
|
+
/** Container segments before the name (`Foo.Bar.baz` -> [Foo, Bar]). */
|
|
8
|
+
container: string[];
|
|
9
|
+
path?: string;
|
|
10
|
+
line?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse the ways an agent may refer to a symbol:
|
|
14
|
+
* `name`, `Class.method`, `Class::method`, `Class#method`,
|
|
15
|
+
* `path/file.ts:name`, `path/file.ts:123` (symbol at line).
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseSymbolRef(ref: string): SymbolRef;
|
|
18
|
+
export declare function pathMatches(path: string, filter: string): boolean;
|
|
19
|
+
/** Static desirability of a symbol as "the" definition of its name. */
|
|
20
|
+
export declare function definitionScore(s: SymbolRow): number;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a symbol reference to definitions, best first. Falls back to
|
|
23
|
+
* case-insensitive matching when nothing matches exactly.
|
|
24
|
+
*/
|
|
25
|
+
export declare function findSymbols(db: ClastDb, ref: string | SymbolRef, opts?: {
|
|
26
|
+
path?: string;
|
|
27
|
+
kind?: string;
|
|
28
|
+
exact?: boolean;
|
|
29
|
+
}): SymbolRow[];
|
|
30
|
+
/** Drop overloads / re-declarations of `chosen` (same qualified name in the same file). */
|
|
31
|
+
export declare function otherDefinitions(chosen: SymbolRow, all: SymbolRow[], family?: Set<number>): {
|
|
32
|
+
others: SymbolRow[];
|
|
33
|
+
overloads: number;
|
|
34
|
+
};
|
|
35
|
+
/** Names of all supertypes (transitive, bounded) of the containers called `name`. */
|
|
36
|
+
export declare function ancestorNames(db: ClastDb, name: string): Set<string>;
|
|
37
|
+
export interface FileHit {
|
|
38
|
+
id: number;
|
|
39
|
+
path: string;
|
|
40
|
+
lang: string;
|
|
41
|
+
line_count: number;
|
|
42
|
+
symbol_count: number;
|
|
43
|
+
}
|
|
44
|
+
/** Resolve a (possibly partial) file path: exact, suffix, then substring. */
|
|
45
|
+
export declare function findFiles(db: ClastDb, query: string, limit?: number): FileHit[];
|
|
46
|
+
export interface CallSite {
|
|
47
|
+
fileId: number;
|
|
48
|
+
path: string;
|
|
49
|
+
lang: string;
|
|
50
|
+
/** Receiver text, COMPLEX ('?') for expression receivers, null for bare calls. */
|
|
51
|
+
receiver: string | null;
|
|
52
|
+
/** Declared type of the receiver, when the extractor could determine it. */
|
|
53
|
+
rtype?: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Row id of the call that produces this call's receiver (`a.b().c()`:
|
|
56
|
+
* for c, the call to b). The receiver type is then b's return type.
|
|
57
|
+
*/
|
|
58
|
+
via?: number | null;
|
|
59
|
+
/** Symbol the call is made from, if known. */
|
|
60
|
+
caller?: SymbolRow | null;
|
|
61
|
+
/** Go: directory of the package the receiver type is qualified with (set by the resolver). */
|
|
62
|
+
rtypeDir?: string;
|
|
63
|
+
/** Number of arguments at the call site (-1 / undefined = unknown). */
|
|
64
|
+
argc?: number | null;
|
|
65
|
+
}
|
|
66
|
+
export interface Resolution {
|
|
67
|
+
/** Candidates, best first, with scores. */
|
|
68
|
+
candidates: Array<{
|
|
69
|
+
sym: SymbolRow;
|
|
70
|
+
score: number;
|
|
71
|
+
}>;
|
|
72
|
+
/** True when the best candidate is clearly better than the rest. */
|
|
73
|
+
confident: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** A C / C++ function with internal linkage: visible only in its own translation unit. */
|
|
76
|
+
export declare function isFileLocal(s: SymbolRow): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* C / C++: a prototype and its definition (or two declarations of one function) are one target.
|
|
79
|
+
* Two full definitions in different source files are different functions, as is anything `static`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function cTwins(a: SymbolRow, b: SymbolRow): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Resolves call sites to definitions. Holds per-request caches (imports of a
|
|
84
|
+
* file, candidate definitions of a name, class ancestry); create a new
|
|
85
|
+
* instance whenever the index changes.
|
|
86
|
+
*/
|
|
87
|
+
export declare class Resolver {
|
|
88
|
+
private readonly db;
|
|
89
|
+
private goPackages;
|
|
90
|
+
private goImportCache;
|
|
91
|
+
/** Go: project directory an import path names, or null when it is outside the project. */
|
|
92
|
+
private goPackageDir;
|
|
93
|
+
/** Go: package names a file imports -> project directory (null = external package). */
|
|
94
|
+
private goImports;
|
|
95
|
+
/**
|
|
96
|
+
* Go: a receiver type written `pkg.Type`. Returns the site with the bare type name and
|
|
97
|
+
* the package directory, or null when the package is not part of this project.
|
|
98
|
+
*/
|
|
99
|
+
private goQualified;
|
|
100
|
+
private importCache;
|
|
101
|
+
private importNameCache;
|
|
102
|
+
private candidateCache;
|
|
103
|
+
private ancestorCache;
|
|
104
|
+
private rubyAncestorCache;
|
|
105
|
+
private relatedCache;
|
|
106
|
+
private familyCache;
|
|
107
|
+
private familyCountCache;
|
|
108
|
+
private parentCache;
|
|
109
|
+
private mentionCache;
|
|
110
|
+
private projectTypeCache;
|
|
111
|
+
constructor(db: ClastDb);
|
|
112
|
+
/** File ids imported (directly) by a file. */
|
|
113
|
+
importsOf(fileId: number): Set<number>;
|
|
114
|
+
/**
|
|
115
|
+
* True when the name `type`, as seen from the calling file, is a class defined in that file or in
|
|
116
|
+
* the file it is imported from, and `cand` is a member of a same-named class somewhere else.
|
|
117
|
+
*/
|
|
118
|
+
private otherTypeInScope;
|
|
119
|
+
private arityCache;
|
|
120
|
+
/**
|
|
121
|
+
* Can a call with the site's argument count be a call of `sym`? True when either side is
|
|
122
|
+
* unknown. Tells overloads apart and rejects same-named methods with another shape.
|
|
123
|
+
*/
|
|
124
|
+
arityFits(sym: SymbolRow, site: CallSite): boolean;
|
|
125
|
+
private filePathCache;
|
|
126
|
+
private filePath;
|
|
127
|
+
private instanceTypeCache;
|
|
128
|
+
/**
|
|
129
|
+
* Type of a module-level variable `name` defined in file `fileId`, read from its declaration:
|
|
130
|
+
* `pre_save = ModelSignal(...)`, `export const logger = new Logger()`, `export const x: Foo = ...`.
|
|
131
|
+
*/
|
|
132
|
+
private instanceType;
|
|
133
|
+
/** Go: does the file import the package in directory `dir`? */
|
|
134
|
+
private importsGoDir;
|
|
135
|
+
/** Names a file imports, mapped to the file they come from (null = not in this project). */
|
|
136
|
+
private importedNames;
|
|
137
|
+
private defaultExportCache;
|
|
138
|
+
/** Name of the symbol a file exports as its default / `module.exports`, if any. */
|
|
139
|
+
private defaultExportOf;
|
|
140
|
+
/** Can code in `fileId` plausibly refer to `target`: same file, imports its file, or names its class? */
|
|
141
|
+
canSee(fileId: number, target: SymbolRow): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* A call at `rawSite` was bound to `bound`, a declaration of the same member on a supertype of
|
|
144
|
+
* `target`'s class. Can it run `target`? Not when the receiver is statically a class unrelated to
|
|
145
|
+
* the target's (a sibling subclass), and not for `super.m()`, which names one implementation.
|
|
146
|
+
*/
|
|
147
|
+
reaches(target: SymbolRow, bound: SymbolRow, rawSite: CallSite): boolean;
|
|
148
|
+
private aliasUseCache;
|
|
149
|
+
/**
|
|
150
|
+
* Local names under which other files refer to `sym`: import aliases
|
|
151
|
+
* (`import { X as Y }`) and default-import / require bindings of a file
|
|
152
|
+
* whose default export is `sym`.
|
|
153
|
+
*/
|
|
154
|
+
aliasesOf(sym: SymbolRow): Array<{
|
|
155
|
+
fileId: number;
|
|
156
|
+
alias: string;
|
|
157
|
+
}>;
|
|
158
|
+
candidates(name: string): SymbolRow[];
|
|
159
|
+
private parentOf;
|
|
160
|
+
/** Nearest enclosing class-like symbol of `sym` (lexical), or its container by qualified name. */
|
|
161
|
+
private enclosingContainer;
|
|
162
|
+
private findEnclosingContainer;
|
|
163
|
+
private stdNameCache;
|
|
164
|
+
/** Rust: names a file imports from the standard library (`use std::task::{Context, Wake}`). */
|
|
165
|
+
private stdNames;
|
|
166
|
+
/**
|
|
167
|
+
* A supertype written in file `fileId` that cannot be a project type even though the project
|
|
168
|
+
* defines one of that name: a Go type of an external package (`io.Closer`), a Rust trait the
|
|
169
|
+
* file imports from the standard library (`use std::task::Wake`).
|
|
170
|
+
*/
|
|
171
|
+
externalSupertype(name: string, qualifier: string | null, fileId: number, lang: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Ruby constants are looked up lexically: `Base` written inside `Rails::Generators::NamedBase` is
|
|
174
|
+
* `Rails::Generators::Base`, never `ActiveRecord::Base`, and `Thor::Group` is not some other
|
|
175
|
+
* `Group`. Returns every part of the (possibly reopened) class or module, or nothing when no
|
|
176
|
+
* enclosing scope defines it (a gem).
|
|
177
|
+
*/
|
|
178
|
+
private rubyConstant;
|
|
179
|
+
/**
|
|
180
|
+
* Qualified names of the Ruby ancestors (superclasses and mixins) of a class or module, found
|
|
181
|
+
* by lexical constant lookup. All parts of a reopened class contribute their own heritage.
|
|
182
|
+
*/
|
|
183
|
+
rubyAncestors(containerId: number): Set<string>;
|
|
184
|
+
/** Names of the classes a container extends/implements, transitively (bounded). */
|
|
185
|
+
ancestorsOf(containerId: number): Set<string>;
|
|
186
|
+
/** Ancestor and descendant type names of every container called `name`. */
|
|
187
|
+
relatedTo(name: string): {
|
|
188
|
+
anc: Set<string>;
|
|
189
|
+
desc: Set<string>;
|
|
190
|
+
};
|
|
191
|
+
private containerName;
|
|
192
|
+
/** Does the file's code mention this identifier at all? */
|
|
193
|
+
private fileMentions;
|
|
194
|
+
/** Is `name` a class-like type defined in this project? */
|
|
195
|
+
private isProjectType;
|
|
196
|
+
/**
|
|
197
|
+
* Symbols that are "the same target" as `sym` for call-graph purposes:
|
|
198
|
+
* overloads (same qualified name in the same file), C/C++ prototypes and
|
|
199
|
+
* their definitions, and same-named methods in containers related by
|
|
200
|
+
* inheritance (interface method <-> implementation, base <-> override).
|
|
201
|
+
* A call resolved to any member counts for all.
|
|
202
|
+
*/
|
|
203
|
+
familyOf(sym: SymbolRow): Set<number>;
|
|
204
|
+
/**
|
|
205
|
+
* True when `other` overrides `target` in a subtype and `target` has a body of its own:
|
|
206
|
+
* a call bound to the override never runs `target` (the reverse is not true: a call bound
|
|
207
|
+
* to the base method may dispatch to the override).
|
|
208
|
+
*/
|
|
209
|
+
overriddenBelow(target: SymbolRow, other: SymbolRow): boolean;
|
|
210
|
+
/** How many genuinely different definitions (families) share this name. */
|
|
211
|
+
private familyCount;
|
|
212
|
+
/**
|
|
213
|
+
* Evidence that a member call on a receiver of unknown type targets `cand`
|
|
214
|
+
* (a method of `container`). Zero evidence means "not linked".
|
|
215
|
+
*/
|
|
216
|
+
private memberEvidence;
|
|
217
|
+
private receiverOtherCache;
|
|
218
|
+
/** Does the receiver's name match the class of a different definition of `name`? */
|
|
219
|
+
private receiverNamesOther;
|
|
220
|
+
/** Score how plausible it is that a call at `site` targets `cand`; null = impossible. */
|
|
221
|
+
private score;
|
|
222
|
+
/**
|
|
223
|
+
* Small bonus for the definition of type `typeName` that the calling file
|
|
224
|
+
* can actually see (same file, imported by name, or nearest in the tree).
|
|
225
|
+
* Decides between identical copies of a class (vendored forks, monorepo
|
|
226
|
+
* packages).
|
|
227
|
+
*/
|
|
228
|
+
private typeVisibility;
|
|
229
|
+
private fieldTypeCache;
|
|
230
|
+
/** Declared type of `container.field` (also looking at supertypes), or null if unknown / ambiguous. */
|
|
231
|
+
private fieldType;
|
|
232
|
+
/**
|
|
233
|
+
* Fill in the receiver type from class field declarations when the
|
|
234
|
+
* extractor could not (the class is declared in another file: C++ headers,
|
|
235
|
+
* partial classes, Go structs elsewhere in the package).
|
|
236
|
+
*/
|
|
237
|
+
private withFieldType;
|
|
238
|
+
private nameIndexCache;
|
|
239
|
+
private tieCache;
|
|
240
|
+
private containerCache;
|
|
241
|
+
/** Candidates of a name grouped for fast pre-selection (only built for crowded names). */
|
|
242
|
+
private nameIndex;
|
|
243
|
+
/**
|
|
244
|
+
* Candidates that can possibly score for this call site. Purely an
|
|
245
|
+
* optimisation for names with hundreds of definitions (`run`, `add`,
|
|
246
|
+
* `get`): it must return a superset of what score() accepts.
|
|
247
|
+
*/
|
|
248
|
+
private preselect;
|
|
249
|
+
/**
|
|
250
|
+
* True when a member call's receiver gives no usable type information: an
|
|
251
|
+
* expression (`a.b().foo()`) or an untyped variable that is neither
|
|
252
|
+
* this/self, a runtime global, nor an external module. Such call sites
|
|
253
|
+
* cannot be attributed to any one definition of a common method name.
|
|
254
|
+
*/
|
|
255
|
+
isOpaqueReceiver(rawSite: CallSite): boolean;
|
|
256
|
+
private chainTypeCache;
|
|
257
|
+
/**
|
|
258
|
+
* Type of an expression receiver that is itself a call: the return type of
|
|
259
|
+
* that call's target (or the class, for constructor calls). Follows up to
|
|
260
|
+
* four links of a chain.
|
|
261
|
+
*/
|
|
262
|
+
private chainType;
|
|
263
|
+
/** Rank the definitions a call to `name` at `site` may refer to. */
|
|
264
|
+
resolve(name: string, rawSite: CallSite, depth?: number, typesOnly?: boolean): Resolution;
|
|
265
|
+
}
|