1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
Commit graph

21 commits

Author SHA1 Message Date
Geoffrey Booth
88f2bf9fa5 Detect when from in a for loop declaration is an identifier (#4393)
* Try to detect when `from` in a `for` loop declaration is an identifier, not a keyword

* Handle destructured arrays

* from as a destructured, aliased object variable name in a for loop declaration
2016-12-06 12:29:02 -08:00
Geoffrey Booth
b3896d08e8 Add a for .. from .. loop for generators, see #4306, #3832 (#4355)
* Added support for for-from loop, see #3832

* for-from: remove extra newline and add support for ranges

* for-from: tidy up the lexer

* for-from: add support for patterns

* for-from: fix bad alignment

* for-from: add two more tests

* for-from: fix test "for-from loops over generators"

See explanation here: https://github.com/jashkenas/coffeescript/pull/4306#issuecomment-257066877

* for-from: delete leftover console.log

* Refactor the big `if` block in the lexer to be as minimal a change from `master` as we can get away with

* Cleanup to make more idiomatic, remove trailing whitespace, minor performance improvements

* for-from: move code from one file to another

* for-from: clean up whitespace

* for-from: lexer bikeshedding

* Move "own is not supported in for-from loops" test into error_messages.coffee; improve error message so that "own" is underlined

* Revert unnecessary changes, to minimize the lines of code modified by this PR
2016-11-07 23:40:01 -08:00
Simon Lydell
4ceb6a6818 Only allow yield return as a statement
Fixes #4097. Also happens to fix #4096. I also took the liberty to simplify the
error message for invalid use of `yield`.
2015-09-16 17:39:59 +02:00
Andreas Lubbe
c1a9cfa044 Add support for standalone yield
This breaks compatibility with
->
  yield for i in [1..3]
    i * 2
and
->
  yield
    i * 2

yield's behaviour now mirrors that of return in that it can be used stand alone as well as with expressions. Thus, it currently also inherits the above limitations.
2015-09-13 12:30:59 +02:00
Andreas Lubbe
84c125a71b yield now behaves as expected around 'this' - fixes https://github.com/jashkenas/coffeescript/issues/3882 2015-02-26 13:01:12 +01:00
Andreas Lubbe
b6012c4617 improved yield return test 2015-02-17 19:11:06 +01:00
Andreas Lubbe
feee6954a6 fixed yield return producing incorrect output when used outside of the last line 2015-02-17 19:11:06 +01:00
Andreas Lubbe
b362bd672c added a lot of ES6 generator tests 2015-02-15 20:35:22 +01:00
Andreas Lubbe
e3f6e19950 fixed being unable to use 'yield throw' 2015-02-15 19:01:00 +01:00
alubbe
5950d6328d added tests for yield in switch & for loop expressions 2014-11-21 23:14:53 +01:00
alubbe
dd5da7f5f2 implemented proper precedence for 'yield' 2014-10-13 03:32:02 +02:00
Anatoly Ressin
ec44aba71a Improved test readability + fixed integer divison 2014-10-12 22:32:02 +03:00
Anatoly Ressin
e8a4e93a72 Added failing test case for the yield precedence 2014-10-12 20:08:28 +03:00
Andreas Lubbe
efca2861a6 added tests for yield, yield from, yield return and yield in if statements 2014-09-06 17:25:44 +02:00
Andreas Lubbe
565d78f00b removed support for '->*" and '=>*' 2014-09-06 13:38:04 +02:00
Andreas Lubbe
25b1eee293 first attempt at including 'yield*' 2013-12-23 19:32:25 -08:00
Andreas Lubbe
dab4ae9416 '->*' and '=>*' now produce generators 2013-12-19 18:08:25 -08:00
Andreas Lubbe
56b04a58dc first attempt at using '->*" and '=>*' for generators 2013-12-19 14:21:14 -08:00
Andreas Lubbe
9d29a830df entire generator test file is now ignored if generators are not available 2013-11-30 12:26:32 -08:00
Andreas Lubbe
74a92db173 improved readability of generator test 2013-11-30 11:45:19 -08:00
Andreas Lubbe
f11ca9888f added a test for generators 2013-11-29 20:58:26 -08:00