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

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

Issue 233353002: Complain if there are pending classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update expectations for parser tests 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/sdk/lib/_internal/compiler/implementation/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 32614015043413b3a9d2f757159889bb0edbfb9f..77426aac168c2946544d71b7037e3620c68a291d 100644
--- a/dart/tests/compiler/dart2js/message_kind_helper.dart
+++ b/dart/tests/compiler/dart2js/message_kind_helper.dart
@@ -42,6 +42,28 @@ final Set<MessageKind> kindsWithExtraMessages = new Set<MessageKind>.from([
MessageKind.UNMATCHED_TOKEN,
]);
+/// Most messages can be tested without causing a fatal error. Add an exception
+/// here if a fatal error is unavoidable and leads to pending classes.
+/// 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,
+]);
+
+/// Most messages can be tested without causing a fatal error. Add an exception
+/// here if a fatal error is unavoidable.
+/// 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,
+ MessageKind.HEX_DIGIT_EXPECTED,
+ MessageKind.REDIRECTING_FACTORY_WITH_DEFAULT,
+ MessageKind.REFERENCE_IN_INITIALIZATION,
+ MessageKind.TYPEDEF_FORMAL_WITH_DEFAULT,
+ MessageKind.UNMATCHED_TOKEN,
+ MessageKind.UNTERMINATED_STRING,
+]);
+
Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) {
Expect.isNotNull(kind.howToFix);
Expect.isFalse(kind.examples.isEmpty);
@@ -103,6 +125,32 @@ Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) {
}
}
cachedCompiler = compiler;
+ Expect.isTrue(kindsWithFatalErrors.contains(kind) ||
+ !compiler.compilerWasCancelled);
+
+ bool pendingStuff = false;
+ for (var e in compiler.resolver.pendingClassesToBePostProcessed) {
+ pendingStuff = true;
+ compiler.reportInfo(
+ e, MessageKind.GENERIC,
+ {'text': 'Pending class to be post-processed.'});
+ }
+ for (var e in compiler.resolver.pendingClassesToBeResolved) {
+ pendingStuff = true;
+ compiler.reportInfo(
+ 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 {
+ cachedCompiler = compiler;
+ }
});
}).then((_) => cachedCompiler);
}
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698