Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: pkg/front_end/lib/src/fasta/fasta.dart

Issue 2977013002: Report messages instead of just printing. (Closed)
Patch Set: Update expectations. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta; 5 library fasta;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:convert' show JSON; 9 import 'dart:convert' show JSON;
10 10
(...skipping 11 matching lines...) Expand all
22 22
23 import 'deprecated_problems.dart' 23 import 'deprecated_problems.dart'
24 show deprecated_InputError, deprecated_inputError; 24 show deprecated_InputError, deprecated_inputError;
25 25
26 import 'kernel/kernel_target.dart' show KernelTarget; 26 import 'kernel/kernel_target.dart' show KernelTarget;
27 27
28 import 'dill/dill_target.dart' show DillTarget; 28 import 'dill/dill_target.dart' show DillTarget;
29 29
30 import 'compile_platform.dart' show compilePlatformInternal; 30 import 'compile_platform.dart' show compilePlatformInternal;
31 31
32 import 'severity.dart' show Severity;
33
32 import 'ticker.dart' show Ticker; 34 import 'ticker.dart' show Ticker;
33 35
34 import 'uri_translator.dart' show UriTranslator; 36 import 'uri_translator.dart' show UriTranslator;
35 37
36 const bool summary = const bool.fromEnvironment("summary", defaultValue: false); 38 const bool summary = const bool.fromEnvironment("summary", defaultValue: false);
37 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); 39 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
38 40
39 compileEntryPoint(List<String> arguments) async { 41 compileEntryPoint(List<String> arguments) async {
40 // Timing results for each iteration 42 // Timing results for each iteration
41 List<double> elapsedTimes = <double>[]; 43 List<double> elapsedTimes = <double>[];
(...skipping 30 matching lines...) Expand all
72 (CompilerContext c) async { 74 (CompilerContext c) async {
73 if (c.options.verbose) { 75 if (c.options.verbose) {
74 print("Building outlines for ${arguments.join(' ')}"); 76 print("Building outlines for ${arguments.join(' ')}");
75 } 77 }
76 CompileTask task = 78 CompileTask task =
77 new CompileTask(c, new Ticker(isVerbose: c.options.verbose)); 79 new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
78 return await task.buildOutline(c.options.output); 80 return await task.buildOutline(c.options.output);
79 }); 81 });
80 } on deprecated_InputError catch (e) { 82 } on deprecated_InputError catch (e) {
81 exitCode = 1; 83 exitCode = 1;
82 print(e.deprecated_format()); 84 CompilerContext.current
85 .report(deprecated_InputError.toMessage(e), Severity.error);
83 return null; 86 return null;
84 } 87 }
85 } 88 }
86 89
87 Future<Uri> compile(List<String> arguments) async { 90 Future<Uri> compile(List<String> arguments) async {
88 try { 91 try {
89 return await CompilerCommandLine.withGlobalOptions("compile", arguments, 92 return await CompilerCommandLine.withGlobalOptions("compile", arguments,
90 (CompilerContext c) async { 93 (CompilerContext c) async {
91 if (c.options.verbose) { 94 if (c.options.verbose) {
92 print("Compiling directly to Kernel: ${arguments.join(' ')}"); 95 print("Compiling directly to Kernel: ${arguments.join(' ')}");
93 } 96 }
94 CompileTask task = 97 CompileTask task =
95 new CompileTask(c, new Ticker(isVerbose: c.options.verbose)); 98 new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
96 return await task.compile(); 99 return await task.compile();
97 }); 100 });
98 } on deprecated_InputError catch (e) { 101 } on deprecated_InputError catch (e) {
99 exitCode = 1; 102 exitCode = 1;
100 print(e.deprecated_format()); 103 CompilerContext.current
104 .report(deprecated_InputError.toMessage(e), Severity.error);
101 return null; 105 return null;
102 } 106 }
103 } 107 }
104 108
105 class CompileTask { 109 class CompileTask {
106 final CompilerContext c; 110 final CompilerContext c;
107 final Ticker ticker; 111 final Ticker ticker;
108 112
109 CompileTask(this.c, this.ticker); 113 CompileTask(this.c, this.ticker);
110 114
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 final BytesBuilder builder = new BytesBuilder(); 239 final BytesBuilder builder = new BytesBuilder();
236 240
237 void add(List<int> data) { 241 void add(List<int> data) {
238 builder.add(data); 242 builder.add(data);
239 } 243 }
240 244
241 void close() { 245 void close() {
242 // Nothing to do. 246 // Nothing to do.
243 } 247 }
244 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698