* [parser] Allow plugins to extend ScopeHandler
* Directly extend Scope
* Don't use new.target to get the ScopeHandler
* [parser] Add TS enum support to the Scope
* Remove duplicated options in tests
* Fix
* Fix flow
* Rename tests
* Add tests
* Full typescript support in scope
* Remove BIND_SIMPLE_CATCH
SCOPE_SIMPLE_CATCH was used instead
* Export TS types
* Register function declarations
* Fix body-less functions and namespaces
1) Move this.scope.exit() for functions from parseFunctionBody to the callers.
Otherwise the scope of body-less functions was never closed.
Also, it is easier to track scope.exit() if it is near to scope.enter()
2) Register namespace ids for export
* Disallow redeclaration of enum with const enum
This PR fixes a bug in support of JSX pragma in Typescript (introduced in https://github.com/babel/babel/pull/9095).
We've noticed this bug while building a large codebase with webpack+babel+typescript. Some files from our projects are using `/** @jsx h*/` to use a custom function for JSX syntax; and some others are using the React syntax.
We've noticed that our react imports were being removed by babel because the plugin instance was being reused by `babel-loader` and webpack; and it was causing an error :
```
ReferenceError: React is not defined
```
This PR resets the `jsxPragma` being used to the initial value for each new file being processed.
I can't add a unit test for this bug because it requires processing 2 files (one with `/** @jsx something */` then one with the react syntax).
I've tested a build of this PR and it correctly fixes the issue for us.
* Fix super method call in private instance method calling overridden method
* Change return value in test fixtures
* Update tests to verify that overridden method is not called
This fixes an issue where destructuring assignments eligible for the "array unpacking" optimization would fail to compile when the array literal on the right-hand side of the expression contained holes.
Example input:
```js
[a, b] = [, 2];
; // Avoid completion record special case
```
The error message was `Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null`.
Now the above code compiles to:
```js
a = void 0;
b = 2;
;
```
This PR also adds a couple of related test cases that were missing, to ensure the change doesn't regress them:
* Normal assignment expression with unpacking
* Declaration with unpacking and a hole on RHS
* @babel/traverse: Fix NodePath.getData
Currently, if the obtained value is `false`, it will be replaced by the given default value, which is invalid. This makes sure that we only set the default value when the value is `undefined`, instead of falsy.
* Add test and fix object protoype
* Allow false as default value