Commit Graph

22 Commits

Author SHA1 Message Date
Simon Lydell 996a171a4e Fix #3778: Make for loops more consistent
The following two lines might seem equivalent:

    for n in [1, 2, 3] by  a then a = 4; n
    for n in [1, 2, 3] by +a then a = 4; n

But they used not to be, because `+a` was cached into a `ref`, while the plain
`a` wasn’t. Now even simple identifiers are cached, making the two lines
equivalent as expected.
2015-02-03 19:05:07 +01:00
Simon Lydell a63009fccb Fix #3671: Allow step in optimized range comprehensions
Allow the `by c` part in `for [a..b] by c then`.

Continue disallowing a `when d` part, since it makes no sense having a guard
that isn't given access to anything that changes on every iteration.
2015-01-10 02:31:56 +01:00
xixixao bd6b4142fe Fix expansion in destructuring inside comprehensions 2014-01-24 18:20:45 +00:00
Nami-Doc b3ffd25339 Disallowed `for own in` 2013-05-26 00:29:26 +02:00
Jeremy Ashkenas 1818e74f42 Fixes #2525, #1187, #1208, #1758, and many more -- allow looping over an array downwards 2013-02-02 12:23:14 +11:00
Jeremy Ashkenas e433098eb2 Adding a test for #2273 2012-04-24 15:39:22 -04:00
Jeremy Ashkenas afdcdcfd54 Fixes #2273, reverts #643 -- no special variable treatment for loop variables. 2012-04-24 15:37:26 -04:00
Jeremy Ashkenas 4fc9a345bb Fixes #2274 -- allow @variables as loop variables 2012-04-24 12:21:47 -04:00
Michael Ficarra 28a1101b91 merging/improving @rolftimmermans fix/tests for #2007 2012-02-13 19:47:21 -05:00
Michael Ficarra fc0a169a9a fixes #1910: loop index should be mutable within a loop iteration and immutable between loop iterations 2011-12-21 14:06:34 -05:00
satyr 5bf8b422f8 nodes: added missing jump-guard in While::makeReturn, fixing #1850 2011-11-11 06:56:49 +09:00
satyr ad1bc1e0b8 closes #1669; loop results are now collected in the same way as auto-`return`s are generated 2011-09-07 12:13:23 +09:00
Michael Ficarra 56b2b02637 some cleanup, renaming temporary variable from `_by` to `_step` 2011-05-06 23:10:46 -04:00
Gerald Lewis ac46ede170 Fix for #1326 by value is uncached 2011-05-04 13:12:05 -04:00
Jann Horn 8b443b94ea added a test 2011-03-28 23:16:49 +02:00
Jeremy Ashkenas b994e235f3 test-ified comprehensions.coffee 2011-03-11 22:05:52 -05:00
Jeremy Ashkenas 9e2c75b548 removing over-hash-comment 2011-03-11 21:41:12 -05:00
Michael Ficarra 6421c865f5 finished reorganizing test suite 2011-01-03 04:17:00 -05:00
Michael Ficarra ccae9ea6a8 final waypoint; remaining files to be sorted:
* _test_existence.coffee
  * _test_pattern_matching.coffee
2011-01-01 23:35:05 -05:00
Michael Ficarra fb201976b8 test reorganization waypoint #2 2010-12-29 14:06:57 -05:00
Michael Ficarra dcfdd144d8 test reorganization waypoint 2010-12-29 00:48:54 -05:00
Michael Ficarra 0fd3ed593c adding new (empty) classifications for tests 2010-12-28 23:33:13 -05:00