-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The visualizer is inconsistent in how it visualizes variables going out of scope. In some instances, a variable going out of scope will be treated as such and will disappear once the visualizer steps out of the block the variable was defined in. In other cases, like in our example with a for loop, the variable persists after the block is exited.
To Reproduce
Steps to reproduce the behavior:
- Go to the visualizer
- Paste the following code snippet:
int main(){
int a = 0;
for (int b = 0; b < 1; b++){
int c = 15150;
a++;
}
int b = 1;
return 0;
}
- Compile the program
- Step through the program and notice how c will persist after the for loop
Expected behavior
We expect c to not be in scope after the for loop exits.
Here is a program that works as expected:
int main(){
int a = 0;
if (a == 0) {
int x = 5;
}
int b = 1;
return 0;
}
where x will not be in scope after the line int b = 1; is executed.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

