Skip to content

Conversation

@laurentlb
Copy link
Owner

@laurentlb laurentlb commented May 11, 2024

In the past, we used the shadowing mechanism only when entering functions. Now, we do if in loops and if statements too.

Note that scopes often don't start at the blocks (curly braces). In a function, arguments are part of the function body scope. In a for-loop, the init declaration is part if the for-loop body too, even if there are curly braces. For this reason, we don't apply shadowing at the block level.

Fixes #382

laurentlb added 4 commits May 12, 2024 00:09
In the past, we used the shadowing mechanism only when entering functions. Now, we do if in for loops and if statements too.

Note that scopes often don't start at the blocks (curly braces). In a function, arguments are part of the function body scope. In a for-loop, the init declaration is part if the for-loop body too, even if there are curly braces. For this reason, we don't apply shadowing at the block level.
@laurentlb laurentlb changed the title Shadow variables inside for loops and if statements Shadow variables inside loops and if statements May 11, 2024
@laurentlb laurentlb merged commit c526918 into master May 12, 2024
@eldritchconundrum eldritchconundrum deleted the ren branch May 12, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming: allow shadowing inside local blocks

3 participants