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

Unified Diff: dart/tests/compiler/dart2js/message_kind_helper.dart

Issue 246733004: Don't use fatal errors in message_kind_test.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/tests/compiler/dart2js/memory_compiler.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/compiler/dart2js/message_kind_helper.dart
diff --git a/dart/tests/compiler/dart2js/message_kind_helper.dart b/dart/tests/compiler/dart2js/message_kind_helper.dart
index 77426aac168c2946544d71b7037e3620c68a291d..6550d17d38871e179d8d6442099c688447749544 100644
--- a/dart/tests/compiler/dart2js/message_kind_helper.dart
+++ b/dart/tests/compiler/dart2js/message_kind_helper.dart
@@ -20,7 +20,8 @@ const String ESCAPE_REGEXP = r'[[\]{}()*+?.\\^$|]';
/// However, consider that a single concise diagnostic is easier to understand,
/// so try to change error reporting logic before adding an exception.
final Set<MessageKind> kindsWithExtraMessages = new Set<MessageKind>.from([
- // See http://dartbug.com/18361.
+ // If you add something here, please file a *new* bug report.
+ // See http://dartbug.com/18361:
MessageKind.CANNOT_EXTEND_MALFORMED,
MessageKind.CANNOT_IMPLEMENT_MALFORMED,
MessageKind.CANNOT_MIXIN,
@@ -30,16 +31,17 @@ final Set<MessageKind> kindsWithExtraMessages = new Set<MessageKind>.from([
MessageKind.FINAL_FUNCTION_TYPE_PARAMETER,
MessageKind.FORMAL_DECLARED_CONST,
MessageKind.FORMAL_DECLARED_STATIC,
+ MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT,
MessageKind.HEX_DIGIT_EXPECTED,
MessageKind.HIDDEN_IMPLICIT_IMPORT,
MessageKind.HIDDEN_IMPORT,
MessageKind.INHERIT_GETTER_AND_METHOD,
MessageKind.UNIMPLEMENTED_METHOD,
MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ MessageKind.UNMATCHED_TOKEN,
MessageKind.UNTERMINATED_STRING,
MessageKind.VAR_FUNCTION_TYPE_PARAMETER,
MessageKind.VOID_NOT_ALLOWED,
- MessageKind.UNMATCHED_TOKEN,
]);
/// Most messages can be tested without causing a fatal error. Add an exception
@@ -47,7 +49,7 @@ final Set<MessageKind> kindsWithExtraMessages = new Set<MessageKind>.from([
/// Try to avoid adding exceptions here; a fatal error causes the compiler to
/// stop before analyzing all input, and it isn't safe to reuse it.
final Set<MessageKind> kindsWithPendingClasses = new Set<MessageKind>.from([
- MessageKind.TYPEDEF_FORMAL_WITH_DEFAULT,
+ // If you add something here, please file a *new* bug report.
]);
/// Most messages can be tested without causing a fatal error. Add an exception
@@ -55,11 +57,8 @@ final Set<MessageKind> kindsWithPendingClasses = new Set<MessageKind>.from([
/// Try to avoid adding exceptions here; a fatal error causes the compiler to
/// stop before analyzing all input, and it isn't safe to reuse it.
final Set<MessageKind> kindsWithFatalErrors = new Set<MessageKind>.from([
- MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT,
+ // If you add something here, please file a *new* bug report.
MessageKind.HEX_DIGIT_EXPECTED,
- MessageKind.REDIRECTING_FACTORY_WITH_DEFAULT,
- MessageKind.REFERENCE_IN_INITIALIZATION,
- MessageKind.TYPEDEF_FORMAL_WITH_DEFAULT,
MessageKind.UNMATCHED_TOKEN,
MessageKind.UNTERMINATED_STRING,
]);
@@ -124,9 +123,8 @@ Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) {
throw 'Unexpected messages found.';
}
}
- cachedCompiler = compiler;
- Expect.isTrue(kindsWithFatalErrors.contains(kind) ||
- !compiler.compilerWasCancelled);
+ Expect.isTrue(!compiler.compilerWasCancelled ||
+ kindsWithFatalErrors.contains(kind));
bool pendingStuff = false;
for (var e in compiler.resolver.pendingClassesToBePostProcessed) {
@@ -141,14 +139,11 @@ Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) {
e, MessageKind.GENERIC,
{'text': 'Pending class to be resolved.'});
}
- if (pendingStuff) {
- if (!kindsWithPendingClasses.contains(kind)) {
- throw 'Stuff was pending';
- }
- cachedCompiler = null;
- } else if (compiler.compilerWasCancelled) {
- cachedCompiler = null;
- } else {
+ Expect.isTrue(!pendingStuff || kindsWithPendingClasses.contains(kind));
+
+ if (!pendingStuff && !compiler.compilerWasCancelled) {
+ // If there is pending stuff, or the compiler was cancelled, we
+ // shouldn't reuse the compiler.
cachedCompiler = compiler;
}
});
« no previous file with comments | « dart/tests/compiler/dart2js/memory_compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698