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

Function startLexicalEnvironment

test/fixtures/snapshot/typescript.js:109776–109793  ·  view source on GitHub ↗

* Starts a new lexical environment. Any existing hoisted variable or function declarations * are pushed onto a stack, and the related storage variables are reset.

()

Source from the content-addressed store, hash-verified

109774 * are pushed onto a stack, and the related storage variables are reset.
109775 */
109776 function startLexicalEnvironment() {
109777 ts.Debug.assert(state > 0 /* TransformationState.Uninitialized */, "Cannot modify the lexical environment during initialization.");
109778 ts.Debug.assert(state < 2 /* TransformationState.Completed */, "Cannot modify the lexical environment after transformation has completed.");
109779 ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
109780 // Save the current lexical environment. Rather than resizing the array we adjust the
109781 // stack size variable. This allows us to reuse existing array slots we've
109782 // already allocated between transformations to avoid allocation and GC overhead during
109783 // transformation.
109784 lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;
109785 lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;
109786 lexicalEnvironmentStatementsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentStatements;
109787 lexicalEnvironmentFlagsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFlags;
109788 lexicalEnvironmentStackOffset++;
109789 lexicalEnvironmentVariableDeclarations = undefined;
109790 lexicalEnvironmentFunctionDeclarations = undefined;
109791 lexicalEnvironmentStatements = undefined;
109792 lexicalEnvironmentFlags = 0 /* LexicalEnvironmentFlags.None */;
109793 }
109794 /** Suspends the current lexical environment, usually after visiting a parameter list. */
109795 function suspendLexicalEnvironment() {
109796 ts.Debug.assert(state > 0 /* TransformationState.Uninitialized */, "Cannot modify the lexical environment during initialization.");

Callers 9

transformEnumBodyFunction · 0.85
transformModuleBodyFunction · 0.85
visitSourceFileFunction · 0.85
transformClassBodyFunction · 0.85
transformCommonJSModuleFunction · 0.85
createSystemModuleBodyFunction · 0.85

Calls 1

assertMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…