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

Function onBeforeVisitNode

test/fixtures/snapshot/typescript.js:91664–91695  ·  view source on GitHub ↗

* Performs actions that should always occur immediately before visiting a node. * * @param node The node to visit.

(node)

Source from the content-addressed store, hash-verified

91662 * @param node The node to visit.
91663 */
91664 function onBeforeVisitNode(node) {
91665 switch (node.kind) {
91666 case 305 /* SyntaxKind.SourceFile */:
91667 case 263 /* SyntaxKind.CaseBlock */:
91668 case 262 /* SyntaxKind.ModuleBlock */:
91669 case 235 /* SyntaxKind.Block */:
91670 currentLexicalScope = node;
91671 currentNameScope = undefined;
91672 currentScopeFirstDeclarationsOfName = undefined;
91673 break;
91674 case 257 /* SyntaxKind.ClassDeclaration */:
91675 case 256 /* SyntaxKind.FunctionDeclaration */:
91676 if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) {
91677 break;
91678 }
91679 // Record these declarations provided that they have a name.
91680 if (node.name) {
91681 recordEmittedDeclarationInScope(node);
91682 }
91683 else {
91684 // These nodes should always have names unless they are default-exports;
91685 // however, class declaration parsing allows for undefined names, so syntactically invalid
91686 // programs may also have an undefined name.
91687 ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */));
91688 }
91689 if (ts.isClassDeclaration(node)) {
91690 // XXX: should probably also cover interfaces and type aliases that can have type variables?
91691 currentNameScope = node;
91692 }
91693 break;
91694 }
91695 }
91696 /**
91697 * General-purpose node visitor.
91698 *

Callers 1

saveStateAndInvokeFunction · 0.85

Calls 2

assertMethod · 0.80

Tested by

no test coverage detected