@c4a/extract 0.7.0 → 0.7.1
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/index.js +5 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -16287,7 +16287,9 @@ function semanticExtractionPayload(extraction) {
|
|
|
16287
16287
|
stats: extraction.stats
|
|
16288
16288
|
};
|
|
16289
16289
|
}
|
|
16290
|
-
function relationSourceFile(relation, symbols) {
|
|
16290
|
+
function relationSourceFile(relation, symbols, filePaths) {
|
|
16291
|
+
if (filePaths.has(relation.from))
|
|
16292
|
+
return relation.from;
|
|
16291
16293
|
const candidates = symbols.filter((symbol) => symbol.name === relation.from);
|
|
16292
16294
|
if (candidates.length === 1)
|
|
16293
16295
|
return candidates[0].file;
|
|
@@ -16317,6 +16319,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16317
16319
|
}
|
|
16318
16320
|
const coverageByPath = new Map(coverage.files.map((file) => [file.path, file]));
|
|
16319
16321
|
const fileInfoByPath = new Map(extraction.files.map((file) => [file.path, file]));
|
|
16322
|
+
const filePaths = new Set([...coverageByPath.keys(), ...fileInfoByPath.keys()]);
|
|
16320
16323
|
for (const file of extraction.files) {
|
|
16321
16324
|
if (!coverageByPath.has(file.path)) {
|
|
16322
16325
|
throw new TypeError(`ExtractionResult file ${file.path} has no coverage disposition`);
|
|
@@ -16333,7 +16336,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16333
16336
|
const generatedDiagnostics = [];
|
|
16334
16337
|
const relationsByFile = new Map;
|
|
16335
16338
|
for (const relation of extraction.relations) {
|
|
16336
|
-
const file = relationSourceFile(relation, extraction.symbols);
|
|
16339
|
+
const file = relationSourceFile(relation, extraction.symbols, filePaths);
|
|
16337
16340
|
if (file === null || coverageByPath.get(file)?.disposition !== "analyzed") {
|
|
16338
16341
|
generatedDiagnostics.push({
|
|
16339
16342
|
code: "relation-locator-unresolved",
|