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

Function parseVarId

packages/babel-parser/src/parser/statement.ts:1472–1493  ·  view source on GitHub ↗
(
    this: Parser,
    decl: Undone<N.VariableDeclarator>,
    kind: "var" | "let" | "const" | "using" | "await using",
  )

Source from the content-addressed store, hash-verified

1470 }
1471
1472 parseVarId(
1473 this: Parser,
1474 decl: Undone<N.VariableDeclarator>,
1475 kind: "var" | "let" | "const" | "using" | "await using",
1476 ): void {
1477 const id = this.parseBindingAtom();
1478 if (kind === "using" || kind === "await using") {
1479 if (id.type === "ArrayPattern" || id.type === "ObjectPattern") {
1480 this.raise(Errors.UsingDeclarationHasBindingPattern, id);
1481 }
1482 } else {
1483 if (id.type === "VoidPattern") {
1484 this.raise(Errors.UnexpectedVoidPattern, id);
1485 }
1486 }
1487 this.checkLVal(
1488 id,
1489 { type: "VariableDeclarator" },
1490 kind === "var" ? BindingFlag.TYPE_VAR : BindingFlag.TYPE_LEXICAL,
1491 );
1492 decl.id = id;
1493 }
1494
1495 // https://tc39.es/ecma262/#prod-AsyncFunctionExpression
1496 parseAsyncFunctionExpression(

Callers

nothing calls this directly

Calls 1

parseBindingAtomMethod · 0.45

Tested by

no test coverage detected