Adds a `var` declaration to the current VariableEnvironment NOTE: This is the equivalent of `transformContext.hoistVariableDeclaration` in Strada.
(name *ast.IdentifierNode)
| 162 | // |
| 163 | // NOTE: This is the equivalent of `transformContext.hoistVariableDeclaration` in Strada. |
| 164 | func (c *EmitContext) AddVariableDeclaration(name *ast.IdentifierNode) { |
| 165 | varDecl := c.Factory.NewVariableDeclaration(name, nil /*exclamationToken*/, nil /*typeNode*/, nil /*initializer*/) |
| 166 | c.SetEmitFlags(varDecl, EFNoNestedSourceMaps) |
| 167 | scope := c.varScopeStack.Peek() |
| 168 | scope.variables = append(scope.variables, varDecl) |
| 169 | if scope.flags&environmentFlagsInParameters != 0 { |
| 170 | scope.flags |= environmentFlagsVariablesHoistedInParameters |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | // Adds a hoisted function declaration to the current VariableEnvironment |
| 175 | // |
no test coverage detected