fix: add optional: false to chained optional call expression (#11814)

This commit is contained in:
Huáng Jùnliàng 2020-07-09 20:33:50 -04:00 committed by GitHub
parent f32d5debda
commit 02c8fd92bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 1 deletions

View File

@ -660,8 +660,10 @@ export default class ExpressionParser extends LValParser {
let node = this.startNodeAt(startPos, startLoc);
node.callee = base;
if (state.optionalChainMember) {
node.optional = optional;
}
if (optional) {
node.optional = true;
node.arguments = this.parseCallExpressionArguments(tt.parenR, false);
} else {
node.arguments = this.parseCallExpressionArguments(

View File

@ -39,6 +39,7 @@
"computed": false,
"optional": true
},
"optional": false,
"arguments": []
}
}

View File

@ -257,6 +257,7 @@
"computed": false,
"optional": false
},
"optional": false,
"arguments": [
{
"type": "NumericLiteral",
@ -303,6 +304,7 @@
"computed": false,
"optional": false
},
"optional": false,
"arguments": []
}
]

View File

@ -93,6 +93,7 @@
"computed": false,
"optional": true
},
"optional": false,
"arguments": []
}
}

View File

@ -99,6 +99,7 @@
"computed": false,
"optional": false
},
"optional": false,
"arguments": [
{
"type": "NumericLiteral",