Commit Graph

6 Commits

Author SHA1 Message Date
Geoffrey Booth 9524159e68 Merge branch 'master' into 2
# Conflicts:
#	lib/coffee-script/lexer.js
#	lib/coffee-script/nodes.js
#	lib/coffee-script/optparse.js
#	lib/coffee-script/rewriter.js
#	lib/coffee-script/scope.js
#	lib/coffee-script/sourcemap.js
#	src/nodes.coffee
#	test/classes.coffee
#	test/comments.coffee
#	test/error_messages.coffee
2016-11-10 22:51:39 -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
Chris Connelly 663595ba94 Compile splats in arrays and function calls to ES2015 splats (#4353)
Rather than compiling splats to arrays built using `Array#concat`, splats
are now compiled directly to ES2015 splats, e.g.

    f foo, arguments..., bar

    [ foo, arguments..., bar ]

Which used to be compiled to:

    f.apply(null, [foo].concat(slice.call(arguments), [bar]));

    [foo].concat(slice.call(arguments), [bar]);

Is now compiled to:

    f(foo, ...arguments, bar);

    [ foo, ...arguments, bar ];
2016-11-06 08:30:04 -08:00
Simon Lydell 3db029f2c1 Make regexes always uncallable
No matter if they have interpolations or not.
2015-01-15 19:44:14 +01:00
Simon Lydell fce502ac98 Fix #3194: Make strings always uncallable
No matter if they have interpolations or not.
2015-01-14 21:27:24 +01:00
Jeremy Ashkenas 19849e66d4 renaming wordy test titles. 2011-04-23 13:35:15 -04:00