2616eb2aed
Some CFE lowerings (e.g. pattern lowerings) result in nested scopes containing VariableDeclarations with the same 'name'. The current DDC transform translates these to the exact same name in JS leading to incorrect semantics. The `TemporaryId` mechanism automatically renames any variables with the same name that would shadow each other. So we re-use that here to ensure the variables all have a unique name if the CFE hasn't already given them one. If the name is already okay (i.e. not shadowing something else), the name in JS will appear unchanged. Side note: In a future change perhaps we should rename `TemporaryId`. The general mechanism it implements is more useful than its original intended use. Fixes: #59613 Change-Id: I708c72528d5df19af48dde01163d375a5588baae Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398504 Commit-Queue: Nate Biggs <natebiggs@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>