MCPcopy Create free account
hub / github.com/microsoft/typescript-go / AddLexicalDeclaration

Method AddLexicalDeclaration

internal/printer/emitcontext.go:237–242  ·  view source on GitHub ↗

Adds a `let` declaration to the current LexicalEnvironment.

(name *ast.IdentifierNode)

Source from the content-addressed store, hash-verified

235
236// Adds a `let` declaration to the current LexicalEnvironment.
237func (c *EmitContext) AddLexicalDeclaration(name *ast.IdentifierNode) {
238 varDecl := c.Factory.NewVariableDeclaration(name, nil /*exclamationToken*/, nil /*typeNode*/, nil /*initializer*/)
239 c.SetEmitFlags(varDecl, EFNoNestedSourceMaps)
240 scope := c.letScopeStack.Peek()
241 scope.variables = append(scope.variables, varDecl)
242}
243
244// Merges declarations produced by c.EndVariableEnvironment() or c.EndLexicalEnvironment() into a statement list
245func (c *EmitContext) MergeEnvironmentList(statements *ast.StatementList, declarations []*ast.Statement) *ast.StatementList {

Calls 4

SetEmitFlagsMethod · 0.95
PeekMethod · 0.80
appendFunction · 0.50

Tested by

no test coverage detected