You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently do shadowing in one case: inside a function, when a global symbol is not used.
We could do it in more cases, i.e. each time we enter a new scope (if-body, for-body, etc.).
For example, we could do:
int x = ...;
for(int i =0; i <10; i++) {
int x = ...; // if the outer x is not used inside the for-loop
}
The text was updated successfully, but these errors were encountered:
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
We currently do shadowing in one case: inside a function, when a global symbol is not used.
We could do it in more cases, i.e. each time we enter a new scope (if-body, for-body, etc.).
For example, we could do:
The text was updated successfully, but these errors were encountered: