Skip to content

Commit

Permalink
fix: error in variable declaration when mappings of structs are used …
Browse files Browse the repository at this point in the history
…with multiple mapping keys
  • Loading branch information
lydiagarms committed Nov 21, 2024
1 parent 01cf2e1 commit f185d00
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/transformers/visitors/toOrchestrationVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1511,13 +1511,11 @@ const visitor = {
}
i++;
});

// check whether this should be a VariableDeclaration
const firstEdit =
(firstInstanceOfNewName && indicator.interactsWithSecret) ||
(!indicator.isStruct && indicator.modifyingPaths[0]?.node.id === lhs?.id && indicator.isSecret && indicator.isWhole) ||
(indicator.isStruct && indicator instanceof MappingKey && indicator.container.modifyingPaths[0]?.node.id === lhs?.id && indicator.isSecret && indicator.isWhole);

(indicator.isStruct && indicator instanceof MappingKey && indicator.modifyingPaths[0]?.node.id === lhs?.id && indicator.isSecret && indicator.isWhole);
// We should only replace the _first_ assignment to this node. Let's look at the scope's modifiedBindings for any prior modifications to this binding:
// if its secret and this is the first assigment, we add a vardec
if (
Expand All @@ -1531,7 +1529,6 @@ const visitor = {
)
accessed = true;
});

// we still need to initialise accessed states if they were accessed _before_ this modification
const accessedBeforeModification = indicator.isAccessed && indicator.accessedPaths[0].node.id < lhs.id && !indicator.accessedPaths[0].isModification();

Expand Down

0 comments on commit f185d00

Please sign in to comment.