Commit aa40121
committed
internal/refactor/inline: always retain braces for binding declarations
When inlining a function that requires a binding declaration (e.g.,
'var p = arg'), the inliner must ensure that the new variable does
not collide with other declarations in the same scope.
Previously, the inliner would often elide the braces around the
inlined body if the chosen variable name (the parameter name) was
not yet present in the caller's scope. However, when multiple calls
are inlined into the same block, independent inlining passes may
choose the same name, leading to a redeclaration error.
This CL ensures that we always retain block braces whenever a
binding declaration is introduced. This provides guaranteed scope
isolation for the new variables and prevents redeclaration conflicts
between multiple concurrent inlinings.
Additionally, this fix adds a missing 'res.bindingDecl = true' flag
in the void-function inlining strategy, which was previously causing
some inlinings to incorrectly elide braces even when variables were
introduced.
Fixes #798131 parent d2b991c commit aa40121
1 file changed
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments