Enable optional chaining by default in @babel/parser (#10817)

This commit is contained in:
jack
2019-12-04 19:10:42 -08:00
committed by Nicolò Ribaudo
parent 646409b23e
commit 5f807ae45b
48 changed files with 5 additions and 50 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,3 +0,0 @@
{
"throws": "This experimental syntax requires enabling the parser plugin: 'optionalChaining' (1:1)"
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["optionalChaining"]
}

View File

@@ -1,3 +1,3 @@
{
"plugins": ["jsx", "flow", "optionalChaining"]
"plugins": ["jsx", "flow"]
}

View File

@@ -1,3 +1,3 @@
{
"plugins": ["jsx", "flow", "optionalChaining"]
"plugins": ["jsx", "flow"]
}

View File

@@ -1,3 +1,3 @@
{
"plugins": ["jsx", "flow", "optionalChaining"]
"plugins": ["jsx", "flow"]
}

View File

@@ -1,4 +1,4 @@
{
"sourceType": "module",
"plugins": ["typescript", "optionalChaining"]
"plugins": ["typescript"]
}

View File

@@ -1,4 +1,4 @@
{
"plugins": ["optionalChaining", "v8intrinsic"],
"plugins": ["v8intrinsic"],
"throws": "Unexpected token (1:0)"
}