Fix PR feedback

Better handling of malformed RA
This commit is contained in:
Dave Bartolomeo
2022-08-12 15:39:32 -04:00
parent 49d12674b7
commit c6d792f41e

View File

@@ -75,9 +75,9 @@ async function generateSummarySymbols(summaryPath: string): Promise<SummarySymbo
predicateName = nonRecursiveMatch.groups!.predicateName; predicateName = nonRecursiveMatch.groups!.predicateName;
} else { } else {
const recursiveMatch = startLine.match(RECURSIVE_TUPLE_COUNT_REGEXP); const recursiveMatch = startLine.match(RECURSIVE_TUPLE_COUNT_REGEXP);
if (recursiveMatch) { if (recursiveMatch?.groups) {
predicateName = recursiveMatch.groups!.predicateName; predicateName = recursiveMatch.groups.predicateName;
iteration = parseInt(recursiveMatch.groups!.iteration); iteration = parseInt(recursiveMatch.groups.iteration);
} }
} }
@@ -92,21 +92,20 @@ async function generateSummarySymbols(summaryPath: string): Promise<SummarySymbo
} }
lineNumber++; lineNumber++;
} }
if (raEndLine === undefined) { if (raEndLine !== undefined) {
raEndLine = lineNumber - 1; let symbol = symbols.predicates[predicateName];
} if (symbol === undefined) {
let symbol = symbols.predicates[predicateName]; symbol = {
if (symbol === undefined) { iterations: {}
symbol = { };
iterations: {} symbols.predicates[predicateName] = symbol;
}
symbol.iterations[iteration] = {
startLine: lineNumber,
raStartLine: raStartLine,
raEndLine: raEndLine
}; };
symbols.predicates[predicateName] = symbol;
} }
symbol.iterations[iteration] = {
startLine: lineNumber,
raStartLine: raStartLine,
raEndLine: raEndLine
};
} }
} }