Chromium Code Reviews| Index: pkg/front_end/lib/src/fasta/deprecated_problems.dart |
| diff --git a/pkg/front_end/lib/src/fasta/deprecated_problems.dart b/pkg/front_end/lib/src/fasta/deprecated_problems.dart |
| index 90897d9eeae9ec76da1194649b12facc80bcceed..6c6fad3be63bf3b3203d08941950c75d300c55a8 100644 |
| --- a/pkg/front_end/lib/src/fasta/deprecated_problems.dart |
| +++ b/pkg/front_end/lib/src/fasta/deprecated_problems.dart |
| @@ -11,9 +11,11 @@ import 'dart:convert' show JSON; |
| import 'dart:io' |
| show ContentType, HttpClient, HttpClientRequest, SocketException, stderr; |
| -import 'colors.dart' show red; |
| +import 'command_line_reporting.dart' show isFatal; |
| -import 'messages.dart' show errorsAreFatal, deprecated_format, isVerbose; |
| +import 'messages.dart' show LocatedMessage, isVerbose, templateUnspecified; |
| + |
| +import 'severity.dart' show Severity; |
| const String defaultServerAddress = "http://127.0.0.1:59410/"; |
| @@ -36,34 +38,12 @@ Uri firstSourceUri; |
| /// handled correctly, the user will never see a stack trace that says "user |
| /// error". |
| dynamic deprecated_inputError(Uri uri, int charOffset, Object error) { |
| - if (errorsAreFatal && isVerbose) { |
| + if (isFatal(Severity.error) && isVerbose) { |
| print(StackTrace.current); |
|
Siggi Cherem (dart-lang)
2017/07/13 21:05:56
do we still need this here?
I expect this will b
ahe
2017/07/14 10:01:07
Using --fatal=errors will stop compilation immedia
|
| } |
| throw new deprecated_InputError(uri, charOffset, error); |
| } |
| -String deprecated_printUnexpected(Uri uri, int charOffset, String message) { |
| - String formattedMessage = |
| - deprecated_formatUnexpected(uri, charOffset, message); |
| - if (errorsAreFatal) { |
| - print(formattedMessage); |
| - if (isVerbose) print(StackTrace.current); |
| - throw new deprecated_InputError(uri, charOffset, message); |
| - } |
| - print(formattedMessage); |
| - return formattedMessage; |
| -} |
| - |
| -String deprecated_formatUnexpected(Uri uri, int charOffset, String message) { |
| - return deprecated_format(uri, charOffset, colorError("Error: $message")); |
| -} |
| - |
| -String colorError(String message) { |
| - // TODO(ahe): Colors need to be optional. Doesn't work well in Emacs or on |
| - // Windows. |
| - return red(message); |
| -} |
| - |
| class deprecated_InputError { |
| final Uri uri; |
| @@ -76,8 +56,16 @@ class deprecated_InputError { |
| toString() => "deprecated_InputError: $error"; |
| - String deprecated_format() => |
| - deprecated_formatUnexpected(uri, charOffset, safeToString(error)); |
| + /// Converts [error] to a [LocatedMessage] using [templateUnspecified]. Using |
| + /// [templateUnspecified] is deprecated behavior. |
| + /// |
| + /// Static method to discourage use and requiring call-sites to include the |
| + /// text `deprecated_`. |
| + static LocatedMessage toMessage(deprecated_InputError error) { |
| + return templateUnspecified |
| + .withArguments(safeToString(error.error)) |
| + .withLocation(error.uri, error.charOffset); |
| + } |
| } |
| class Crash { |