MCPcopy Index your code
hub / github.com/nodejs/node / topLevelVisitor

Function topLevelVisitor

test/fixtures/snapshot/typescript.js:104694–104717  ·  view source on GitHub ↗

* Visits a node at the top level of the source file. * * @param node The node to visit.

(node)

Source from the content-addressed store, hash-verified

104692 * @param node The node to visit.
104693 */
104694 function topLevelVisitor(node) {
104695 switch (node.kind) {
104696 case 266 /* SyntaxKind.ImportDeclaration */:
104697 return visitImportDeclaration(node);
104698 case 265 /* SyntaxKind.ImportEqualsDeclaration */:
104699 return visitImportEqualsDeclaration(node);
104700 case 272 /* SyntaxKind.ExportDeclaration */:
104701 return visitExportDeclaration(node);
104702 case 271 /* SyntaxKind.ExportAssignment */:
104703 return visitExportAssignment(node);
104704 case 237 /* SyntaxKind.VariableStatement */:
104705 return visitVariableStatement(node);
104706 case 256 /* SyntaxKind.FunctionDeclaration */:
104707 return visitFunctionDeclaration(node);
104708 case 257 /* SyntaxKind.ClassDeclaration */:
104709 return visitClassDeclaration(node);
104710 case 352 /* SyntaxKind.MergeDeclarationMarker */:
104711 return visitMergeDeclarationMarker(node);
104712 case 353 /* SyntaxKind.EndOfDeclarationMarker */:
104713 return visitEndOfDeclarationMarker(node);
104714 default:
104715 return visitor(node);
104716 }
104717 }
104718 function visitorWorker(node, valueIsDiscarded) {
104719 // This visitor does not need to descend into the tree if there is no dynamic import, destructuring assignment, or update expression
104720 // as export/import statements are only transformed at the top level of a file.

Callers

nothing calls this directly

Calls 11

visitImportDeclarationFunction · 0.85
visitExportDeclarationFunction · 0.85
visitExportAssignmentFunction · 0.85
visitVariableStatementFunction · 0.85
visitFunctionDeclarationFunction · 0.85
visitClassDeclarationFunction · 0.85
topLevelNestedVisitorFunction · 0.85
visitorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…