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

Function saveStateAndInvoke

test/fixtures/snapshot/typescript.js:91641–91658  ·  view source on GitHub ↗

* Visits a node, saving and restoring state variables on the stack. * * @param node The node to visit.

(node, f)

Source from the content-addressed store, hash-verified

91639 * @param node The node to visit.
91640 */
91641 function saveStateAndInvoke(node, f) {
91642 // Save state
91643 var savedCurrentScope = currentLexicalScope;
91644 var savedCurrentNameScope = currentNameScope;
91645 var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
91646 var savedCurrentClassHasParameterProperties = currentClassHasParameterProperties;
91647 // Handle state changes before visiting a node.
91648 onBeforeVisitNode(node);
91649 var visited = f(node);
91650 // Restore state
91651 if (currentLexicalScope !== savedCurrentScope) {
91652 currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
91653 }
91654 currentLexicalScope = savedCurrentScope;
91655 currentNameScope = savedCurrentNameScope;
91656 currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
91657 return visited;
91658 }
91659 /**
91660 * Performs actions that should always occur immediately before visiting a node.
91661 *

Callers 6

transformSourceFileFunction · 0.85
visitorFunction · 0.85
sourceElementVisitorFunction · 0.85
namespaceElementVisitorFunction · 0.85
classElementVisitorFunction · 0.85
transformModuleBodyFunction · 0.85

Calls 2

onBeforeVisitNodeFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…