@c4a/extract-ts 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
|
@@ -12841,7 +12841,9 @@ function semanticExtractionPayload(extraction) {
|
|
|
12841
12841
|
stats: extraction.stats
|
|
12842
12842
|
};
|
|
12843
12843
|
}
|
|
12844
|
-
function relationSourceFile(relation, symbols) {
|
|
12844
|
+
function relationSourceFile(relation, symbols, filePaths) {
|
|
12845
|
+
if (filePaths.has(relation.from))
|
|
12846
|
+
return relation.from;
|
|
12845
12847
|
const candidates = symbols.filter((symbol) => symbol.name === relation.from);
|
|
12846
12848
|
if (candidates.length === 1)
|
|
12847
12849
|
return candidates[0].file;
|
|
@@ -12871,6 +12873,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
12871
12873
|
}
|
|
12872
12874
|
const coverageByPath = new Map(coverage.files.map((file) => [file.path, file]));
|
|
12873
12875
|
const fileInfoByPath = new Map(extraction.files.map((file) => [file.path, file]));
|
|
12876
|
+
const filePaths = new Set([...coverageByPath.keys(), ...fileInfoByPath.keys()]);
|
|
12874
12877
|
for (const file of extraction.files) {
|
|
12875
12878
|
if (!coverageByPath.has(file.path)) {
|
|
12876
12879
|
throw new TypeError(`ExtractionResult file ${file.path} has no coverage disposition`);
|
|
@@ -12887,7 +12890,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
12887
12890
|
const generatedDiagnostics = [];
|
|
12888
12891
|
const relationsByFile = new Map;
|
|
12889
12892
|
for (const relation of extraction.relations) {
|
|
12890
|
-
const file = relationSourceFile(relation, extraction.symbols);
|
|
12893
|
+
const file = relationSourceFile(relation, extraction.symbols, filePaths);
|
|
12891
12894
|
if (file === null || coverageByPath.get(file)?.disposition !== "analyzed") {
|
|
12892
12895
|
generatedDiagnostics.push({
|
|
12893
12896
|
code: "relation-locator-unresolved",
|