GetModeForUsageLocation implements compiler.AnyProgram interface.
(ctx context.Context, options compiler.EmitOptions)
| 201 | |
| 202 | // GetModeForUsageLocation implements compiler.AnyProgram interface. |
| 203 | func (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 |
| 232 | func (p *Program) collectSemanticDiagnosticsOfAffectedFiles(ctx context.Context, file *ast.SourceFile) { |
nothing calls this directly
no test coverage detected