Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for(;;) is not handled. #1

Closed
vi opened this issue Nov 6, 2017 · 3 comments
Closed

for(;;) is not handled. #1

vi opened this issue Nov 6, 2017 · 3 comments

Comments

@vi
Copy link

vi commented Nov 6, 2017

function q() {
    for(;;) {
    	console.log("dsfsdf"); 
    }
}

The diagram on the online demo fails to change unless I add loop condition.

@Bogdan-Lyashenko
Copy link
Owner

Hey, thanks for the nice catch. Fixed and merged. :)
screen shot 2017-11-06 at 21 06 06

@vi
Copy link
Author

vi commented Nov 8, 2017

The first and the third argument of for are also not shown properly. Currently they are just as if they were the statements inside for{} block.

Example program:

function test() {
    let q = null;
    for(q=0;q<100;q+=1) {
    	if (q==6) {
         	break; 
        } else {
         	continue; 
        }
    }
}

I expect q=0 to be before the loop and continue pointing at q+=1 (which should be somewhere below) instead just at for.

It should probably internally convert for loops to while loops.

@Bogdan-Lyashenko
Copy link
Owner

Nice, agree. q = 0 definitely should not be on each iteration.

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

No branches or pull requests

2 participants