Skip to content

Commit

Permalink
Enable optional chaining by default in @babel/parser (babel#10817)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackisherwood authored and nicolo-ribaudo committed Jan 10, 2020
1 parent 646409b commit 5f807ae
Show file tree
Hide file tree
Showing 48 changed files with 5 additions and 50 deletions.
1 change: 0 additions & 1 deletion packages/babel-parser/src/parser/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ export default class ExpressionParser extends LValParser {
}
let optional = false;
if (this.match(tt.questionDot)) {
this.expectPlugin("optionalChaining");
state.optionalChainMember = optional = true;
if (noCalls && this.lookaheadCharCode() === charCodes.leftParenthesis) {
state.stop = true;
Expand Down
1 change: 0 additions & 1 deletion packages/babel-parser/src/plugins/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -2801,7 +2801,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
subscriptState: N.ParseSubscriptState,
): N.Expression {
if (this.match(tt.questionDot) && this.isLookaheadRelational("<")) {
this.expectPlugin("optionalChaining");
subscriptState.optionalChainMember = true;
if (noCalls) {
subscriptState.stop = true;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["jsx", "flow", "optionalChaining"]
"plugins": ["jsx", "flow"]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["jsx", "flow", "optionalChaining"]
"plugins": ["jsx", "flow"]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["jsx", "flow", "optionalChaining"]
"plugins": ["jsx", "flow"]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"sourceType": "module",
"plugins": ["typescript", "optionalChaining"]
"plugins": ["typescript"]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"plugins": ["optionalChaining", "v8intrinsic"],
"plugins": ["v8intrinsic"],
"throws": "Unexpected token (1:0)"
}

0 comments on commit 5f807ae

Please sign in to comment.