MCPcopy Index your code
hub / github.com/microsoft/typescript-go / Emit

Method Emit

internal/execute/incremental/program.go:203–229  ·  view source on GitHub ↗

GetModeForUsageLocation implements compiler.AnyProgram interface.

(ctx context.Context, options compiler.EmitOptions)

Source from the content-addressed store, hash-verified

201
202// GetModeForUsageLocation implements compiler.AnyProgram interface.
203func (p *Program) Emit(ctx context.Context, options compiler.EmitOptions) *compiler.EmitResult {
204 p.panicIfNoProgram("Emit")
205
206 var result *compiler.EmitResult
207 if p.snapshot.options.NoEmit.IsTrue() {
208 result = &compiler.EmitResult{EmitSkipped: true}
209 } else {
210 result = compiler.HandleNoEmitOnError(ctx, p, options.TargetSourceFile)
211 if ctx.Err() != nil {
212 return nil
213 }
214 }
215 if result != nil {
216 if options.TargetSourceFile != nil {
217 return result
218 }
219
220 // Emit buildInfo and combine result
221 buildInfoResult := p.emitBuildInfo(ctx, options)
222 if buildInfoResult != nil {
223 result.Diagnostics = append(result.Diagnostics, buildInfoResult.Diagnostics...)
224 result.EmittedFiles = append(result.EmittedFiles, buildInfoResult.EmittedFiles...)
225 }
226 return result
227 }
228 return emitFiles(ctx, p, options, false)
229}
230
231// Handle affected files and cache the semantic diagnostics for all of them or the file asked for
232func (p *Program) collectSemanticDiagnosticsOfAffectedFiles(ctx context.Context, file *ast.SourceFile) {

Callers

nothing calls this directly

Calls 6

panicIfNoProgramMethod · 0.95
emitBuildInfoMethod · 0.95
HandleNoEmitOnErrorFunction · 0.92
emitFilesFunction · 0.85
IsTrueMethod · 0.80
appendFunction · 0.50

Tested by

no test coverage detected