Index: pkg/front_end/lib/src/fasta/messages.dart |
diff --git a/pkg/front_end/lib/src/fasta/messages.dart b/pkg/front_end/lib/src/fasta/messages.dart |
index 938fe4403193adc7f98edce1af9554b2931f6781..5f3f7675370c1275bfff116bfe65e58df400d0d9 100644 |
--- a/pkg/front_end/lib/src/fasta/messages.dart |
+++ b/pkg/front_end/lib/src/fasta/messages.dart |
@@ -14,6 +14,10 @@ import 'deprecated_problems.dart' show deprecated_InputError; |
import 'colors.dart' show cyan, magenta; |
+import 'fasta_codes.dart' show Message; |
+ |
+export 'fasta_codes.dart'; |
+ |
const bool hideWarnings = false; |
bool get errorsAreFatal => CompilerContext.current.options.errorsAreFatal; |
@@ -26,6 +30,28 @@ bool get isVerbose => CompilerContext.current.options.verbose; |
bool get hideNits => !isVerbose; |
+void warning(Message message, int charOffset, Uri uri) { |
+ if (hideWarnings) return; |
+ print(deprecated_format( |
+ uri, charOffset, colorWarning("Warning: ${message.message}"))); |
+ if (warningsAreFatal) { |
+ if (isVerbose) print(StackTrace.current); |
+ throw new deprecated_InputError( |
+ uri, charOffset, "Compilation aborted due to fatal warnings."); |
+ } |
+} |
+ |
+void nit(Message message, int charOffset, Uri uri) { |
+ if (hideNits) return; |
+ print( |
+ deprecated_format(uri, charOffset, colorNit("Nit: ${message.message}"))); |
+ if (nitsAreFatal) { |
+ if (isVerbose) print(StackTrace.current); |
+ throw new deprecated_InputError( |
+ uri, charOffset, "Compilation aborted due to fatal nits."); |
+ } |
+} |
+ |
void deprecated_warning(Uri uri, int charOffset, String message) { |
if (hideWarnings) return; |
print(deprecated_format(uri, charOffset, colorWarning("Warning: $message"))); |