fix: add optional: false to MemberExpression (#11709)

This commit is contained in:
Huáng Jùnliàng 2020-06-11 18:26:26 -04:00 committed by GitHub
parent 3fba9710dc
commit b27abd39a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,6 +394,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
delete node.arguments; delete node.arguments;
// $FlowIgnore - callee isn't optional in the type definition // $FlowIgnore - callee isn't optional in the type definition
delete node.callee; delete node.callee;
} else if (node.type === "CallExpression") {
(node: N.Node).optional = false;
} }
return node; return node;
@ -434,4 +436,14 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return node; return node;
} }
parseSubscript(...args) {
const node = super.parseSubscript(...args);
if (node.type === "MemberExpression") {
node.optional = false;
}
return node;
}
}; };