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

Method setSourceFile

internal/printer/printer.go:5030–5043  ·  view source on GitHub ↗
(sourceFile *ast.SourceFile)

Source from the content-addressed store, hash-verified

5028}
5029
5030func (p *Printer) setSourceFile(sourceFile *ast.SourceFile) {
5031 p.currentSourceFile = sourceFile
5032 p.uniqueHelperNames = nil
5033 p.externalHelpersModuleName = nil
5034 if sourceFile != nil {
5035 if p.emitContext.EmitFlags(p.emitContext.MostOriginal(sourceFile.AsNode()))&EFExternalHelpers != 0 {
5036 p.uniqueHelperNames = make(map[string]*ast.IdentifierNode)
5037 }
5038 p.externalHelpersModuleName = p.emitContext.GetExternalHelpersModuleName(sourceFile)
5039 p.setSourceMapSource(sourceFile)
5040 }
5041
5042 // !!!
5043}
5044
5045func (p *Printer) Write(node *ast.Node, sourceFile *ast.SourceFile, writer EmitTextWriter, sourceMapGenerator *sourcemap.Generator) {
5046 savedCurrentSourceFile := p.currentSourceFile

Callers 1

WriteMethod · 0.95

Calls 6

setSourceMapSourceMethod · 0.95
EmitFlagsMethod · 0.80
MostOriginalMethod · 0.80
AsNodeMethod · 0.65
makeFunction · 0.50

Tested by

no test coverage detected