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

Function checkDeclaration

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

checkDuplicateExportsMethod · 0.80
checkDeclarationMethod · 0.80

Tested by

no test coverage detected