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

Function forEachTopLevelDeclaration

test/fixtures/snapshot/typescript.js:162595–162614  ·  view source on GitHub ↗
(statement, cb)

Source from the content-addressed store, hash-verified

162593 }
162594 }
162595 function forEachTopLevelDeclaration(statement, cb) {
162596 switch (statement.kind) {
162597 case 256 /* SyntaxKind.FunctionDeclaration */:
162598 case 257 /* SyntaxKind.ClassDeclaration */:
162599 case 261 /* SyntaxKind.ModuleDeclaration */:
162600 case 260 /* SyntaxKind.EnumDeclaration */:
162601 case 259 /* SyntaxKind.TypeAliasDeclaration */:
162602 case 258 /* SyntaxKind.InterfaceDeclaration */:
162603 case 265 /* SyntaxKind.ImportEqualsDeclaration */:
162604 return cb(statement);
162605 case 237 /* SyntaxKind.VariableStatement */:
162606 return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); });
162607 case 238 /* SyntaxKind.ExpressionStatement */: {
162608 var expression = statement.expression;
162609 return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */
162610 ? cb(statement)
162611 : undefined;
162612 }
162613 }
162614 }
162615 function forEachTopLevelDeclarationInBindingName(name, cb) {
162616 switch (name.kind) {
162617 case 79 /* SyntaxKind.Identifier */:

Callers 2

addExportsFunction · 0.85
getUsageInfoFunction · 0.85

Calls 2

cbFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…