From a70b835901d7b67cf77d8d9a70c7276343cb6ac9 Mon Sep 17 00:00:00 2001 From: Elsa Date: Wed, 13 Mar 2024 10:49:04 -0400 Subject: [PATCH 1/2] Make highlighting backwards compatible with older translator versions --- src/helpers/ClauseResultsHelpers.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/helpers/ClauseResultsHelpers.ts b/src/helpers/ClauseResultsHelpers.ts index 0cdd807f..4b3ad966 100644 --- a/src/helpers/ClauseResultsHelpers.ts +++ b/src/helpers/ClauseResultsHelpers.ts @@ -102,7 +102,14 @@ export function findAllLocalIdsInStatement( aliasMap[v] = statement.expression.localId; // Determine the localId for this alias. if (statement.localId) { - alId = statement.localId; + // Older translator versions require with statements to use the statement.expression.localId + 1 as the alias Id + // even if the statement already has a localId. There is not a clear mapping for alias with statements in the new + // translator, so they will go un highlighted but this will not affect coverage calculation + if (statement.type === 'With') { + alId = (parseInt(statement.expression.localId, 10) + 1).toString(); + } else { + alId = statement.localId; + } } else { // Older translator versions created an elm_annotation localId that was not always in the elm. This was a // single increment up from the expression that defines the alias. From de0bba6f9c28dfe3a9ad3589ed21b88a0e6a4216 Mon Sep 17 00:00:00 2001 From: Elsa Date: Thu, 14 Mar 2024 13:09:06 -0400 Subject: [PATCH 2/2] Add Without --- src/helpers/ClauseResultsHelpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/ClauseResultsHelpers.ts b/src/helpers/ClauseResultsHelpers.ts index 4b3ad966..f591dcd3 100644 --- a/src/helpers/ClauseResultsHelpers.ts +++ b/src/helpers/ClauseResultsHelpers.ts @@ -105,7 +105,7 @@ export function findAllLocalIdsInStatement( // Older translator versions require with statements to use the statement.expression.localId + 1 as the alias Id // even if the statement already has a localId. There is not a clear mapping for alias with statements in the new // translator, so they will go un highlighted but this will not affect coverage calculation - if (statement.type === 'With') { + if (statement.type === 'With' || statement.type === 'Without') { alId = (parseInt(statement.expression.localId, 10) + 1).toString(); } else { alId = statement.localId;