* Support computed class property names (#4499)
** Depends on babel/babylon#121 **
* `babel-types`: Add `computed` field to `ClassProperty`
* `babel-plugin-transform-class-properties`: handle computed property names correctly
* `babel-generator`: add tests for class properties (computed/literal, static/instance)
* doc: Update babel-types with ClassProperty.computed
* chore(package): update babylon to v6.11.0
* babel-types: move ClassProperty.computed to be last builder arg
The filename options used by babylon is called `sourceFilename` and not `filename`. Therefore the option should be adjusted to be called `sourceFilename`.
* Flip default parameter template
YMMV, I saved ~10b on a 2kb library. Not noticeable at the small scale, by why not do it anyway?
I've (unscientifically) found that flipping the default parameter conditional yields better gzip results. I think this is due to the slightly longer string it can now repeatedly match:
```js
// old
var param = arguments.length <= 0 || void 0 === arguments[0] ? null : arguments[0]
--------------------------------------------------------------^
// new
var param = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null
------------------------------------------------------------------------^
```
Though it's entirely likely gzip will also choose up to the index of the arguments if you many default parameters at different indexes.
* Update tests
* Removed unnecessary 'return' statements.
Returning a 'Promise' value in 'promise.then()' makes promise chains.
Used memory and promises are not garbage collected
until finishing 'helpers.asyncToGenerator'.
* Update test
* Fix destructuring evaluation with call expressions
Do not optimize destructions with callExpressions, as the call
might change the value of a variable that we are assigning to.
Fixes#4054
* Also deopt on member expressions
members expressions might be getters who have side effects
* formatting
* fix `typeof Symbol.prototype`
Babel uses a helper function to return the correct value for `typeof
obj` when obj is a Symbol and support for Symbol has been polyfilled.
This function assumes that `obj.constructor === Symbol` implies `typeof
obj === 'symbol'`.
This isn't true when obj is `Symbol.prototype`. In that case (REPL from
node 6, the same holds in Firefox):
```
> Symbol.prototype.constructor === Symbol
true
> typeof Symbol.prototype
'object'
>
```
AFAICS, that's the only case where the assumption doesn't hold.
The test added by this patch fails only on node 0.10, as 0.12 already
has a native implementation of Symbol and the polyfill code doesn't run.
This caused a problem in core-js when it's compiled with babel (the
issue was isolated by @skozin here:
https://github.com/zloirock/core-js/issues/189#issuecomment-209864582).
* fix default exported classes without a name
This correctly requeues class without name so the es3 transform can
transform the default keyword.
* Replace phabricator issue number with github
* CLI: Only set options if different from default
Currently default values (like comments: true) will be set always for the transform.
This behaviour dos not allow for setting this options from babelrc as the default would always have precedence.
* Add new tests for comments
Also ensure that the babelrc in the fixture folder is copied over to the
working directory during tests
These tests are originally from Traceur, which does not fully support
ES2016.
See babel/babylon#106 for a rationale why these code blocks are not
valid ES2016.