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

View File

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