Skip to content

Commit

Permalink
fix: previous fix caused error for structs that aren't mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
lydiagarms committed Nov 21, 2024
1 parent f185d00 commit 5c3476f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transformers/visitors/toOrchestrationVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,9 @@ const visitor = {
const firstEdit =
(firstInstanceOfNewName && indicator.interactsWithSecret) ||
(!indicator.isStruct && indicator.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 want to check the indicator of the struct and not the struct property
(indicator.isStruct && indicator instanceof MappingKey && !indicator.isMapping && indicator.container.modifyingPaths[0]?.node.id === lhs?.id && indicator.isSecret && indicator.isWhole) ||
((indicator.isStruct && indicator.isMapping && 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 Down

0 comments on commit 5c3476f

Please sign in to comment.