| OLD | NEW |
| 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 library fasta.problems; | 5 library fasta.problems; |
| 6 | 6 |
| 7 import 'compiler_context.dart' show CompilerContext; | 7 import 'compiler_context.dart' show CompilerContext; |
| 8 | 8 |
| 9 import 'messages.dart' | 9 import 'messages.dart' |
| 10 show | 10 show |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 /// and contain a short description that may help a developer debug the issue. | 23 /// and contain a short description that may help a developer debug the issue. |
| 24 /// This method should be called instead of using `throw`, as this allows us to | 24 /// This method should be called instead of using `throw`, as this allows us to |
| 25 /// ensure that there are no throws anywhere else in the codebase. | 25 /// ensure that there are no throws anywhere else in the codebase. |
| 26 /// | 26 /// |
| 27 /// Before printing the message, the string `"Internal error: "` is prepended. | 27 /// Before printing the message, the string `"Internal error: "` is prepended. |
| 28 dynamic internalProblem(Message message, int charOffset, Uri uri) { | 28 dynamic internalProblem(Message message, int charOffset, Uri uri) { |
| 29 throw CompilerContext.current | 29 throw CompilerContext.current |
| 30 .format(message.withLocation(uri, charOffset), Severity.internalProblem); | 30 .format(message.withLocation(uri, charOffset), Severity.internalProblem); |
| 31 } | 31 } |
| 32 | 32 |
| 33 dynamic unimplemented(String what, [int charOffset = -1, Uri uri = null]) { | 33 dynamic unimplemented(String what, int charOffset, Uri uri) { |
| 34 return internalProblem( | 34 return internalProblem( |
| 35 templateInternalProblemUnimplemented.withArguments(what), | 35 templateInternalProblemUnimplemented.withArguments(what), |
| 36 charOffset, | 36 charOffset, |
| 37 uri); | 37 uri); |
| 38 } | 38 } |
| 39 | 39 |
| 40 dynamic unhandled(String what, String where, int charOffset, Uri uri) { | 40 dynamic unhandled(String what, String where, int charOffset, Uri uri) { |
| 41 return internalProblem( | 41 return internalProblem( |
| 42 templateInternalProblemUnhandled.withArguments(what, where), | 42 templateInternalProblemUnhandled.withArguments(what, where), |
| 43 charOffset, | 43 charOffset, |
| 44 uri); | 44 uri); |
| 45 } | 45 } |
| 46 | 46 |
| 47 dynamic unexpected(String expected, String actual, int charOffset, Uri uri) { | 47 dynamic unexpected(String expected, String actual, int charOffset, Uri uri) { |
| 48 return internalProblem( | 48 return internalProblem( |
| 49 templateInternalProblemUnexpected.withArguments(expected, actual), | 49 templateInternalProblemUnexpected.withArguments(expected, actual), |
| 50 charOffset, | 50 charOffset, |
| 51 uri); | 51 uri); |
| 52 } | 52 } |
| 53 | 53 |
| 54 dynamic unsupported(String operation, int charOffset, Uri uri) { | 54 dynamic unsupported(String operation, int charOffset, Uri uri) { |
| 55 return internalProblem( | 55 return internalProblem( |
| 56 templateInternalProblemUnsupported.withArguments(operation), | 56 templateInternalProblemUnsupported.withArguments(operation), |
| 57 charOffset, | 57 charOffset, |
| 58 uri); | 58 uri); |
| 59 } | 59 } |
| OLD | NEW |