gitnexus 1.6.2-rc.13 → 1.6.2-rc.15
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/dist/core/ingestion/call-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/c-cpp.js +8 -0
- package/dist/core/ingestion/call-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/csharp.js +6 -0
- package/dist/core/ingestion/call-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/dart.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/go.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/jvm.js +51 -0
- package/dist/core/ingestion/call-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/php.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/python.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/ruby.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/rust.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/swift.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/typescript-javascript.js +8 -0
- package/dist/core/ingestion/call-extractors/generic.d.ts +5 -0
- package/dist/core/ingestion/call-extractors/generic.js +59 -0
- package/dist/core/ingestion/call-processor.js +48 -45
- package/dist/core/ingestion/call-types.d.ts +60 -0
- package/dist/core/ingestion/call-types.js +2 -0
- package/dist/core/ingestion/class-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/class-extractors/configs/c-cpp.js +11 -0
- package/dist/core/ingestion/class-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/csharp.js +21 -0
- package/dist/core/ingestion/class-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/dart.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/go.js +20 -0
- package/dist/core/ingestion/class-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/class-extractors/configs/jvm.js +35 -0
- package/dist/core/ingestion/class-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/php.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/python.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/ruby.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/rust.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/swift.js +18 -0
- package/dist/core/ingestion/class-extractors/configs/typescript-javascript.d.ts +4 -0
- package/dist/core/ingestion/class-extractors/configs/typescript-javascript.js +28 -0
- package/dist/core/ingestion/language-provider.d.ts +7 -0
- package/dist/core/ingestion/languages/c-cpp.js +7 -9
- package/dist/core/ingestion/languages/csharp.js +5 -19
- package/dist/core/ingestion/languages/dart.js +5 -5
- package/dist/core/ingestion/languages/go.js +5 -18
- package/dist/core/ingestion/languages/java.js +5 -16
- package/dist/core/ingestion/languages/kotlin.js +5 -11
- package/dist/core/ingestion/languages/php.js +5 -5
- package/dist/core/ingestion/languages/python.js +5 -5
- package/dist/core/ingestion/languages/ruby.js +5 -5
- package/dist/core/ingestion/languages/rust.js +5 -5
- package/dist/core/ingestion/languages/swift.js +5 -16
- package/dist/core/ingestion/languages/typescript.js +7 -20
- package/dist/core/ingestion/languages/vue.js +5 -15
- package/dist/core/ingestion/workers/parse-worker.js +162 -166
- package/package.json +1 -1
- package/dist/core/ingestion/call-sites/extract-language-call-site.d.ts +0 -10
- package/dist/core/ingestion/call-sites/extract-language-call-site.js +0 -22
- package/dist/core/ingestion/call-sites/java.d.ts +0 -9
- package/dist/core/ingestion/call-sites/java.js +0 -30
|
@@ -36,8 +36,7 @@ try {
|
|
|
36
36
|
catch { }
|
|
37
37
|
import { getLanguageFromFilename } from '../../../_shared/index.js';
|
|
38
38
|
import { FUNCTION_NODE_TYPES, getDefinitionNodeFromCaptures, findEnclosingClassInfo, getLabelFromCaptures, findDescendant, extractStringContent, genericFuncName, inferFunctionLabel, CLASS_CONTAINER_TYPES, } from '../utils/ast-helpers.js';
|
|
39
|
-
import {
|
|
40
|
-
import { extractParsedCallSite } from '../call-sites/extract-language-call-site.js';
|
|
39
|
+
import { extractCallArgTypes } from '../utils/call-analysis.js';
|
|
41
40
|
import { buildTypeEnv } from '../type-env.js';
|
|
42
41
|
import { detectFrameworkFromAST } from '../framework-detection.js';
|
|
43
42
|
import { generateId } from '../../../lib/utils.js';
|
|
@@ -1248,98 +1247,125 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1248
1247
|
}
|
|
1249
1248
|
// Extract call sites
|
|
1250
1249
|
if (captureMap['call']) {
|
|
1251
|
-
const
|
|
1252
|
-
const languageSeed = extractParsedCallSite(language, callNode0);
|
|
1253
|
-
if (languageSeed) {
|
|
1254
|
-
if (!provider.isBuiltInName(languageSeed.calledName)) {
|
|
1255
|
-
const sourceId = findEnclosingFunctionId(callNode0, file.path, provider) ||
|
|
1256
|
-
generateId('File', file.path);
|
|
1257
|
-
const receiverName = languageSeed.callForm === 'member' ? languageSeed.receiverName : undefined;
|
|
1258
|
-
let receiverTypeName = receiverName
|
|
1259
|
-
? typeEnv.lookup(receiverName, callNode0)
|
|
1260
|
-
: undefined;
|
|
1261
|
-
// Type-as-receiver (e.g. Java `User::getName`): no TypeEnv binding for the class name
|
|
1262
|
-
if (receiverName !== undefined &&
|
|
1263
|
-
receiverTypeName === undefined &&
|
|
1264
|
-
languageSeed.callForm === 'member' &&
|
|
1265
|
-
(language === SupportedLanguages.Java ||
|
|
1266
|
-
language === SupportedLanguages.CSharp ||
|
|
1267
|
-
language === SupportedLanguages.Kotlin)) {
|
|
1268
|
-
const c0 = receiverName.charCodeAt(0);
|
|
1269
|
-
if (c0 >= 65 && c0 <= 90)
|
|
1270
|
-
receiverTypeName = receiverName;
|
|
1271
|
-
}
|
|
1272
|
-
result.calls.push({
|
|
1273
|
-
filePath: file.path,
|
|
1274
|
-
calledName: languageSeed.calledName,
|
|
1275
|
-
sourceId,
|
|
1276
|
-
callForm: languageSeed.callForm,
|
|
1277
|
-
...(receiverName !== undefined ? { receiverName } : {}),
|
|
1278
|
-
...(receiverTypeName !== undefined ? { receiverTypeName } : {}),
|
|
1279
|
-
});
|
|
1280
|
-
}
|
|
1281
|
-
continue;
|
|
1282
|
-
}
|
|
1250
|
+
const callNode = captureMap['call'];
|
|
1283
1251
|
const callNameNode = captureMap['call.name'];
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
//
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1252
|
+
const callExtractor = provider.callExtractor;
|
|
1253
|
+
if (callExtractor) {
|
|
1254
|
+
// ── Path 1: Language-specific call site (bypasses routing) ────
|
|
1255
|
+
// Try language-specific extraction (e.g. Java `::` method references)
|
|
1256
|
+
// without callNameNode. If successful, skip routing and the generic
|
|
1257
|
+
// path entirely.
|
|
1258
|
+
const langCallSite = callExtractor.extract(callNode, undefined);
|
|
1259
|
+
if (langCallSite) {
|
|
1260
|
+
if (!provider.isBuiltInName(langCallSite.calledName)) {
|
|
1261
|
+
const sourceId = findEnclosingFunctionId(callNode, file.path, provider) ||
|
|
1262
|
+
generateId('File', file.path);
|
|
1263
|
+
const receiverName = langCallSite.callForm === 'member' ? langCallSite.receiverName : undefined;
|
|
1264
|
+
let receiverTypeName = receiverName
|
|
1265
|
+
? typeEnv.lookup(receiverName, callNode)
|
|
1266
|
+
: undefined;
|
|
1267
|
+
// Type-as-receiver heuristic (e.g. Java `User::getName`)
|
|
1268
|
+
if (langCallSite.typeAsReceiverHeuristic &&
|
|
1269
|
+
receiverName !== undefined &&
|
|
1270
|
+
receiverTypeName === undefined &&
|
|
1271
|
+
langCallSite.callForm === 'member') {
|
|
1272
|
+
const c0 = receiverName.charCodeAt(0);
|
|
1273
|
+
if (c0 >= 65 && c0 <= 90)
|
|
1274
|
+
receiverTypeName = receiverName;
|
|
1275
|
+
}
|
|
1276
|
+
result.calls.push({
|
|
1293
1277
|
filePath: file.path,
|
|
1294
|
-
|
|
1295
|
-
|
|
1278
|
+
calledName: langCallSite.calledName,
|
|
1279
|
+
sourceId,
|
|
1280
|
+
callForm: langCallSite.callForm,
|
|
1281
|
+
...(receiverName !== undefined ? { receiverName } : {}),
|
|
1282
|
+
...(receiverTypeName !== undefined ? { receiverTypeName } : {}),
|
|
1296
1283
|
});
|
|
1297
|
-
continue;
|
|
1298
1284
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1285
|
+
continue;
|
|
1286
|
+
}
|
|
1287
|
+
// ── Path 2: Generic extraction via @call.name ────────────────
|
|
1288
|
+
if (callNameNode) {
|
|
1289
|
+
const calledName = callNameNode.text;
|
|
1290
|
+
// Dispatch: route language-specific calls (heritage, properties, imports)
|
|
1291
|
+
const routed = callRouter?.(calledName, captureMap['call']);
|
|
1292
|
+
if (routed) {
|
|
1293
|
+
if (routed.kind === 'skip')
|
|
1294
|
+
continue;
|
|
1295
|
+
if (routed.kind === 'import') {
|
|
1296
|
+
result.imports.push({
|
|
1302
1297
|
filePath: file.path,
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
kind: item.heritageKind,
|
|
1298
|
+
rawImportPath: routed.importPath,
|
|
1299
|
+
language,
|
|
1306
1300
|
});
|
|
1301
|
+
continue;
|
|
1307
1302
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
const propEnclosingInfo = cachedFindEnclosingClassInfo(captureMap['call'], file.path, provider.resolveEnclosingOwner);
|
|
1312
|
-
const propEnclosingClassId = propEnclosingInfo?.classId ?? null;
|
|
1313
|
-
// Enrich routed properties with FieldExtractor metadata
|
|
1314
|
-
let routedFieldMap;
|
|
1315
|
-
if (provider.fieldExtractor && typeEnv) {
|
|
1316
|
-
const classNode = findEnclosingClassNode(captureMap['call']);
|
|
1317
|
-
if (classNode) {
|
|
1318
|
-
routedFieldMap = getFieldInfo(classNode, provider, {
|
|
1319
|
-
typeEnv,
|
|
1320
|
-
symbolTable: NOOP_SYMBOL_TABLE,
|
|
1303
|
+
if (routed.kind === 'heritage') {
|
|
1304
|
+
for (const item of routed.items) {
|
|
1305
|
+
result.heritage.push({
|
|
1321
1306
|
filePath: file.path,
|
|
1322
|
-
|
|
1307
|
+
className: item.enclosingClass,
|
|
1308
|
+
parentName: item.mixinName,
|
|
1309
|
+
kind: item.heritageKind,
|
|
1323
1310
|
});
|
|
1324
1311
|
}
|
|
1312
|
+
continue;
|
|
1325
1313
|
}
|
|
1326
|
-
|
|
1327
|
-
const
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1314
|
+
if (routed.kind === 'properties') {
|
|
1315
|
+
const propEnclosingInfo = cachedFindEnclosingClassInfo(captureMap['call'], file.path, provider.resolveEnclosingOwner);
|
|
1316
|
+
const propEnclosingClassId = propEnclosingInfo?.classId ?? null;
|
|
1317
|
+
// Enrich routed properties with FieldExtractor metadata
|
|
1318
|
+
let routedFieldMap;
|
|
1319
|
+
if (provider.fieldExtractor && typeEnv) {
|
|
1320
|
+
const classNode = findEnclosingClassNode(captureMap['call']);
|
|
1321
|
+
if (classNode) {
|
|
1322
|
+
routedFieldMap = getFieldInfo(classNode, provider, {
|
|
1323
|
+
typeEnv,
|
|
1324
|
+
symbolTable: NOOP_SYMBOL_TABLE,
|
|
1325
|
+
filePath: file.path,
|
|
1326
|
+
language,
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
for (const item of routed.items) {
|
|
1331
|
+
const routedFieldInfo = routedFieldMap?.get(item.propName);
|
|
1332
|
+
const propQualifiedName = propEnclosingInfo
|
|
1333
|
+
? `${propEnclosingInfo.className}.${item.propName}`
|
|
1334
|
+
: item.propName;
|
|
1335
|
+
const nodeId = generateId('Property', `${file.path}:${propQualifiedName}`);
|
|
1336
|
+
result.nodes.push({
|
|
1337
|
+
id: nodeId,
|
|
1338
|
+
label: 'Property',
|
|
1339
|
+
properties: {
|
|
1340
|
+
name: item.propName,
|
|
1341
|
+
filePath: file.path,
|
|
1342
|
+
startLine: item.startLine,
|
|
1343
|
+
endLine: item.endLine,
|
|
1344
|
+
language,
|
|
1345
|
+
isExported: true,
|
|
1346
|
+
description: item.accessorType,
|
|
1347
|
+
...(item.declaredType
|
|
1348
|
+
? { declaredType: item.declaredType }
|
|
1349
|
+
: routedFieldInfo?.type
|
|
1350
|
+
? { declaredType: routedFieldInfo.type }
|
|
1351
|
+
: {}),
|
|
1352
|
+
...(routedFieldInfo?.visibility !== undefined
|
|
1353
|
+
? { visibility: routedFieldInfo.visibility }
|
|
1354
|
+
: {}),
|
|
1355
|
+
...(routedFieldInfo?.isStatic !== undefined
|
|
1356
|
+
? { isStatic: routedFieldInfo.isStatic }
|
|
1357
|
+
: {}),
|
|
1358
|
+
...(routedFieldInfo?.isReadonly !== undefined
|
|
1359
|
+
? { isReadonly: routedFieldInfo.isReadonly }
|
|
1360
|
+
: {}),
|
|
1361
|
+
},
|
|
1362
|
+
});
|
|
1363
|
+
result.symbols.push({
|
|
1337
1364
|
filePath: file.path,
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
description: item.accessorType,
|
|
1365
|
+
name: item.propName,
|
|
1366
|
+
nodeId,
|
|
1367
|
+
type: 'Property',
|
|
1368
|
+
...(propEnclosingClassId ? { ownerId: propEnclosingClassId } : {}),
|
|
1343
1369
|
...(item.declaredType
|
|
1344
1370
|
? { declaredType: item.declaredType }
|
|
1345
1371
|
: routedFieldInfo?.type
|
|
@@ -1354,101 +1380,71 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1354
1380
|
...(routedFieldInfo?.isReadonly !== undefined
|
|
1355
1381
|
? { isReadonly: routedFieldInfo.isReadonly }
|
|
1356
1382
|
: {}),
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
filePath: file.path,
|
|
1361
|
-
name: item.propName,
|
|
1362
|
-
nodeId,
|
|
1363
|
-
type: 'Property',
|
|
1364
|
-
...(propEnclosingClassId ? { ownerId: propEnclosingClassId } : {}),
|
|
1365
|
-
...(item.declaredType
|
|
1366
|
-
? { declaredType: item.declaredType }
|
|
1367
|
-
: routedFieldInfo?.type
|
|
1368
|
-
? { declaredType: routedFieldInfo.type }
|
|
1369
|
-
: {}),
|
|
1370
|
-
...(routedFieldInfo?.visibility !== undefined
|
|
1371
|
-
? { visibility: routedFieldInfo.visibility }
|
|
1372
|
-
: {}),
|
|
1373
|
-
...(routedFieldInfo?.isStatic !== undefined
|
|
1374
|
-
? { isStatic: routedFieldInfo.isStatic }
|
|
1375
|
-
: {}),
|
|
1376
|
-
...(routedFieldInfo?.isReadonly !== undefined
|
|
1377
|
-
? { isReadonly: routedFieldInfo.isReadonly }
|
|
1378
|
-
: {}),
|
|
1379
|
-
});
|
|
1380
|
-
const fileId = generateId('File', file.path);
|
|
1381
|
-
const relId = generateId('DEFINES', `${fileId}->${nodeId}`);
|
|
1382
|
-
result.relationships.push({
|
|
1383
|
-
id: relId,
|
|
1384
|
-
sourceId: fileId,
|
|
1385
|
-
targetId: nodeId,
|
|
1386
|
-
type: 'DEFINES',
|
|
1387
|
-
confidence: 1.0,
|
|
1388
|
-
reason: '',
|
|
1389
|
-
});
|
|
1390
|
-
if (propEnclosingClassId) {
|
|
1383
|
+
});
|
|
1384
|
+
const fileId = generateId('File', file.path);
|
|
1385
|
+
const relId = generateId('DEFINES', `${fileId}->${nodeId}`);
|
|
1391
1386
|
result.relationships.push({
|
|
1392
|
-
id:
|
|
1393
|
-
sourceId:
|
|
1387
|
+
id: relId,
|
|
1388
|
+
sourceId: fileId,
|
|
1394
1389
|
targetId: nodeId,
|
|
1395
|
-
type: '
|
|
1390
|
+
type: 'DEFINES',
|
|
1396
1391
|
confidence: 1.0,
|
|
1397
1392
|
reason: '',
|
|
1398
1393
|
});
|
|
1394
|
+
if (propEnclosingClassId) {
|
|
1395
|
+
result.relationships.push({
|
|
1396
|
+
id: generateId('HAS_PROPERTY', `${propEnclosingClassId}->${nodeId}`),
|
|
1397
|
+
sourceId: propEnclosingClassId,
|
|
1398
|
+
targetId: nodeId,
|
|
1399
|
+
type: 'HAS_PROPERTY',
|
|
1400
|
+
confidence: 1.0,
|
|
1401
|
+
reason: '',
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1399
1404
|
}
|
|
1405
|
+
continue;
|
|
1400
1406
|
}
|
|
1401
|
-
|
|
1407
|
+
// kind === 'call' — fall through to normal call processing below
|
|
1402
1408
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
const receiverNode = extractReceiverNode(callNameNode);
|
|
1420
|
-
if (receiverNode) {
|
|
1421
|
-
const extracted = extractMixedChain(receiverNode);
|
|
1422
|
-
if (extracted && extracted.chain.length > 0) {
|
|
1423
|
-
receiverMixedChain = extracted.chain;
|
|
1424
|
-
receiverName = extracted.baseReceiverName;
|
|
1425
|
-
// Try the type environment immediately for the base receiver
|
|
1426
|
-
// (covers explicitly-typed locals and annotated parameters).
|
|
1427
|
-
if (receiverName) {
|
|
1428
|
-
receiverTypeName = typeEnv.lookup(receiverName, callNode);
|
|
1429
|
-
}
|
|
1409
|
+
if (!provider.isBuiltInName(calledName)) {
|
|
1410
|
+
const callSite = callExtractor.extract(callNode, callNameNode);
|
|
1411
|
+
if (callSite) {
|
|
1412
|
+
const sourceId = findEnclosingFunctionId(callNode, file.path, provider) ||
|
|
1413
|
+
generateId('File', file.path);
|
|
1414
|
+
let receiverTypeName = callSite.receiverName
|
|
1415
|
+
? typeEnv.lookup(callSite.receiverName, callNode)
|
|
1416
|
+
: undefined;
|
|
1417
|
+
// Type-as-receiver heuristic
|
|
1418
|
+
if (callSite.typeAsReceiverHeuristic &&
|
|
1419
|
+
callSite.receiverName !== undefined &&
|
|
1420
|
+
receiverTypeName === undefined &&
|
|
1421
|
+
callSite.callForm === 'member') {
|
|
1422
|
+
const c0 = callSite.receiverName.charCodeAt(0);
|
|
1423
|
+
if (c0 >= 65 && c0 <= 90)
|
|
1424
|
+
receiverTypeName = callSite.receiverName;
|
|
1430
1425
|
}
|
|
1426
|
+
const inferLiteralType = provider.typeConfig?.inferLiteralType;
|
|
1427
|
+
// Skip when no arg list / zero args: nothing to infer for overload typing
|
|
1428
|
+
const argTypes = inferLiteralType && callSite.argCount !== undefined && callSite.argCount > 0
|
|
1429
|
+
? extractCallArgTypes(callNode, inferLiteralType, (varName, cn) => typeEnv.lookup(varName, cn))
|
|
1430
|
+
: undefined;
|
|
1431
|
+
result.calls.push({
|
|
1432
|
+
filePath: file.path,
|
|
1433
|
+
calledName: callSite.calledName,
|
|
1434
|
+
sourceId,
|
|
1435
|
+
...(callSite.argCount !== undefined ? { argCount: callSite.argCount } : {}),
|
|
1436
|
+
...(callSite.callForm !== undefined ? { callForm: callSite.callForm } : {}),
|
|
1437
|
+
...(callSite.receiverName !== undefined
|
|
1438
|
+
? { receiverName: callSite.receiverName }
|
|
1439
|
+
: {}),
|
|
1440
|
+
...(receiverTypeName !== undefined ? { receiverTypeName } : {}),
|
|
1441
|
+
...(callSite.receiverMixedChain !== undefined
|
|
1442
|
+
? { receiverMixedChain: callSite.receiverMixedChain }
|
|
1443
|
+
: {}),
|
|
1444
|
+
...(argTypes !== undefined ? { argTypes } : {}),
|
|
1445
|
+
});
|
|
1431
1446
|
}
|
|
1432
1447
|
}
|
|
1433
|
-
const inferLiteralType = provider.typeConfig?.inferLiteralType;
|
|
1434
|
-
const argCountForOverloadHints = countCallArguments(callNode);
|
|
1435
|
-
// Skip when no arg list / zero args: nothing to infer for overload typing; saves AST walks + payload size.
|
|
1436
|
-
const argTypes = inferLiteralType &&
|
|
1437
|
-
argCountForOverloadHints !== undefined &&
|
|
1438
|
-
argCountForOverloadHints > 0
|
|
1439
|
-
? extractCallArgTypes(callNode, inferLiteralType, (varName, cn) => typeEnv.lookup(varName, cn))
|
|
1440
|
-
: undefined;
|
|
1441
|
-
result.calls.push({
|
|
1442
|
-
filePath: file.path,
|
|
1443
|
-
calledName,
|
|
1444
|
-
sourceId,
|
|
1445
|
-
argCount: countCallArguments(callNode),
|
|
1446
|
-
...(callForm !== undefined ? { callForm } : {}),
|
|
1447
|
-
...(receiverName !== undefined ? { receiverName } : {}),
|
|
1448
|
-
...(receiverTypeName !== undefined ? { receiverTypeName } : {}),
|
|
1449
|
-
...(receiverMixedChain !== undefined ? { receiverMixedChain } : {}),
|
|
1450
|
-
...(argTypes !== undefined ? { argTypes } : {}),
|
|
1451
|
-
});
|
|
1452
1448
|
}
|
|
1453
1449
|
}
|
|
1454
1450
|
continue;
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** Non-generic @call shapes → { calledName, callForm, receiverName? } (used from call-processor / parse-worker). */
|
|
2
|
-
import { SupportedLanguages } from '../../../config/supported-languages.js';
|
|
3
|
-
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
|
4
|
-
export type ParsedCallSite = {
|
|
5
|
-
calledName: string;
|
|
6
|
-
callForm: 'free' | 'member' | 'constructor';
|
|
7
|
-
receiverName?: string;
|
|
8
|
-
};
|
|
9
|
-
/** Non-null → seed replaces @call.name; null → use @call.name + inferCallForm / extractReceiverName. */
|
|
10
|
-
export declare function extractParsedCallSite(language: SupportedLanguages, callNode: SyntaxNode): ParsedCallSite | null;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/** Non-generic @call shapes → { calledName, callForm, receiverName? } (used from call-processor / parse-worker). */
|
|
2
|
-
import { SupportedLanguages } from '../../../config/supported-languages.js';
|
|
3
|
-
import { parseJavaMethodReference } from './java.js';
|
|
4
|
-
/** Non-null → seed replaces @call.name; null → use @call.name + inferCallForm / extractReceiverName. */
|
|
5
|
-
export function extractParsedCallSite(language, callNode) {
|
|
6
|
-
switch (language) {
|
|
7
|
-
case SupportedLanguages.Java:
|
|
8
|
-
if (callNode.type === 'method_reference') {
|
|
9
|
-
const parsed = parseJavaMethodReference(callNode);
|
|
10
|
-
if (!parsed)
|
|
11
|
-
return null;
|
|
12
|
-
return {
|
|
13
|
-
calledName: parsed.calledName,
|
|
14
|
-
callForm: parsed.callForm,
|
|
15
|
-
...(parsed.receiverName !== undefined ? { receiverName: parsed.receiverName } : {}),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
default:
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Java `method_reference` (`::`) nodes (tree-sitter-java). `super::` still lacks TypeEnv receiver typing. */
|
|
2
|
-
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
|
3
|
-
export type ParsedJavaMethodReference = {
|
|
4
|
-
calledName: string;
|
|
5
|
-
callForm: 'member' | 'constructor';
|
|
6
|
-
receiverName?: string;
|
|
7
|
-
};
|
|
8
|
-
/** Parse `expr::method`, `Type::new`, `this::m`, `super::m`. */
|
|
9
|
-
export declare const parseJavaMethodReference: (callNode: SyntaxNode) => ParsedJavaMethodReference | null;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** Java `method_reference` (`::`) nodes (tree-sitter-java). `super::` still lacks TypeEnv receiver typing. */
|
|
2
|
-
/** Parse `expr::method`, `Type::new`, `this::m`, `super::m`. */
|
|
3
|
-
export const parseJavaMethodReference = (callNode) => {
|
|
4
|
-
if (callNode.type !== 'method_reference')
|
|
5
|
-
return null;
|
|
6
|
-
const recv = callNode.namedChild(0);
|
|
7
|
-
if (!recv)
|
|
8
|
-
return null;
|
|
9
|
-
for (const c of callNode.children) {
|
|
10
|
-
if (c.type === 'new') {
|
|
11
|
-
if (recv.type !== 'identifier')
|
|
12
|
-
return null;
|
|
13
|
-
return { calledName: recv.text, callForm: 'constructor' };
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const rhs = callNode.child(callNode.childCount - 1);
|
|
17
|
-
if (!rhs || rhs.type !== 'identifier')
|
|
18
|
-
return null;
|
|
19
|
-
const methodName = rhs.text;
|
|
20
|
-
if (recv.type === 'identifier') {
|
|
21
|
-
return { calledName: methodName, callForm: 'member', receiverName: recv.text };
|
|
22
|
-
}
|
|
23
|
-
if (recv.type === 'this') {
|
|
24
|
-
return { calledName: methodName, callForm: 'member', receiverName: 'this' };
|
|
25
|
-
}
|
|
26
|
-
if (recv.type === 'super') {
|
|
27
|
-
return { calledName: methodName, callForm: 'member', receiverName: 'super' };
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
};
|