jashkenas--coffeescript/lib/coffee-script
Geoffrey Booth cbea7b5d1c [CS2] Fix handling of parameters that are complex (#4430)
* Add failing test per #4406

* If a parameter is a function call, define it in an expression within the function body

* Remove the space between `function` and `*` for generator functions, to follow usual ES idiom

* We can collapse `isCall` into `isComplex`

* Don’t need existence check here

* Correct destructured parameter default evaluation order with an incrementing variable (or more generally any complicated parameter that isComplex)

* Try to pull complex parameters out of the parameter list if their order of execution matters; but don’t pull _all_ complex parameters out of the parameter list, so that we don’t lose parameter default values

* Add lots of comments about node special properties

* Err on the side of caution in deciding whether a complex parameter is allowable in a function parameter list rather than the function body (there are lots more detections we could add to find additional “safe” parameters)

* Follow the ES and CS2 convention of assigning parameter default values only when undefined, not when null or undefined

* Along with arrays and empty objects, also let values whose bases are not complex be allowed in the function parameter list (like `obj.prop`)

* Better way to check for undefined parameters when declaring them in a function body

* Once we’ve put a complex parameter in the function body, all following complex parameters go into the function body; no need to create lots of exceptions of when to choose whether to put a complex param in the body

* Rename `isComplex` to `shouldCache` for clarity
2017-02-01 06:54:42 -08:00
..
browser.js Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
cake.js Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
coffee-script.js Merge branch 'master' of github.com:jashkenas/coffeescript into 2 2017-01-22 16:32:38 -08:00
command.js Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
grammar.js Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
helpers.js Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
index.js Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
lexer.js [CS2] Compile class constructors to ES2015 classes (#4354) 2017-01-12 21:55:30 -08:00
nodes.js [CS2] Fix handling of parameters that are complex (#4430) 2017-02-01 06:54:42 -08:00
optparse.js [CS2] Compile class constructors to ES2015 classes (#4354) 2017-01-12 21:55:30 -08:00
parser.js Merge branch 'master' of github.com:jashkenas/coffeescript into 2 2017-01-22 16:32:38 -08:00
register.js Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
repl.js Rebuild for 1.12.2 2016-12-15 21:28:24 -08:00
rewriter.js [CS2] Compile class constructors to ES2015 classes (#4354) 2017-01-12 21:55:30 -08:00
scope.js [CS2] Compile class constructors to ES2015 classes (#4354) 2017-01-12 21:55:30 -08:00
sourcemap.js [CS2] Fix handling of parameters that are complex (#4430) 2017-02-01 06:54:42 -08:00