-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Nodes: Infinite loop possible when for
loop uses a variable as its step value
#2047
Labels
Comments
I was just bitten by this (v1.3.3):
|
for
loop uses a variable as its step value
for
loop uses a variable as its step valuefor
loop uses a variable as its step value
zdenko
added a commit
to zdenko/coffeescript
that referenced
this issue
Jan 12, 2018
zdenko
added a commit
to zdenko/coffeescript
that referenced
this issue
Jan 12, 2018
zdenko
added a commit
to zdenko/coffeescript
that referenced
this issue
Jan 12, 2018
GeoffreyBooth
pushed a commit
that referenced
this issue
Feb 1, 2018
…ariables (#4853) * fix #2047 * Additional check for 'step'; tests * Fix #4105 (#4855) * Update output * Throw warning for unsupported runtimes, e.g. Node < 6 (#4839) * fix #1403 (#4854) * Update output * [Change]: Destructuring with non-final spread should still use rest syntax (#4517) (#4825) * destructuring optimization * refactor * minor improvement, fix errors * minor refactoring * improvements * Update output * Update output * Fix #4843: bad output when assigning to @prop in destructuring assignment with defaults (#4848) * fix #4843 * improvements * typo * small fix * Fix #3441: parentheses wrapping expression throw invalid error (#4849) * fix #3441 * improvements * refactor * Fix #1726: expression in property access causes unexpected results (#4851) * fix #1726 * Explain what's happening, rather than just linking to an issue * Updated output * Optimization * Update output * remove casting to number * cleanup tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using for with a range and a step value CS is determining the iteration condition by its sign in a case when value is available, otherwise it will compare min and max values of the range definition.
I don't think it is the correct behaviour I would expect it to use the step value to determine its condition.
Example:
Negative step value with change the condition:
Unknown step value will not effect the condition of the loop in runtime:
In my case I can't see an additional if to be useful, when min > max and a step value is positive it will cause an infinite loop.
The text was updated successfully, but these errors were encountered: