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

Function checkDeclaration

packages/babel-parser/src/parser/statement.ts:2762–2786  ·  view source on GitHub ↗
(
    node: N.Identifier | N.Pattern | N.RestElement | N.ObjectProperty,
  )

Source from the content-addressed store, hash-verified

2760 }
2761
2762 checkDeclaration(
2763 node: N.Identifier | N.Pattern | N.RestElement | N.ObjectProperty,
2764 ): void {
2765 if (node.type === "Identifier") {
2766 this.checkDuplicateExports(node, node.name);
2767 } else if (node.type === "ObjectPattern") {
2768 for (const prop of node.properties) {
2769 this.checkDeclaration(prop);
2770 }
2771 } else if (node.type === "ArrayPattern") {
2772 for (const elem of node.elements) {
2773 if (elem) {
2774 this.checkDeclaration(elem as N.Pattern | N.Identifier);
2775 }
2776 }
2777 } else if (node.type === "ObjectProperty") {
2778 this.checkDeclaration(node.value as N.Pattern | N.Identifier);
2779 } else if (node.type === "RestElement") {
2780 this.checkDeclaration(node.argument as N.Pattern | N.Identifier);
2781 } else if (node.type === "AssignmentPattern") {
2782 this.checkDeclaration(
2783 node.left as N.AssignmentPattern["left"] & (N.Pattern | N.Identifier),
2784 );
2785 }
2786 }
2787
2788 checkDuplicateExports(
2789 node: Undone<

Callers

nothing calls this directly

Calls 2

checkDuplicateExportsMethod · 0.80
checkDeclarationMethod · 0.80

Tested by

no test coverage detected