Skip to content

Commit

Permalink
refactor: misc
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jul 23, 2020
1 parent 77bf6e8 commit 0621f12
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/babel-parser/src/parser/expression.js
Expand Up @@ -1133,6 +1133,8 @@ export default class ExpressionParser extends LValParser {
case tt.backQuote:
return this.parseTemplate(false);

// BindExpression[Yield]
// :: MemberExpression[?Yield]
case tt.doubleColon: {
node = this.startNode();
this.next();
Expand Down Expand Up @@ -1165,6 +1167,9 @@ export default class ExpressionParser extends LValParser {
return this.finishNode(node, "PipelinePrimaryTopicReference");
}

// https://tc39.es/proposal-private-fields-in-in
// RelationalExpression [In, Yield, Await]
// [+In] PrivateIdentifier in ShiftExpression[?Yield, ?Await]
const nextCh = this.input.codePointAt(this.state.end);
if (isIdentifierStart(nextCh) || nextCh === charCodes.backslash) {
const start = this.state.start;
Expand Down Expand Up @@ -1322,6 +1327,7 @@ export default class ExpressionParser extends LValParser {
node.meta = meta;

if (meta.name === "function" && propertyName === "sent") {
// https://github.com/tc39/proposal-function.sent#syntax-1
if (this.isContextual(propertyName)) {
this.expectPlugin("functionSent");
} else if (!this.hasPlugin("functionSent")) {
Expand All @@ -1346,6 +1352,7 @@ export default class ExpressionParser extends LValParser {
return this.finishNode(node, "MetaProperty");
}

// https://tc39.es/ecma262/#prod-ImportMeta
parseImportMetaProperty(node: N.MetaProperty): N.MetaProperty {
const id = this.createIdentifier(this.startNodeAtNode(node), "import");
this.expect(tt.dot);
Expand Down Expand Up @@ -1381,12 +1388,13 @@ export default class ExpressionParser extends LValParser {
return this.finishNode(node, type);
}

// https://tc39.es/ecma262/#prod-CoverParenthesizedExpressionAndArrowParameterList
parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression {
const startPos = this.state.start;
const startLoc = this.state.startLoc;

let val;
this.expect(tt.parenL);
this.next(); // eat `(`

const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
const oldYieldPos = this.state.yieldPos;
Expand Down

0 comments on commit 0621f12

Please sign in to comment.