* Disallow static fields named `constructor` in a class
- Disallowed static fields named `constructor` in a class (previously only non-static were disallowed)
- Updated the text for the error for one consolidated warning, for both static and non-static fields
- Added a test
- Updated an existing test in the `flow` test suite of the parser to reflect the parse error.
Strangely, the test used to pass and started failing when inlining the `isNonstaticConstructor` method, without any changes.
In that test, `constructor` was a field, so in theory it should never have passed.
Would appreciate some feedback on this, as I'm not 100% sure if this is somehow related to Flow
* Update test262 whitelist
* Add comment and fix && operator
Flow maybe types state;
> Maybe types accept the provided type as well as null or undefined. So ?number would mean number, null, or undefined.
So in this case, explicitly allow the type, null, or undefined in the
typescript definition.
Fixes#10403
* feat: v8intrinsic syntax plugin
Implement V8 Intrinsic Syntax Extension. Here we check the execution branch inside the parseSubscript to make sure the V8IntrinsicIdentifier is immediately followed by a call expression.
* feat: disable combining placeholders and v8intrisic
per https://github.com/babel/babel/issues/10104#issuecomment-506950969
* test: add more error cases
* refactor: parse v8 intrinsic in parseExprAtom
This approach is identical to V8’s implementation. Move the test cases as the behaviour changes.
* fix: plugin-name typo
* test: add yield-expression test case
* feat: require startsExpr on modulo for v8intrinsic
* perf: skip eof and braceR check as they must return false
* Print V8IntrinsicIdentifier
* feat: add v8intrinsic to parser typings
* Add generated type helpers
* fix: incorrect type definition
* fix: allow V8IntrinsicIdentifier to be callee
* ♻️ added condition to check for left and right of nullish coalescing operator and if any is a logical expression without a paren then throw an error
* 🐛 bugs fixed and test cases updated for babel parser
* ♻️ code comments added
* 🐛 spell error rectified
* ♻️ failing test updated
* 🐛 push tests after make build
* Skip nullish-coalescing flow precedence tests
They're now incorrect
* ♻️ error message updated, binop priority of other logical operators +1 from ?? and
* ♻️ increaed the binOp for in and instanceOf, added logic to print the brackets in an ?? && || expression, test cases added
* 🐛 failing test fixed and comments updated
* ♻️ new lines added between tests
* ♻️ basic tests for checking the binOp of instanceOf, in and relational operators to be equal added
* ♻️ new lines added in between tests
* fix: transform name capturing regex once
* refactor: early return when pattern contains only lookbehind
* chore: simplify test regex
* chore: run test on >=8.0.0
* Refactor trailing comment adjustment
Following up from https://github.com/babel/babel/pull/10369
- Unify the logic for adjusting trailing comments into a separate
function
- Use it for all three cases, which fixes a bug for ObjectExpressions
and CallExpressions
- Update tests to check for the fixed bug
* Fix tests
- Only modify trailingComments if necessary
- Update snapshots of a couple of affected tests
* Drop the underscore in adjustCommentsAfterTrailingComma_
* Handle ArrayPattern
* Handle ObjectPattern
* Handle import and export declarations
These have to be handled a bit differently, because the node is visited after the and before the declaration. So we intercept when we are going from the last specifier to the source node.
* Remove unnecessary check
* Retain trailing comments in array expressions
This is a proposed fix for https://github.com/babel/babel/issues/10368
with a simple test.
* Move lastElement in the block where it's used
* Test trailing comment after array expression
* Don't move comments after the array expression
* Retain trailing comment after the array expression