Ends the current EndLexicalEnvironment, returning a list of statements that should be emitted at the start of the current scope. NOTE: This is the equivalent of `transformContext.endLexicalEnvironment` in Strada. NOTE: This is *not* the same as `endLexicalEnvironment` in Strada as that method is in
()
| 195 | // NOTE: This is the equivalent of `transformContext.endLexicalEnvironment` in Strada. |
| 196 | // NOTE: This is *not* the same as `endLexicalEnvironment` in Strada as that method is incorrectly named. |
| 197 | func (c *EmitContext) EndLexicalEnvironment() []*ast.Statement { |
| 198 | scope := c.letScopeStack.Pop() |
| 199 | var statements []*ast.Statement |
| 200 | if len(scope.variables) > 0 { |
| 201 | varDeclList := c.Factory.NewVariableDeclarationList(c.Factory.NewNodeList(scope.variables), ast.NodeFlagsLet) |
| 202 | varStatement := c.Factory.NewVariableStatement(nil /*modifiers*/, varDeclList) |
| 203 | c.SetEmitFlags(varStatement, EFCustomPrologue) |
| 204 | statements = append(statements, varStatement) |
| 205 | } |
| 206 | return statements |
| 207 | } |
| 208 | |
| 209 | // Invokes c.EndLexicalEnvironment() and merges the results into `statements` |
| 210 | func (c *EmitContext) EndAndMergeLexicalEnvironmentList(statements *ast.StatementList) *ast.StatementList { |
no test coverage detected