MCPcopy
hub / github.com/microsoft/typescript-go / Emit

Method Emit

internal/printer/printer.go:5013–5024  ·  view source on GitHub ↗

General

(node *ast.Node, sourceFile *ast.SourceFile)

Source from the content-addressed store, hash-verified

5011//
5012
5013func (p *Printer) Emit(node *ast.Node, sourceFile *ast.SourceFile) string {
5014 // ensure a reusable writer
5015 if p.ownWriter == nil {
5016 p.ownWriter = NewTextWriter(p.Options.NewLine.GetNewLineCharacter(), 0)
5017 }
5018
5019 p.Write(node, sourceFile, p.ownWriter, nil /*sourceMapGenerator*/)
5020 text := p.ownWriter.String()
5021
5022 p.ownWriter.Clear()
5023 return text
5024}
5025
5026func (p *Printer) EmitSourceFile(sourceFile *ast.SourceFile) string {
5027 return p.Emit(sourceFile.AsNode(), sourceFile)

Callers 3

getJSDocParamAnnotationFunction · 0.95
EmitSourceFileMethod · 0.95
handlePrintNodeMethod · 0.95

Calls 5

WriteMethod · 0.95
NewTextWriterFunction · 0.85
GetNewLineCharacterMethod · 0.80
StringMethod · 0.65
ClearMethod · 0.65

Tested by

no test coverage detected