MCPcopy Create free account
hub / github.com/babel/babel / parseBind

Function parseBind

packages/babel-parser/src/parser/expression.ts:942–965  ·  view source on GitHub ↗
(
    this: Parser,
    base: N.Expression,
    startLoc: Position,
    state: N.ParseSubscriptState,
  )

Source from the content-addressed store, hash-verified

940
941 // https://github.com/tc39/proposal-bind-operator#syntax
942 parseBind(
943 this: Parser,
944 base: N.Expression,
945 startLoc: Position,
946 state: N.ParseSubscriptState,
947 ): N.Expression {
948 const node = this.startNodeAt<N.BindExpression>(startLoc);
949 node.object = base;
950 this.next(); // eat '::'
951 const callee = this.parseNoCallExpr(base => {
952 throw this.raise(Errors.UnsupportedBindRHS, base);
953 });
954 if (callee.type === "Super" || callee.type === "Import") {
955 throw this.raise(Errors.UnsupportedBindRHS, callee);
956 }
957 node.callee = callee;
958
959 state.stop = true;
960 return this.parseSubscripts(
961 this.finishNode(node, "BindExpression"),
962 startLoc,
963 false,
964 );
965 }
966
967 // https://tc39.es/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead
968 // CoverCallExpressionAndAsyncArrowHead

Callers

nothing calls this directly

Calls 3

nextMethod · 0.80
parseSubscriptsMethod · 0.80
finishNodeMethod · 0.80

Tested by

no test coverage detected