| OLD | NEW |
| 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.messages; | 5 library fasta.messages; |
| 6 | 6 |
| 7 import 'dart:io' show exitCode; | 7 import 'dart:io' show exitCode; |
| 8 | 8 |
| 9 import 'package:kernel/ast.dart' show Library, Location, Program, TreeNode; | 9 import 'package:kernel/ast.dart' show Library, Location, Program, TreeNode; |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 if (hideNits) return; | 51 if (hideNits) return; |
| 52 print( | 52 print( |
| 53 deprecated_format(uri, charOffset, colorNit("Nit: ${message.message}"))); | 53 deprecated_format(uri, charOffset, colorNit("Nit: ${message.message}"))); |
| 54 if (nitsAreFatal) { | 54 if (nitsAreFatal) { |
| 55 if (isVerbose) print(StackTrace.current); | 55 if (isVerbose) print(StackTrace.current); |
| 56 throw new deprecated_InputError( | 56 throw new deprecated_InputError( |
| 57 uri, charOffset, "Compilation aborted due to fatal nits."); | 57 uri, charOffset, "Compilation aborted due to fatal nits."); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 void deprecated_warning(Uri uri, int charOffset, String message) { | |
| 62 if (hideWarnings) return; | |
| 63 print(deprecated_format(uri, charOffset, colorWarning("Warning: $message"))); | |
| 64 if (warningsAreFatal) { | |
| 65 if (isVerbose) print(StackTrace.current); | |
| 66 throw new deprecated_InputError( | |
| 67 uri, charOffset, "Compilation aborted due to fatal warnings."); | |
| 68 } | |
| 69 } | |
| 70 | |
| 71 String colorWarning(String message) { | 61 String colorWarning(String message) { |
| 72 // TODO(ahe): Colors need to be optional. Doesn't work well in Emacs or on | 62 // TODO(ahe): Colors need to be optional. Doesn't work well in Emacs or on |
| 73 // Windows. | 63 // Windows. |
| 74 return magenta(message); | 64 return magenta(message); |
| 75 } | 65 } |
| 76 | 66 |
| 77 String colorNit(String message) { | 67 String colorNit(String message) { |
| 78 // TODO(ahe): Colors need to be optional. Doesn't work well in Emacs or on | 68 // TODO(ahe): Colors need to be optional. Doesn't work well in Emacs or on |
| 79 // Windows. | 69 // Windows. |
| 80 return cyan(message); | 70 return cyan(message); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 program.libraries.clear(); | 123 program.libraries.clear(); |
| 134 parent.parent = null; | 124 parent.parent = null; |
| 135 return result; | 125 return result; |
| 136 } else { | 126 } else { |
| 137 return null; | 127 return null; |
| 138 } | 128 } |
| 139 } else { | 129 } else { |
| 140 return node.location; | 130 return node.location; |
| 141 } | 131 } |
| 142 } | 132 } |
| OLD | NEW |