mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
Update bazel_worker to onDiagnostic
Change-Id: If1e0f3977f9d70ae74cfb589aeddcb96ce1fafc1 Reviewed-on: https://dart-review.googlesource.com/c/78041 Commit-Queue: Peter von der Ahé <ahe@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
This commit is contained in:
parent
e502edf28b
commit
0a6d960d66
|
@ -9,19 +9,30 @@ import 'dart:async' show Future;
|
|||
|
||||
import 'package:kernel/target/targets.dart' show Target;
|
||||
|
||||
import '../api_prototype/file_system.dart';
|
||||
import '../base/processed_options.dart';
|
||||
import '../kernel_generator_impl.dart';
|
||||
import '../api_prototype/compiler_options.dart' show CompilerOptions;
|
||||
|
||||
import '../api_prototype/compiler_options.dart';
|
||||
import 'compiler_state.dart';
|
||||
import '../api_prototype/diagnostic_message.dart' show DiagnosticMessageHandler;
|
||||
|
||||
export 'compiler_state.dart';
|
||||
import '../api_prototype/file_system.dart' show FileSystem;
|
||||
|
||||
import '../base/processed_options.dart' show ProcessedOptions;
|
||||
|
||||
import '../fasta/kernel/utils.dart' show serializeComponent;
|
||||
|
||||
import '../kernel_generator_impl.dart' show generateKernel;
|
||||
|
||||
import 'compiler_state.dart' show InitializedCompilerState;
|
||||
|
||||
export '../api_prototype/diagnostic_message.dart' show DiagnosticMessage;
|
||||
|
||||
export '../api_prototype/standard_file_system.dart' show StandardFileSystem;
|
||||
export '../fasta/fasta_codes.dart' show FormattedMessage;
|
||||
|
||||
export '../api_prototype/terminal_color_support.dart'
|
||||
show printDiagnosticMessage;
|
||||
|
||||
export '../fasta/severity.dart' show Severity;
|
||||
import '../fasta/kernel/utils.dart' show serializeComponent;
|
||||
|
||||
export 'compiler_state.dart' show InitializedCompilerState;
|
||||
|
||||
Future<InitializedCompilerState> initializeCompiler(
|
||||
InitializedCompilerState oldState,
|
||||
|
@ -50,11 +61,11 @@ Future<InitializedCompilerState> initializeCompiler(
|
|||
}
|
||||
|
||||
Future<List<int>> compile(InitializedCompilerState compilerState,
|
||||
List<Uri> inputs, ProblemHandler problemHandler,
|
||||
List<Uri> inputs, DiagnosticMessageHandler diagnosticMessageHandler,
|
||||
{bool summaryOnly}) async {
|
||||
summaryOnly ??= true;
|
||||
CompilerOptions options = compilerState.options;
|
||||
options..onProblem = problemHandler;
|
||||
options..onDiagnostic = diagnosticMessageHandler;
|
||||
|
||||
ProcessedOptions processedOpts = compilerState.processedOpts;
|
||||
processedOpts.inputs.clear();
|
||||
|
|
|
@ -151,17 +151,13 @@ Future<bool> computeKernel(List<String> args,
|
|||
target,
|
||||
fileSystem);
|
||||
|
||||
void onProblem(fe.FormattedMessage message, severity,
|
||||
List<fe.FormattedMessage> context) {
|
||||
out.writeln(message.formatted);
|
||||
for (fe.FormattedMessage message in context) {
|
||||
out.writeln(message.formatted);
|
||||
}
|
||||
void onDiagnostic(fe.DiagnosticMessage message) {
|
||||
fe.printDiagnosticMessage(message, out.writeln);
|
||||
succeeded = false;
|
||||
}
|
||||
|
||||
var kernel =
|
||||
await fe.compile(state, sources, onProblem, summaryOnly: summaryOnly);
|
||||
await fe.compile(state, sources, onDiagnostic, summaryOnly: summaryOnly);
|
||||
|
||||
if (kernel != null) {
|
||||
var outputFile = new File(parsedArgs['output']);
|
||||
|
|
Loading…
Reference in a new issue