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

Side by Side Diff: pkg/front_end/lib/src/base/processed_options.dart

Issue 2977013002: Report messages instead of just printing. (Closed)
Patch Set: 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:front_end/compilation_error.dart'; 7 import 'package:front_end/compilation_error.dart';
8 import 'package:front_end/compiler_options.dart'; 8 import 'package:front_end/compiler_options.dart';
9 import 'package:front_end/file_system.dart'; 9 import 'package:front_end/file_system.dart';
10 import 'package:front_end/src/base/performace_logger.dart'; 10 import 'package:front_end/src/base/performace_logger.dart';
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 /// The logger to report compilation progress. 106 /// The logger to report compilation progress.
107 PerformanceLog get logger { 107 PerformanceLog get logger {
108 return _raw.logger; 108 return _raw.logger;
109 } 109 }
110 110
111 /// The byte storage to get and put serialized data. 111 /// The byte storage to get and put serialized data.
112 ByteStore get byteStore { 112 ByteStore get byteStore {
113 return _raw.byteStore; 113 return _raw.byteStore;
114 } 114 }
115 115
116 // TODO(sigmund,ahe): delete in favor of reportMessage.
117 void deprecated_reportError(String error) {
118 _raw.onError(new _StringMessage(error));
119 }
120
121 void reportMessage(LocatedMessage message) { 116 void reportMessage(LocatedMessage message) {
122 _raw.onError(new _CompilationMessage(message)); 117 _raw.onError(new _CompilationMessage(message));
123 } 118 }
124 119
125 void reportMessageWithoutLocation(Message message) => 120 void reportMessageWithoutLocation(Message message) =>
126 reportMessage(message.withLocation(null, -1)); 121 reportMessage(message.withLocation(null, -1));
127 122
128 /// Runs various validations checks on the input options. For instance, 123 /// Runs various validations checks on the input options. For instance,
129 /// if an option is a path to a file, it checks that the file exists. 124 /// if an option is a path to a file, it checks that the file exists.
130 Future<bool> validateOptions() async { 125 Future<bool> validateOptions() async {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 String get tip => original.tip; 362 String get tip => original.tip;
368 363
369 SourceSpan get span => 364 SourceSpan get span =>
370 new SourceLocation(original.charOffset, sourceUrl: original.uri) 365 new SourceLocation(original.charOffset, sourceUrl: original.uri)
371 .pointSpan(); 366 .pointSpan();
372 367
373 _CompilationMessage(this.original); 368 _CompilationMessage(this.original);
374 369
375 String toString() => message; 370 String toString() => message;
376 } 371 }
377
378 /// Wraps an error message as a [CompilationError] API.
379 class _StringMessage implements CompilationError {
380 final String message;
381 String get tip => null;
382 SourceSpan get span => null;
383
384 _StringMessage(this.message);
385
386 String toString() => message;
387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698