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

Function parseVarId

packages/babel-parser/src/parser/statement.ts:1469–1490  ·  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

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

Callers

nothing calls this directly

Calls 1

parseBindingAtomMethod · 0.45

Tested by

no test coverage detected