gitnexus 1.4.0 → 1.4.5
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 +19 -18
- package/dist/cli/analyze.js +37 -28
- package/dist/cli/augment.js +1 -1
- package/dist/cli/eval-server.d.ts +1 -1
- package/dist/cli/eval-server.js +1 -1
- package/dist/cli/index.js +1 -0
- package/dist/cli/mcp.js +1 -1
- package/dist/cli/setup.js +25 -13
- package/dist/cli/status.js +13 -4
- package/dist/cli/tool.d.ts +1 -1
- package/dist/cli/tool.js +2 -2
- package/dist/cli/wiki.js +2 -2
- package/dist/config/ignore-service.d.ts +25 -0
- package/dist/config/ignore-service.js +76 -0
- package/dist/config/supported-languages.d.ts +1 -0
- package/dist/config/supported-languages.js +1 -1
- package/dist/core/augmentation/engine.js +94 -67
- package/dist/core/embeddings/embedder.d.ts +1 -1
- package/dist/core/embeddings/embedder.js +1 -1
- package/dist/core/embeddings/embedding-pipeline.d.ts +3 -3
- package/dist/core/embeddings/embedding-pipeline.js +52 -25
- package/dist/core/embeddings/types.d.ts +1 -1
- package/dist/core/ingestion/call-processor.d.ts +6 -7
- package/dist/core/ingestion/call-processor.js +490 -127
- package/dist/core/ingestion/call-routing.d.ts +53 -0
- package/dist/core/ingestion/call-routing.js +108 -0
- package/dist/core/ingestion/entry-point-scoring.js +13 -2
- package/dist/core/ingestion/export-detection.js +1 -0
- package/dist/core/ingestion/filesystem-walker.js +4 -3
- package/dist/core/ingestion/framework-detection.js +9 -0
- package/dist/core/ingestion/heritage-processor.d.ts +3 -4
- package/dist/core/ingestion/heritage-processor.js +40 -50
- package/dist/core/ingestion/import-processor.d.ts +3 -5
- package/dist/core/ingestion/import-processor.js +41 -10
- package/dist/core/ingestion/parsing-processor.d.ts +2 -1
- package/dist/core/ingestion/parsing-processor.js +41 -4
- package/dist/core/ingestion/pipeline.d.ts +5 -1
- package/dist/core/ingestion/pipeline.js +174 -121
- package/dist/core/ingestion/resolution-context.d.ts +53 -0
- package/dist/core/ingestion/resolution-context.js +132 -0
- package/dist/core/ingestion/resolvers/index.d.ts +2 -0
- package/dist/core/ingestion/resolvers/index.js +2 -0
- package/dist/core/ingestion/resolvers/python.d.ts +19 -0
- package/dist/core/ingestion/resolvers/python.js +52 -0
- package/dist/core/ingestion/resolvers/ruby.d.ts +12 -0
- package/dist/core/ingestion/resolvers/ruby.js +15 -0
- package/dist/core/ingestion/resolvers/standard.js +0 -22
- package/dist/core/ingestion/resolvers/utils.js +2 -0
- package/dist/core/ingestion/symbol-table.d.ts +3 -0
- package/dist/core/ingestion/symbol-table.js +1 -0
- package/dist/core/ingestion/tree-sitter-queries.d.ts +3 -2
- package/dist/core/ingestion/tree-sitter-queries.js +53 -1
- package/dist/core/ingestion/type-env.d.ts +32 -10
- package/dist/core/ingestion/type-env.js +520 -47
- package/dist/core/ingestion/type-extractors/c-cpp.js +326 -1
- package/dist/core/ingestion/type-extractors/csharp.js +282 -2
- package/dist/core/ingestion/type-extractors/go.js +333 -2
- package/dist/core/ingestion/type-extractors/index.d.ts +3 -2
- package/dist/core/ingestion/type-extractors/index.js +3 -1
- package/dist/core/ingestion/type-extractors/jvm.js +537 -4
- package/dist/core/ingestion/type-extractors/php.js +387 -7
- package/dist/core/ingestion/type-extractors/python.js +356 -5
- package/dist/core/ingestion/type-extractors/ruby.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/ruby.js +389 -0
- package/dist/core/ingestion/type-extractors/rust.js +399 -2
- package/dist/core/ingestion/type-extractors/shared.d.ts +116 -1
- package/dist/core/ingestion/type-extractors/shared.js +488 -14
- package/dist/core/ingestion/type-extractors/swift.js +95 -1
- package/dist/core/ingestion/type-extractors/types.d.ts +81 -0
- package/dist/core/ingestion/type-extractors/typescript.js +436 -2
- package/dist/core/ingestion/utils.d.ts +33 -2
- package/dist/core/ingestion/utils.js +399 -27
- package/dist/core/ingestion/workers/parse-worker.d.ts +18 -1
- package/dist/core/ingestion/workers/parse-worker.js +169 -19
- package/dist/core/{kuzu → lbug}/csv-generator.d.ts +1 -1
- package/dist/core/{kuzu → lbug}/csv-generator.js +1 -1
- package/dist/core/{kuzu/kuzu-adapter.d.ts → lbug/lbug-adapter.d.ts} +19 -19
- package/dist/core/{kuzu/kuzu-adapter.js → lbug/lbug-adapter.js} +70 -65
- package/dist/core/{kuzu → lbug}/schema.d.ts +1 -1
- package/dist/core/{kuzu → lbug}/schema.js +1 -1
- package/dist/core/search/bm25-index.d.ts +4 -4
- package/dist/core/search/bm25-index.js +10 -10
- package/dist/core/search/hybrid-search.d.ts +2 -2
- package/dist/core/search/hybrid-search.js +6 -6
- package/dist/core/tree-sitter/parser-loader.js +9 -2
- package/dist/core/wiki/generator.d.ts +2 -2
- package/dist/core/wiki/generator.js +4 -4
- package/dist/core/wiki/graph-queries.d.ts +4 -4
- package/dist/core/wiki/graph-queries.js +7 -7
- package/dist/mcp/core/{kuzu-adapter.d.ts → lbug-adapter.d.ts} +7 -7
- package/dist/mcp/core/{kuzu-adapter.js → lbug-adapter.js} +72 -43
- package/dist/mcp/local/local-backend.d.ts +6 -6
- package/dist/mcp/local/local-backend.js +25 -18
- package/dist/server/api.js +12 -12
- package/dist/server/mcp-http.d.ts +1 -1
- package/dist/server/mcp-http.js +1 -1
- package/dist/storage/repo-manager.d.ts +20 -2
- package/dist/storage/repo-manager.js +55 -1
- package/dist/types/pipeline.d.ts +1 -1
- package/package.json +5 -3
- package/dist/core/ingestion/symbol-resolver.d.ts +0 -32
- package/dist/core/ingestion/symbol-resolver.js +0 -83
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolution Context
|
|
3
|
+
*
|
|
4
|
+
* Single implementation of tiered name resolution. Replaces the duplicated
|
|
5
|
+
* tier-selection logic previously split between symbol-resolver.ts and
|
|
6
|
+
* call-processor.ts.
|
|
7
|
+
*
|
|
8
|
+
* Resolution tiers (highest confidence first):
|
|
9
|
+
* 1. Same file (lookupExactFull — authoritative)
|
|
10
|
+
* 2a-named. Named binding chain (walkBindingChain via NamedImportMap)
|
|
11
|
+
* 2a. Import-scoped (lookupFuzzy filtered by ImportMap)
|
|
12
|
+
* 2b. Package-scoped (lookupFuzzy filtered by PackageMap)
|
|
13
|
+
* 3. Global (all candidates — consumers must check candidate count)
|
|
14
|
+
*/
|
|
15
|
+
import { createSymbolTable } from './symbol-table.js';
|
|
16
|
+
import { isFileInPackageDir } from './import-processor.js';
|
|
17
|
+
import { walkBindingChain } from './named-binding-extraction.js';
|
|
18
|
+
/** Confidence scores per resolution tier. */
|
|
19
|
+
export const TIER_CONFIDENCE = {
|
|
20
|
+
'same-file': 0.95,
|
|
21
|
+
'import-scoped': 0.9,
|
|
22
|
+
'global': 0.5,
|
|
23
|
+
};
|
|
24
|
+
export const createResolutionContext = () => {
|
|
25
|
+
const symbols = createSymbolTable();
|
|
26
|
+
const importMap = new Map();
|
|
27
|
+
const packageMap = new Map();
|
|
28
|
+
const namedImportMap = new Map();
|
|
29
|
+
// Per-file cache state
|
|
30
|
+
let cacheFile = null;
|
|
31
|
+
let cache = null;
|
|
32
|
+
let cacheHits = 0;
|
|
33
|
+
let cacheMisses = 0;
|
|
34
|
+
// --- Core resolution (single implementation of tier logic) ---
|
|
35
|
+
const resolveUncached = (name, fromFile) => {
|
|
36
|
+
// Tier 1: Same file — authoritative match
|
|
37
|
+
const localDef = symbols.lookupExactFull(fromFile, name);
|
|
38
|
+
if (localDef) {
|
|
39
|
+
return { candidates: [localDef], tier: 'same-file' };
|
|
40
|
+
}
|
|
41
|
+
// Get all global definitions for subsequent tiers
|
|
42
|
+
const allDefs = symbols.lookupFuzzy(name);
|
|
43
|
+
// Tier 2a-named: Check named bindings BEFORE empty-allDefs early return
|
|
44
|
+
// because aliased imports mean lookupFuzzy('U') returns empty but we
|
|
45
|
+
// can resolve via the exported name.
|
|
46
|
+
const chainResult = walkBindingChain(name, fromFile, symbols, namedImportMap, allDefs);
|
|
47
|
+
if (chainResult && chainResult.length > 0) {
|
|
48
|
+
return { candidates: chainResult, tier: 'import-scoped' };
|
|
49
|
+
}
|
|
50
|
+
if (allDefs.length === 0)
|
|
51
|
+
return null;
|
|
52
|
+
// Tier 2a: Import-scoped — definition in a file imported by fromFile
|
|
53
|
+
const importedFiles = importMap.get(fromFile);
|
|
54
|
+
if (importedFiles) {
|
|
55
|
+
const importedDefs = allDefs.filter(def => importedFiles.has(def.filePath));
|
|
56
|
+
if (importedDefs.length > 0) {
|
|
57
|
+
return { candidates: importedDefs, tier: 'import-scoped' };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Tier 2b: Package-scoped — definition in a package dir imported by fromFile
|
|
61
|
+
const importedPackages = packageMap.get(fromFile);
|
|
62
|
+
if (importedPackages) {
|
|
63
|
+
const packageDefs = allDefs.filter(def => {
|
|
64
|
+
for (const dirSuffix of importedPackages) {
|
|
65
|
+
if (isFileInPackageDir(def.filePath, dirSuffix))
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
});
|
|
70
|
+
if (packageDefs.length > 0) {
|
|
71
|
+
return { candidates: packageDefs, tier: 'import-scoped' };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Tier 3: Global — pass all candidates through.
|
|
75
|
+
// Consumers must check candidate count and refuse ambiguous matches.
|
|
76
|
+
return { candidates: allDefs, tier: 'global' };
|
|
77
|
+
};
|
|
78
|
+
const resolve = (name, fromFile) => {
|
|
79
|
+
// Check cache (only when enabled AND fromFile matches cached file)
|
|
80
|
+
if (cache && cacheFile === fromFile) {
|
|
81
|
+
if (cache.has(name)) {
|
|
82
|
+
cacheHits++;
|
|
83
|
+
return cache.get(name);
|
|
84
|
+
}
|
|
85
|
+
cacheMisses++;
|
|
86
|
+
}
|
|
87
|
+
const result = resolveUncached(name, fromFile);
|
|
88
|
+
// Store in cache if active and file matches
|
|
89
|
+
if (cache && cacheFile === fromFile) {
|
|
90
|
+
cache.set(name, result);
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
// --- Cache lifecycle ---
|
|
95
|
+
const enableCache = (filePath) => {
|
|
96
|
+
cacheFile = filePath;
|
|
97
|
+
if (!cache)
|
|
98
|
+
cache = new Map();
|
|
99
|
+
else
|
|
100
|
+
cache.clear();
|
|
101
|
+
};
|
|
102
|
+
const clearCache = () => {
|
|
103
|
+
cacheFile = null;
|
|
104
|
+
// Reuse the Map instance — just clear entries to reduce GC pressure at scale.
|
|
105
|
+
cache?.clear();
|
|
106
|
+
};
|
|
107
|
+
const getStats = () => ({
|
|
108
|
+
...symbols.getStats(),
|
|
109
|
+
cacheHits,
|
|
110
|
+
cacheMisses,
|
|
111
|
+
});
|
|
112
|
+
const clear = () => {
|
|
113
|
+
symbols.clear();
|
|
114
|
+
importMap.clear();
|
|
115
|
+
packageMap.clear();
|
|
116
|
+
namedImportMap.clear();
|
|
117
|
+
clearCache();
|
|
118
|
+
cacheHits = 0;
|
|
119
|
+
cacheMisses = 0;
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
resolve,
|
|
123
|
+
symbols,
|
|
124
|
+
importMap,
|
|
125
|
+
packageMap,
|
|
126
|
+
namedImportMap,
|
|
127
|
+
enableCache,
|
|
128
|
+
clearCache,
|
|
129
|
+
getStats,
|
|
130
|
+
clear,
|
|
131
|
+
};
|
|
132
|
+
};
|
|
@@ -12,5 +12,7 @@ export type { CSharpProjectConfig } from './csharp.js';
|
|
|
12
12
|
export { resolvePhpImport } from './php.js';
|
|
13
13
|
export type { ComposerConfig } from './php.js';
|
|
14
14
|
export { resolveRustImport, tryRustModulePath } from './rust.js';
|
|
15
|
+
export { resolveRubyImport } from './ruby.js';
|
|
16
|
+
export { resolvePythonImport } from './python.js';
|
|
15
17
|
export { resolveImportPath, RESOLVE_CACHE_CAP } from './standard.js';
|
|
16
18
|
export type { TsconfigPaths } from './standard.js';
|
|
@@ -8,4 +8,6 @@ export { resolveGoPackageDir, resolveGoPackage } from './go.js';
|
|
|
8
8
|
export { resolveCSharpImport, resolveCSharpNamespaceDir } from './csharp.js';
|
|
9
9
|
export { resolvePhpImport } from './php.js';
|
|
10
10
|
export { resolveRustImport, tryRustModulePath } from './rust.js';
|
|
11
|
+
export { resolveRubyImport } from './ruby.js';
|
|
12
|
+
export { resolvePythonImport } from './python.js';
|
|
11
13
|
export { resolveImportPath, RESOLVE_CACHE_CAP } from './standard.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python import resolution — PEP 328 relative imports and proximity-based bare imports.
|
|
3
|
+
* Import system spec: PEP 302 (original), PEP 451 (current).
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a Python import to a file path.
|
|
7
|
+
*
|
|
8
|
+
* 1. Relative (PEP 328): `.module`, `..module` — 1 dot = current package, each extra dot goes up one level.
|
|
9
|
+
* 2. Proximity bare import: static heuristic — checks the importer's own directory first.
|
|
10
|
+
* Approximates the common case where co-located files find each other without an installed package.
|
|
11
|
+
* Single-segment only — multi-segment (e.g. `os.path`) falls through to suffixResolve.
|
|
12
|
+
* Checks package (__init__.py) before module (.py), matching CPython's finder order (PEP 451 §4).
|
|
13
|
+
* Coexistence of both is physically impossible (same name = file vs directory), so the order
|
|
14
|
+
* only matters for spec compliance.
|
|
15
|
+
* Note: namespace packages (PEP 420, directory without __init__.py) are not handled.
|
|
16
|
+
*
|
|
17
|
+
* Returns null to let the caller fall through to suffixResolve.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolvePythonImport(currentFile: string, importPath: string, allFiles: Set<string>): string | null;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python import resolution — PEP 328 relative imports and proximity-based bare imports.
|
|
3
|
+
* Import system spec: PEP 302 (original), PEP 451 (current).
|
|
4
|
+
*/
|
|
5
|
+
import { tryResolveWithExtensions } from './utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a Python import to a file path.
|
|
8
|
+
*
|
|
9
|
+
* 1. Relative (PEP 328): `.module`, `..module` — 1 dot = current package, each extra dot goes up one level.
|
|
10
|
+
* 2. Proximity bare import: static heuristic — checks the importer's own directory first.
|
|
11
|
+
* Approximates the common case where co-located files find each other without an installed package.
|
|
12
|
+
* Single-segment only — multi-segment (e.g. `os.path`) falls through to suffixResolve.
|
|
13
|
+
* Checks package (__init__.py) before module (.py), matching CPython's finder order (PEP 451 §4).
|
|
14
|
+
* Coexistence of both is physically impossible (same name = file vs directory), so the order
|
|
15
|
+
* only matters for spec compliance.
|
|
16
|
+
* Note: namespace packages (PEP 420, directory without __init__.py) are not handled.
|
|
17
|
+
*
|
|
18
|
+
* Returns null to let the caller fall through to suffixResolve.
|
|
19
|
+
*/
|
|
20
|
+
export function resolvePythonImport(currentFile, importPath, allFiles) {
|
|
21
|
+
// Relative import — PEP 328 (https://peps.python.org/pep-0328/)
|
|
22
|
+
if (importPath.startsWith('.')) {
|
|
23
|
+
const dotMatch = importPath.match(/^(\.+)(.*)/);
|
|
24
|
+
if (!dotMatch)
|
|
25
|
+
return null;
|
|
26
|
+
const dotCount = dotMatch[1].length;
|
|
27
|
+
const modulePart = dotMatch[2];
|
|
28
|
+
const dirParts = currentFile.split('/').slice(0, -1);
|
|
29
|
+
// PEP 328: more dots than directory levels → beyond top-level package → invalid
|
|
30
|
+
if (dotCount - 1 > dirParts.length)
|
|
31
|
+
return null;
|
|
32
|
+
for (let i = 1; i < dotCount; i++)
|
|
33
|
+
dirParts.pop();
|
|
34
|
+
if (modulePart) {
|
|
35
|
+
dirParts.push(...modulePart.replace(/\./g, '/').split('/'));
|
|
36
|
+
}
|
|
37
|
+
return tryResolveWithExtensions(dirParts.join('/'), allFiles);
|
|
38
|
+
}
|
|
39
|
+
// Proximity bare import — single-segment only; package before module (PEP 451 §4)
|
|
40
|
+
const pathLike = importPath.replace(/\./g, '/');
|
|
41
|
+
if (pathLike.includes('/'))
|
|
42
|
+
return null;
|
|
43
|
+
// Normalize for Windows backslashes
|
|
44
|
+
const importerDir = currentFile.replace(/\\/g, '/').split('/').slice(0, -1).join('/');
|
|
45
|
+
if (!importerDir)
|
|
46
|
+
return null;
|
|
47
|
+
if (allFiles.has(`${importerDir}/${pathLike}/__init__.py`))
|
|
48
|
+
return `${importerDir}/${pathLike}/__init__.py`;
|
|
49
|
+
if (allFiles.has(`${importerDir}/${pathLike}.py`))
|
|
50
|
+
return `${importerDir}/${pathLike}.py`;
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby require/require_relative import resolution.
|
|
3
|
+
* Handles path resolution for Ruby's require and require_relative calls.
|
|
4
|
+
*/
|
|
5
|
+
import type { SuffixIndex } from './utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a Ruby require/require_relative path to a matching .rb file.
|
|
8
|
+
*
|
|
9
|
+
* require_relative paths are pre-normalized to './' prefix by the caller.
|
|
10
|
+
* require paths use suffix matching (gem-style paths like 'json', 'net/http').
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveRubyImport(importPath: string, normalizedFileList: string[], allFileList: string[], index?: SuffixIndex): string | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby require/require_relative import resolution.
|
|
3
|
+
* Handles path resolution for Ruby's require and require_relative calls.
|
|
4
|
+
*/
|
|
5
|
+
import { suffixResolve } from './utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a Ruby require/require_relative path to a matching .rb file.
|
|
8
|
+
*
|
|
9
|
+
* require_relative paths are pre-normalized to './' prefix by the caller.
|
|
10
|
+
* require paths use suffix matching (gem-style paths like 'json', 'net/http').
|
|
11
|
+
*/
|
|
12
|
+
export function resolveRubyImport(importPath, normalizedFileList, allFileList, index) {
|
|
13
|
+
const pathParts = importPath.replace(/^\.\//, '').split('/').filter(Boolean);
|
|
14
|
+
return suffixResolve(pathParts, normalizedFileList, allFileList, index);
|
|
15
|
+
}
|
|
@@ -89,28 +89,6 @@ export const resolveImportPath = (currentFile, importPath, allFiles, allFileList
|
|
|
89
89
|
return cache(rustResult);
|
|
90
90
|
// Fall through to generic resolution if Rust-specific didn't match
|
|
91
91
|
}
|
|
92
|
-
// ---- Python relative imports (PEP 328): .module, ..module, ... ----
|
|
93
|
-
if (language === SupportedLanguages.Python && importPath.startsWith('.')) {
|
|
94
|
-
const dotMatch = importPath.match(/^(\.+)(.*)/);
|
|
95
|
-
if (dotMatch) {
|
|
96
|
-
const dotCount = dotMatch[1].length;
|
|
97
|
-
const modulePart = dotMatch[2]; // e.g., "models" from ".models"
|
|
98
|
-
const dirParts = currentFile.split('/').slice(0, -1); // remove filename
|
|
99
|
-
// Navigate up: 1 dot = same package, 2 dots = parent package, etc.
|
|
100
|
-
// First dot means "current package", each additional dot goes up one level
|
|
101
|
-
for (let i = 1; i < dotCount; i++) {
|
|
102
|
-
dirParts.pop();
|
|
103
|
-
}
|
|
104
|
-
if (modulePart) {
|
|
105
|
-
// from .models import User → resolve "models" relative to current package
|
|
106
|
-
const modulePath = modulePart.replace(/\./g, '/');
|
|
107
|
-
dirParts.push(...modulePath.split('/'));
|
|
108
|
-
}
|
|
109
|
-
const basePath = dirParts.join('/');
|
|
110
|
-
const resolved = tryResolveWithExtensions(basePath, allFiles);
|
|
111
|
-
return cache(resolved);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
92
|
// ---- Generic relative import resolution (./ and ../) ----
|
|
115
93
|
const currentDir = currentFile.split('/').slice(0, -1);
|
|
116
94
|
const parts = importPath.split('/');
|
|
@@ -3,6 +3,8 @@ export interface SymbolDefinition {
|
|
|
3
3
|
filePath: string;
|
|
4
4
|
type: string;
|
|
5
5
|
parameterCount?: number;
|
|
6
|
+
/** Raw return type text extracted from AST (e.g. 'User', 'Promise<User>') */
|
|
7
|
+
returnType?: string;
|
|
6
8
|
/** Links Method/Constructor to owning Class/Struct/Trait nodeId */
|
|
7
9
|
ownerId?: string;
|
|
8
10
|
}
|
|
@@ -12,6 +14,7 @@ export interface SymbolTable {
|
|
|
12
14
|
*/
|
|
13
15
|
add: (filePath: string, name: string, nodeId: string, type: string, metadata?: {
|
|
14
16
|
parameterCount?: number;
|
|
17
|
+
returnType?: string;
|
|
15
18
|
ownerId?: string;
|
|
16
19
|
}) => void;
|
|
17
20
|
/**
|
|
@@ -11,6 +11,7 @@ export const createSymbolTable = () => {
|
|
|
11
11
|
filePath,
|
|
12
12
|
type,
|
|
13
13
|
...(metadata?.parameterCount !== undefined ? { parameterCount: metadata.parameterCount } : {}),
|
|
14
|
+
...(metadata?.returnType !== undefined ? { returnType: metadata.returnType } : {}),
|
|
14
15
|
...(metadata?.ownerId !== undefined ? { ownerId: metadata.ownerId } : {}),
|
|
15
16
|
};
|
|
16
17
|
// A. Add to File Index (shared reference — zero additional memory)
|
|
@@ -5,10 +5,11 @@ export declare const PYTHON_QUERIES = "\n(class_definition\n name: (identifier)
|
|
|
5
5
|
export declare const JAVA_QUERIES = "\n; Classes, Interfaces, Enums, Annotations\n(class_declaration name: (identifier) @name) @definition.class\n(interface_declaration name: (identifier) @name) @definition.interface\n(enum_declaration name: (identifier) @name) @definition.enum\n(annotation_type_declaration name: (identifier) @name) @definition.annotation\n\n; Methods & Constructors\n(method_declaration name: (identifier) @name) @definition.method\n(constructor_declaration name: (identifier) @name) @definition.constructor\n\n; Imports - capture any import declaration child as source\n(import_declaration (_) @import.source) @import\n\n; Calls\n(method_invocation name: (identifier) @call.name) @call\n(method_invocation object: (_) name: (identifier) @call.name) @call\n\n; Constructor calls: new Foo()\n(object_creation_expression type: (type_identifier) @call.name) @call\n\n; Heritage - extends class\n(class_declaration name: (identifier) @heritage.class\n (superclass (type_identifier) @heritage.extends)) @heritage\n\n; Heritage - implements interfaces\n(class_declaration name: (identifier) @heritage.class\n (super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl\n";
|
|
6
6
|
export declare const C_QUERIES = "\n; Functions (direct declarator)\n(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n\n; Functions returning pointers (pointer_declarator wraps function_declarator)\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n\n; Functions returning double pointers (nested pointer_declarator)\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function\n\n; Structs, Unions, Enums, Typedefs\n(struct_specifier name: (type_identifier) @name) @definition.struct\n(union_specifier name: (type_identifier) @name) @definition.union\n(enum_specifier name: (type_identifier) @name) @definition.enum\n(type_definition declarator: (type_identifier) @name) @definition.typedef\n\n; Macros\n(preproc_function_def name: (identifier) @name) @definition.macro\n(preproc_def name: (identifier) @name) @definition.macro\n\n; Includes\n(preproc_include path: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n";
|
|
7
7
|
export declare const GO_QUERIES = "\n; Functions & Methods\n(function_declaration name: (identifier) @name) @definition.function\n(method_declaration name: (field_identifier) @name) @definition.method\n\n; Types\n(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) @definition.struct\n(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) @definition.interface\n\n; Imports\n(import_declaration (import_spec path: (interpreted_string_literal) @import.source)) @import\n(import_declaration (import_spec_list (import_spec path: (interpreted_string_literal) @import.source))) @import\n\n; Struct embedding (anonymous fields = inheritance)\n(type_declaration\n (type_spec\n name: (type_identifier) @heritage.class\n type: (struct_type\n (field_declaration_list\n (field_declaration\n type: (type_identifier) @heritage.extends))))) @definition.struct\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (selector_expression field: (field_identifier) @call.name)) @call\n\n; Struct literal construction: User{Name: \"Alice\"}\n(composite_literal type: (type_identifier) @call.name) @call\n";
|
|
8
|
-
export declare const CPP_QUERIES = "\n; Classes, Structs, Namespaces\n(class_specifier name: (type_identifier) @name) @definition.class\n(struct_specifier name: (type_identifier) @name) @definition.struct\n(namespace_definition name: (namespace_identifier) @name) @definition.namespace\n(enum_specifier name: (type_identifier) @name) @definition.enum\n\n; Typedefs and unions (common in C-style headers and mixed C/C++ code)\n(type_definition declarator: (type_identifier) @name) @definition.typedef\n(union_specifier name: (type_identifier) @name) @definition.union\n\n; Macros\n(preproc_function_def name: (identifier) @name) @definition.macro\n(preproc_def name: (identifier) @name) @definition.macro\n\n; Functions & Methods (direct declarator)\n(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @definition.method\n\n; Functions/methods returning pointers (pointer_declarator wraps function_declarator)\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method\n\n; Functions/methods returning double pointers (nested pointer_declarator)\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))))) @definition.method\n\n; Functions/methods returning references (reference_declarator wraps function_declarator)\n(function_definition declarator: (reference_declarator (function_declarator declarator: (identifier) @name))) @definition.function\n(function_definition declarator: (reference_declarator (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method\n\n; Destructors (destructor_name is distinct from identifier in tree-sitter-cpp)\n(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (destructor_name) @name))) @definition.method\n\n; Function declarations / prototypes (common in headers)\n(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n\n; Inline class method declarations (inside class body, no body: void Foo();)\n(field_declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.method\n\n; Inline class method definitions (inside class body, with body: void Foo() { ... })\n(field_declaration_list\n (function_definition\n declarator: (function_declarator\n declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name))
|
|
9
|
-
export declare const CSHARP_QUERIES = "\n; Types\n(class_declaration name: (identifier) @name) @definition.class\n(interface_declaration name: (identifier) @name) @definition.interface\n(struct_declaration name: (identifier) @name) @definition.struct\n(enum_declaration name: (identifier) @name) @definition.enum\n(record_declaration name: (identifier) @name) @definition.record\n(delegate_declaration name: (identifier) @name) @definition.delegate\n\n; Namespaces (block form and C# 10+ file-scoped form)\n(namespace_declaration name: (identifier) @name) @definition.namespace\n(namespace_declaration name: (qualified_name) @name) @definition.namespace\n(file_scoped_namespace_declaration name: (identifier) @name) @definition.namespace\n(file_scoped_namespace_declaration name: (qualified_name) @name) @definition.namespace\n\n; Methods & Properties\n(method_declaration name: (identifier) @name) @definition.method\n(local_function_statement name: (identifier) @name) @definition.function\n(constructor_declaration name: (identifier) @name) @definition.constructor\n(property_declaration name: (identifier) @name) @definition.property\n\n; Primary constructors (C# 12): class User(string name, int age) { }\n(class_declaration name: (identifier) @name (parameter_list) @definition.constructor)\n(record_declaration name: (identifier) @name (parameter_list) @definition.constructor)\n\n; Using\n(using_directive (qualified_name) @import.source) @import\n(using_directive (identifier) @import.source) @import\n\n; Calls\n(invocation_expression function: (identifier) @call.name) @call\n(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call\n\n; Constructor calls: new Foo() and new Foo { Props }\n(object_creation_expression type: (identifier) @call.name) @call\n\n; Target-typed new (C# 9): User u = new(\"x\", 5)\n(variable_declaration type: (identifier) @call.name (variable_declarator (implicit_object_creation_expression) @call))\n\n; Heritage\n(class_declaration name: (identifier) @heritage.class\n (base_list (identifier) @heritage.extends)) @heritage\n(class_declaration name: (identifier) @heritage.class\n (base_list (generic_name (identifier) @heritage.extends))) @heritage\n";
|
|
8
|
+
export declare const CPP_QUERIES = "\n; Classes, Structs, Namespaces\n(class_specifier name: (type_identifier) @name) @definition.class\n(struct_specifier name: (type_identifier) @name) @definition.struct\n(namespace_definition name: (namespace_identifier) @name) @definition.namespace\n(enum_specifier name: (type_identifier) @name) @definition.enum\n\n; Typedefs and unions (common in C-style headers and mixed C/C++ code)\n(type_definition declarator: (type_identifier) @name) @definition.typedef\n(union_specifier name: (type_identifier) @name) @definition.union\n\n; Macros\n(preproc_function_def name: (identifier) @name) @definition.macro\n(preproc_def name: (identifier) @name) @definition.macro\n\n; Functions & Methods (direct declarator)\n(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @definition.method\n\n; Functions/methods returning pointers (pointer_declarator wraps function_declarator)\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method\n\n; Functions/methods returning double pointers (nested pointer_declarator)\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))))) @definition.method\n\n; Functions/methods returning references (reference_declarator wraps function_declarator)\n(function_definition declarator: (reference_declarator (function_declarator declarator: (identifier) @name))) @definition.function\n(function_definition declarator: (reference_declarator (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method\n\n; Destructors (destructor_name is distinct from identifier in tree-sitter-cpp)\n(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (destructor_name) @name))) @definition.method\n\n; Function declarations / prototypes (common in headers)\n(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n\n; Inline class method declarations (inside class body, no body: void Foo();)\n(field_declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.method\n\n; Inline class method definitions (inside class body, with body: void Foo() { ... })\n(field_declaration_list\n (function_definition\n declarator: (function_declarator\n declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name)) @definition.method)\n\n; Templates\n(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template\n(template_declaration (function_definition declarator: (function_declarator declarator: (identifier) @name))) @definition.template\n\n; Includes\n(preproc_include path: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n(call_expression function: (qualified_identifier name: (identifier) @call.name)) @call\n(call_expression function: (template_function name: (identifier) @call.name)) @call\n\n; Constructor calls: new User()\n(new_expression type: (type_identifier) @call.name) @call\n\n; Heritage\n(class_specifier name: (type_identifier) @heritage.class\n (base_class_clause (type_identifier) @heritage.extends)) @heritage\n(class_specifier name: (type_identifier) @heritage.class\n (base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage\n";
|
|
9
|
+
export declare const CSHARP_QUERIES = "\n; Types\n(class_declaration name: (identifier) @name) @definition.class\n(interface_declaration name: (identifier) @name) @definition.interface\n(struct_declaration name: (identifier) @name) @definition.struct\n(enum_declaration name: (identifier) @name) @definition.enum\n(record_declaration name: (identifier) @name) @definition.record\n(delegate_declaration name: (identifier) @name) @definition.delegate\n\n; Namespaces (block form and C# 10+ file-scoped form)\n(namespace_declaration name: (identifier) @name) @definition.namespace\n(namespace_declaration name: (qualified_name) @name) @definition.namespace\n(file_scoped_namespace_declaration name: (identifier) @name) @definition.namespace\n(file_scoped_namespace_declaration name: (qualified_name) @name) @definition.namespace\n\n; Methods & Properties\n(method_declaration name: (identifier) @name) @definition.method\n(local_function_statement name: (identifier) @name) @definition.function\n(constructor_declaration name: (identifier) @name) @definition.constructor\n(property_declaration name: (identifier) @name) @definition.property\n\n; Primary constructors (C# 12): class User(string name, int age) { }\n(class_declaration name: (identifier) @name (parameter_list) @definition.constructor)\n(record_declaration name: (identifier) @name (parameter_list) @definition.constructor)\n\n; Using\n(using_directive (qualified_name) @import.source) @import\n(using_directive (identifier) @import.source) @import\n\n; Calls\n(invocation_expression function: (identifier) @call.name) @call\n(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call\n\n; Null-conditional method calls: user?.Save()\n; Parses as: invocation_expression \u2192 conditional_access_expression \u2192 member_binding_expression \u2192 identifier\n(invocation_expression\n function: (conditional_access_expression\n (member_binding_expression\n (identifier) @call.name))) @call\n\n; Constructor calls: new Foo() and new Foo { Props }\n(object_creation_expression type: (identifier) @call.name) @call\n\n; Target-typed new (C# 9): User u = new(\"x\", 5)\n(variable_declaration type: (identifier) @call.name (variable_declarator (implicit_object_creation_expression) @call))\n\n; Heritage\n(class_declaration name: (identifier) @heritage.class\n (base_list (identifier) @heritage.extends)) @heritage\n(class_declaration name: (identifier) @heritage.class\n (base_list (generic_name (identifier) @heritage.extends))) @heritage\n";
|
|
10
10
|
export declare const RUST_QUERIES = "\n; Functions & Items\n(function_item name: (identifier) @name) @definition.function\n(struct_item name: (type_identifier) @name) @definition.struct\n(enum_item name: (type_identifier) @name) @definition.enum\n(trait_item name: (type_identifier) @name) @definition.trait\n(impl_item type: (type_identifier) @name !trait) @definition.impl\n(impl_item type: (generic_type type: (type_identifier) @name) !trait) @definition.impl\n(mod_item name: (identifier) @name) @definition.module\n\n; Type aliases, const, static, macros\n(type_item name: (type_identifier) @name) @definition.type\n(const_item name: (identifier) @name) @definition.const\n(static_item name: (identifier) @name) @definition.static\n(macro_definition name: (identifier) @name) @definition.macro\n\n; Use statements\n(use_declaration argument: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n(call_expression function: (scoped_identifier name: (identifier) @call.name)) @call\n(call_expression function: (generic_function function: (identifier) @call.name)) @call\n\n; Struct literal construction: User { name: value }\n(struct_expression name: (type_identifier) @call.name) @call\n\n; Heritage (trait implementation) \u2014 all combinations of concrete/generic trait \u00D7 concrete/generic type\n(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage\n(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage\n(impl_item trait: (type_identifier) @heritage.trait type: (generic_type type: (type_identifier) @heritage.class)) @heritage\n(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (generic_type type: (type_identifier) @heritage.class)) @heritage\n";
|
|
11
11
|
export declare const PHP_QUERIES = "\n; \u2500\u2500 Namespace \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(namespace_definition\n name: (namespace_name) @name) @definition.namespace\n\n; \u2500\u2500 Classes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @name) @definition.class\n\n; \u2500\u2500 Interfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(interface_declaration\n name: (name) @name) @definition.interface\n\n; \u2500\u2500 Traits \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(trait_declaration\n name: (name) @name) @definition.trait\n\n; \u2500\u2500 Enums (PHP 8.1) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_declaration\n name: (name) @name) @definition.enum\n\n; \u2500\u2500 Top-level functions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_definition\n name: (name) @name) @definition.function\n\n; \u2500\u2500 Methods (including constructors) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method_declaration\n name: (name) @name) @definition.method\n\n; \u2500\u2500 Class properties (including Eloquent $fillable, $casts, etc.) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(property_declaration\n (property_element\n (variable_name\n (name) @name))) @definition.property\n\n; \u2500\u2500 Imports: use statements \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Simple: use App\\Models\\User;\n(namespace_use_declaration\n (namespace_use_clause\n (qualified_name) @import.source)) @import\n\n; \u2500\u2500 Function/method calls \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Regular function call: foo()\n(function_call_expression\n function: (name) @call.name) @call\n\n; Method call: $obj->method()\n(member_call_expression\n name: (name) @call.name) @call\n\n; Nullsafe method call: $obj?->method()\n(nullsafe_member_call_expression\n name: (name) @call.name) @call\n\n; Static call: Foo::bar() (php_only uses scoped_call_expression)\n(scoped_call_expression\n name: (name) @call.name) @call\n\n; Constructor call: new User()\n(object_creation_expression (name) @call.name) @call\n\n; \u2500\u2500 Heritage: extends \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n (base_clause\n [(name) (qualified_name)] @heritage.extends)) @heritage\n\n; \u2500\u2500 Heritage: implements \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n (class_interface_clause\n [(name) (qualified_name)] @heritage.implements)) @heritage.impl\n\n; \u2500\u2500 Heritage: use trait (must capture enclosing class name) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n body: (declaration_list\n (use_declaration\n [(name) (qualified_name)] @heritage.trait))) @heritage\n";
|
|
12
|
+
export declare const RUBY_QUERIES = "\n; \u2500\u2500 Modules \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(module\n name: (constant) @name) @definition.module\n\n; \u2500\u2500 Classes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class\n name: (constant) @name) @definition.class\n\n; \u2500\u2500 Instance methods \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 Singleton (class-level) methods \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(singleton_method\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 All calls (require, include, attr_*, and regular calls routed in JS) \u2500\u2500\u2500\u2500\u2500\n(call\n method: (identifier) @call.name) @call\n\n; \u2500\u2500 Bare calls without parens (identifiers at statement level are method calls) \u2500\n; NOTE: This may over-capture variable reads as calls (e.g. 'result' at\n; statement level). Ruby's grammar makes bare identifiers ambiguous \u2014 they\n; could be local variables or zero-arity method calls. Post-processing via\n; isBuiltInOrNoise and symbol resolution filtering suppresses most false\n; positives, but a variable name that coincidentally matches a method name\n; elsewhere may produce a false CALLS edge.\n(body_statement\n (identifier) @call.name @call)\n\n; \u2500\u2500 Heritage: class < SuperClass \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class\n name: (constant) @heritage.class\n superclass: (superclass\n (constant) @heritage.extends)) @heritage\n";
|
|
12
13
|
export declare const KOTLIN_QUERIES = "\n; \u2500\u2500 Interfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; tree-sitter-kotlin (fwcd) has no interface_declaration node type.\n; Interfaces are class_declaration nodes with an anonymous \"interface\" keyword child.\n(class_declaration\n \"interface\"\n (type_identifier) @name) @definition.interface\n\n; \u2500\u2500 Classes (regular, data, sealed, enum) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; All have the anonymous \"class\" keyword child. enum class has both\n; \"enum\" and \"class\" children \u2014 the \"class\" child still matches.\n(class_declaration\n \"class\"\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Object declarations (Kotlin singletons) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(object_declaration\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Companion objects (named only) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(companion_object\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Functions (top-level, member, extension) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_declaration\n (simple_identifier) @name) @definition.function\n\n; \u2500\u2500 Properties \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(property_declaration\n (variable_declaration\n (simple_identifier) @name)) @definition.property\n\n; \u2500\u2500 Enum entries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_entry\n (simple_identifier) @name) @definition.enum\n\n; \u2500\u2500 Type aliases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_alias\n (type_identifier) @name) @definition.type\n\n; \u2500\u2500 Imports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_header\n (identifier) @import.source) @import\n\n; \u2500\u2500 Function calls (direct) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Method calls (via navigation: obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (navigation_expression\n (navigation_suffix\n (simple_identifier) @call.name))) @call\n\n; \u2500\u2500 Constructor invocations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(constructor_invocation\n (user_type\n (type_identifier) @call.name)) @call\n\n; \u2500\u2500 Infix function calls (e.g., a to b, x until y) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(infix_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Heritage: extends / implements via delegation_specifier \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Interface implementation (bare user_type): class Foo : Bar\n(class_declaration\n (type_identifier) @heritage.class\n (delegation_specifier\n (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Class extension (constructor_invocation): class Foo : Bar()\n(class_declaration\n (type_identifier) @heritage.class\n (delegation_specifier\n (constructor_invocation\n (user_type (type_identifier) @heritage.extends)))) @heritage\n";
|
|
13
14
|
export declare const SWIFT_QUERIES = "\n; Classes\n(class_declaration \"class\" name: (type_identifier) @name) @definition.class\n\n; Structs\n(class_declaration \"struct\" name: (type_identifier) @name) @definition.struct\n\n; Enums\n(class_declaration \"enum\" name: (type_identifier) @name) @definition.enum\n\n; Extensions (mapped to class \u2014 no dedicated label in schema)\n(class_declaration \"extension\" name: (user_type (type_identifier) @name)) @definition.class\n\n; Actors\n(class_declaration \"actor\" name: (type_identifier) @name) @definition.class\n\n; Protocols (mapped to interface)\n(protocol_declaration name: (type_identifier) @name) @definition.interface\n\n; Type aliases\n(typealias_declaration name: (type_identifier) @name) @definition.type\n\n; Functions (top-level and methods)\n(function_declaration name: (simple_identifier) @name) @definition.function\n\n; Protocol method declarations\n(protocol_function_declaration name: (simple_identifier) @name) @definition.method\n\n; Initializers\n(init_declaration) @definition.constructor\n\n; Properties (stored and computed)\n(property_declaration (pattern (simple_identifier) @name)) @definition.property\n\n; Imports\n(import_declaration (identifier (simple_identifier) @import.source)) @import\n\n; Calls - direct function calls\n(call_expression (simple_identifier) @call.name) @call\n\n; Calls - member/navigation calls (obj.method())\n(call_expression (navigation_expression (navigation_suffix (simple_identifier) @call.name))) @call\n\n; Heritage - class/struct/enum inheritance and protocol conformance\n(class_declaration name: (type_identifier) @heritage.class\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - protocol inheritance\n(protocol_declaration name: (type_identifier) @heritage.class\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - extension protocol conformance (e.g. extension Foo: SomeProtocol)\n; Extensions wrap the name in user_type unlike class/struct/enum declarations\n(class_declaration \"extension\" name: (user_type (type_identifier) @heritage.class)\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n";
|
|
14
15
|
export declare const LANGUAGE_QUERIES: Record<SupportedLanguages, string>;
|
|
@@ -298,7 +298,7 @@ export const CPP_QUERIES = `
|
|
|
298
298
|
(field_declaration_list
|
|
299
299
|
(function_definition
|
|
300
300
|
declarator: (function_declarator
|
|
301
|
-
declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name))
|
|
301
|
+
declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name)) @definition.method)
|
|
302
302
|
|
|
303
303
|
; Templates
|
|
304
304
|
(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template
|
|
@@ -356,6 +356,13 @@ export const CSHARP_QUERIES = `
|
|
|
356
356
|
(invocation_expression function: (identifier) @call.name) @call
|
|
357
357
|
(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call
|
|
358
358
|
|
|
359
|
+
; Null-conditional method calls: user?.Save()
|
|
360
|
+
; Parses as: invocation_expression → conditional_access_expression → member_binding_expression → identifier
|
|
361
|
+
(invocation_expression
|
|
362
|
+
function: (conditional_access_expression
|
|
363
|
+
(member_binding_expression
|
|
364
|
+
(identifier) @call.name))) @call
|
|
365
|
+
|
|
359
366
|
; Constructor calls: new Foo() and new Foo { Props }
|
|
360
367
|
(object_creation_expression type: (identifier) @call.name) @call
|
|
361
368
|
|
|
@@ -484,6 +491,50 @@ export const PHP_QUERIES = `
|
|
|
484
491
|
(use_declaration
|
|
485
492
|
[(name) (qualified_name)] @heritage.trait))) @heritage
|
|
486
493
|
`;
|
|
494
|
+
// Ruby queries - works with tree-sitter-ruby
|
|
495
|
+
// NOTE: Ruby uses `call` for require, include, extend, prepend, attr_* etc.
|
|
496
|
+
// These are all captured as @call and routed in JS post-processing:
|
|
497
|
+
// - require/require_relative → import extraction
|
|
498
|
+
// - include/extend/prepend → heritage (mixin) extraction
|
|
499
|
+
// - attr_accessor/attr_reader/attr_writer → property definition extraction
|
|
500
|
+
// - everything else → regular call extraction
|
|
501
|
+
export const RUBY_QUERIES = `
|
|
502
|
+
; ── Modules ──────────────────────────────────────────────────────────────────
|
|
503
|
+
(module
|
|
504
|
+
name: (constant) @name) @definition.module
|
|
505
|
+
|
|
506
|
+
; ── Classes ──────────────────────────────────────────────────────────────────
|
|
507
|
+
(class
|
|
508
|
+
name: (constant) @name) @definition.class
|
|
509
|
+
|
|
510
|
+
; ── Instance methods ─────────────────────────────────────────────────────────
|
|
511
|
+
(method
|
|
512
|
+
name: (identifier) @name) @definition.method
|
|
513
|
+
|
|
514
|
+
; ── Singleton (class-level) methods ──────────────────────────────────────────
|
|
515
|
+
(singleton_method
|
|
516
|
+
name: (identifier) @name) @definition.method
|
|
517
|
+
|
|
518
|
+
; ── All calls (require, include, attr_*, and regular calls routed in JS) ─────
|
|
519
|
+
(call
|
|
520
|
+
method: (identifier) @call.name) @call
|
|
521
|
+
|
|
522
|
+
; ── Bare calls without parens (identifiers at statement level are method calls) ─
|
|
523
|
+
; NOTE: This may over-capture variable reads as calls (e.g. 'result' at
|
|
524
|
+
; statement level). Ruby's grammar makes bare identifiers ambiguous — they
|
|
525
|
+
; could be local variables or zero-arity method calls. Post-processing via
|
|
526
|
+
; isBuiltInOrNoise and symbol resolution filtering suppresses most false
|
|
527
|
+
; positives, but a variable name that coincidentally matches a method name
|
|
528
|
+
; elsewhere may produce a false CALLS edge.
|
|
529
|
+
(body_statement
|
|
530
|
+
(identifier) @call.name @call)
|
|
531
|
+
|
|
532
|
+
; ── Heritage: class < SuperClass ─────────────────────────────────────────────
|
|
533
|
+
(class
|
|
534
|
+
name: (constant) @heritage.class
|
|
535
|
+
superclass: (superclass
|
|
536
|
+
(constant) @heritage.extends)) @heritage
|
|
537
|
+
`;
|
|
487
538
|
// Kotlin queries - works with tree-sitter-kotlin (fwcd/tree-sitter-kotlin)
|
|
488
539
|
// Based on official tags.scm; functions use simple_identifier, classes use type_identifier
|
|
489
540
|
export const KOTLIN_QUERIES = `
|
|
@@ -629,6 +680,7 @@ export const LANGUAGE_QUERIES = {
|
|
|
629
680
|
[SupportedLanguages.Go]: GO_QUERIES,
|
|
630
681
|
[SupportedLanguages.CPlusPlus]: CPP_QUERIES,
|
|
631
682
|
[SupportedLanguages.CSharp]: CSHARP_QUERIES,
|
|
683
|
+
[SupportedLanguages.Ruby]: RUBY_QUERIES,
|
|
632
684
|
[SupportedLanguages.Rust]: RUST_QUERIES,
|
|
633
685
|
[SupportedLanguages.PHP]: PHP_QUERIES,
|
|
634
686
|
[SupportedLanguages.Kotlin]: KOTLIN_QUERIES,
|
|
@@ -1,27 +1,49 @@
|
|
|
1
1
|
import type { SyntaxNode } from './utils.js';
|
|
2
2
|
import { SupportedLanguages } from '../../config/supported-languages.js';
|
|
3
|
+
import type { SymbolTable } from './symbol-table.js';
|
|
3
4
|
/**
|
|
4
5
|
* Per-file scoped type environment: maps (scope, variableName) → typeName.
|
|
5
6
|
* Scope-aware: variables inside functions are keyed by function name,
|
|
6
7
|
* file-level variables use the '' (empty string) scope.
|
|
7
8
|
*
|
|
8
9
|
* Design constraints:
|
|
9
|
-
* - Explicit-only:
|
|
10
|
+
* - Explicit-only: Tier 0 uses type annotations; Tier 1 infers from constructors
|
|
11
|
+
* - Tier 2: single-pass assignment chain propagation in source order — resolves
|
|
12
|
+
* `const b = a` when `a` already has a type from Tier 0/1
|
|
10
13
|
* - Scope-aware: function-local variables don't collide across functions
|
|
11
14
|
* - Conservative: complex/generic types extract the base name only
|
|
12
15
|
* - Per-file: built once, used for receiver resolution, then discarded
|
|
13
16
|
*/
|
|
14
17
|
export type TypeEnv = Map<string, Map<string, string>>;
|
|
15
18
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Build a scoped TypeEnv from a tree-sitter AST for a given language.
|
|
22
|
-
* Walks the tree tracking enclosing function scopes, so that variables
|
|
23
|
-
* inside different functions don't collide.
|
|
19
|
+
* Per-file type environment with receiver resolution.
|
|
20
|
+
* Built once per file via `buildTypeEnv`, used for receiver-type filtering,
|
|
21
|
+
* then discarded. Encapsulates scope-aware type lookup and self/this/super
|
|
22
|
+
* AST resolution behind a single `.lookup()` method.
|
|
24
23
|
*/
|
|
24
|
+
export interface TypeEnvironment {
|
|
25
|
+
/** Look up a variable's resolved type, with self/this/super AST resolution. */
|
|
26
|
+
lookup(varName: string, callNode: SyntaxNode): string | undefined;
|
|
27
|
+
/** Unverified cross-file constructor bindings for SymbolTable verification. */
|
|
28
|
+
readonly constructorBindings: readonly ConstructorBinding[];
|
|
29
|
+
/** Raw per-scope type bindings — for testing and debugging. */
|
|
30
|
+
readonly env: TypeEnv;
|
|
31
|
+
}
|
|
25
32
|
export declare const buildTypeEnv: (tree: {
|
|
26
33
|
rootNode: SyntaxNode;
|
|
27
|
-
}, language: SupportedLanguages) =>
|
|
34
|
+
}, language: SupportedLanguages, symbolTable?: SymbolTable) => TypeEnvironment;
|
|
35
|
+
/**
|
|
36
|
+
* Unverified constructor binding: a `val x = Callee()` pattern where we
|
|
37
|
+
* couldn't confirm the callee is a class (because it's defined in another file).
|
|
38
|
+
* The caller must verify `calleeName` against the SymbolTable before trusting.
|
|
39
|
+
*/
|
|
40
|
+
export interface ConstructorBinding {
|
|
41
|
+
/** Function scope key (matches TypeEnv scope keys) */
|
|
42
|
+
scope: string;
|
|
43
|
+
/** Variable name that received the constructor result */
|
|
44
|
+
varName: string;
|
|
45
|
+
/** Name of the callee (potential class constructor) */
|
|
46
|
+
calleeName: string;
|
|
47
|
+
/** Enclosing class name when callee is a method on a known receiver (e.g. $this) */
|
|
48
|
+
receiverClassName?: string;
|
|
49
|
+
}
|