* 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.
* Fix class inheritance in IE9 & IE10 (T3041)
Internet Explorer 9&10 do not support __proto__ at all, don't have
Object.setPrototypeOf(), but have Object.getPrototypeOf().
Because of this setting the prototype is not possible, which makes the
babelHelpers.inherits() function to set __proto__ although not supported.
Afterwards Object.getPrototypeOf() is used, but this one is not
respecting the "custom" property __proto__ that we set.
The solution is to check for __proto__ first and afterwards fallback to
Object.getPrototypeOf().
* Do the same logic in babel-helper-replace-supers
* Fix tests
* Extract creation of prototype nodes to small helper