* Test Babel compiled using an old version of @babel/core
This should catch regressions where we use a new helper without a fallback
for older versions, or when we use a new @babel/traverse method.
* Enable the test
* Define default value for vars shadowing params
* Remove from package.json
* Only convert traverse the params if needed
This prevents this plugin from running after the destructuring
transform, which causes #11256
* Review
* Review
* Update packages/babel-plugin-transform-parameters/src/params.js [skip ci]
Co-Authored-By: Brian Ng <bng412@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
* Forbid async arrow functions after binary operator.
This commit makes Babel throw an error when parsing
code like "3 + async() => 2".
* Make atPossibleAsync more accurate
* Change atPossibleAsync to atPossibleAsyncArrow
Add an extra test to atPossibleAsync and refactor it to
atPossibleAsyncArrow. This also fixes a bug in the Typescript plugin,
so a new test has been added.
* Add test for async arrow after unary operator
* fix: parse value imports named type as values
* Address feedback
* Add plugin tests
* Add isContextual() check
* Remove importKind: value from extraneous nodes
* Ensure importKind is correct for more nodes
* Add additional test
* Address feedback
* Revert formatting
* Fix tests
* Memoize in loose mode when callee is a CallExpression
* Handle more complex OptionalCallExpressions where memoization is needed
* Convert calls to Function#call when member needs memoization
* Only update call context for member expressions
* Inject `__source` and `__self` in JSX elements earlier
This fixes an issue where `this` was not correct inside arrow functions, similar to
906f8be24d
* Add test
* Remove try-catch
* Update error
* Update fixtures
* Update windows fixtures
* Mark transpiled JSX elements as pure
* Avoid duble annotation
* Add "pure" option to the React preset
* Fix generator indentation
* Update tests
* Add tests for the "pure" option
* Update windows fixtures
* Allow rest/spread on polyfilled or builtin iterables when `Symbol` unsupported
Currently, when `Symbol` is not supported, we allow using rest/spread with:
- arrays
- strings
- arguments
With this PR, it will be also possible to use it with
- maps
- sets
- binary arrays
While in old browsers es6 builtins would still need to be polyfilled, it's way
easier to polyfill them because `Symbol` cannot be reliably polyfilled.
I didn't use `instanceof` becase:
- it doesn't work with polyfills not attatched to the global scope
- when using Babel to load polyfills, it would force the inclusion of `Map` and `Set` polyfills even if they are not used
Downside: the current approach of relying on `toString || construcor.name` doesn't work with subclasses.
* Don't use Array.from for array-like objects
* Add stricter Optional Chain node validation
Optional chains cannot start with `optional: false`. Somewhere in the `object`/`callee` tree, there must be an optional with `optional: true`.
* Print current node's type when finding an error.
* Extract for-of iterator handling to a helper
Dis greatly recudes the code size when for-of is used multiple times across the
codebase. Also, makes it easier to read what's happening in a compiled loop.
* Unify spec and loose code
* Legacy implementation fallback
* Update tmp var name
* Updates from review and after rebase