Skip to content

Commit

Permalink
Check for undefined alias id and update iterator variable
Browse files Browse the repository at this point in the history
  • Loading branch information
lmd59 committed Oct 31, 2024
1 parent c052ea3 commit cf8fbda
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/helpers/ClauseResultsHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function findLocalIdsInStatementByName(libraryElm: ELM, statementName: st
for (const alias of Array.from(emptyResultClauses)) {
// Only do it if we have a clause for where the result should be fetched from
// and have a localId for the clause that the result should map to
if (localIds[alias.expressionLocalId] != null && alias.aliasLocalId != null) {
if (localIds[alias.expressionLocalId] != null && alias.aliasLocalId) {
localIds[alias.aliasLocalId] = {
localId: alias.aliasLocalId,
sourceLocalId: alias.expressionLocalId
Expand Down Expand Up @@ -408,14 +408,14 @@ function findRelationshipAliasNodeAnnotationId(
annotation: AnnotationStatement[],
sourceLocalId: string
): string | null {
for (const as of annotation) {
for (const node of annotation) {
// if this node has a list of more nodes in s, look at the first one and see if it matches the sourceLocalId
if (as.r && as.s && as.s[0]?.r === sourceLocalId) {
if (node.r && node.s && node.s[0]?.r === sourceLocalId) {

Check warning on line 413 in src/helpers/ClauseResultsHelpers.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
// return this localId which is the parent of the sourceLocalId
return as.r;
} else if (as.s) {
return node.r;
} else if (node.s) {
// otherwise, keep recursing and return the alias localId if found
const id = findRelationshipAliasNodeAnnotationId(as.s, sourceLocalId);
const id = findRelationshipAliasNodeAnnotationId(node.s, sourceLocalId);
if (id) {
return id;
}
Expand Down

0 comments on commit cf8fbda

Please sign in to comment.