* Starts a new lexical environment. Any existing hoisted variable or function declarations * are pushed onto a stack, and the related storage variables are reset.
()
| 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."); |
no test coverage detected
searching dependent graphs…