Remove error in narcissus regarding continue #184

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

azatoth commented Feb 6, 2013

Narcissus only allowed continues to be in a direct loop block, which
made it bark on allowed code.
We remove the whole requirement as it's not needed.

Remove error in narcissus regarding continue
Narcissus only allowed continues to be in a direct loop block, which
made it bark on allowed code.
We remove the whole requirement as it's not needed.

I ran into this problem as well. I'm not sure on the purpose of this check, but it should be modified or removed as suggested.

One note on the value of this check for continue in a loop. I noticed that js2coffee converted my for loop into a while loop that increments the index at the end of the loop. In the case of the loop calling continue, my index was never being correctly incremented, leading to an endless loop.

azatoth commented Jul 24, 2013

The supplied tests in 1ea6149 was the issue I directly or indirectly encountered

Yeah, you can see the same issue in your test code.

Loop index is incremented everytime in JS version.

Loop will never stop running, as the continue will always skip the increment step found at the end of the while loop.

Yes, you are right, I never realized that :/ Anyway, it's in JS a valid continue, thus we should handle it better. I don't know why js2coffee converts for(...) to while loops.

There is no direct equivalent to the for loop in coffee, a while loop simply works the best. In many cases coffeescript assumes you're going to use the for item in collection syntax, and js2coffee can't infer when you are doing that in your js code, but it can just default to a while loop.

timaschew added a commit that referenced this pull request Aug 22, 2014

Owner

timaschew commented Aug 22, 2014

thanks :)

@timaschew timaschew closed this Aug 22, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment