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

Side by Side Diff: dart/tests/compiler/dart2js/message_kind_helper.dart

Issue 848003002: Remove CompilerCancelledException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r42861 Created 5 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.test.message_kind_helper; 5 library dart2js.test.message_kind_helper;
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import 'package:compiler/src/dart2jslib.dart' show 10 import 'package:compiler/src/dart2jslib.dart' show
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 ]); 42 ]);
43 43
44 /// Most messages can be tested without causing a fatal error. Add an exception 44 /// Most messages can be tested without causing a fatal error. Add an exception
45 /// here if a fatal error is unavoidable and leads to pending classes. 45 /// here if a fatal error is unavoidable and leads to pending classes.
46 /// Try to avoid adding exceptions here; a fatal error causes the compiler to 46 /// Try to avoid adding exceptions here; a fatal error causes the compiler to
47 /// stop before analyzing all input, and it isn't safe to reuse it. 47 /// stop before analyzing all input, and it isn't safe to reuse it.
48 final Set<MessageKind> kindsWithPendingClasses = new Set<MessageKind>.from([ 48 final Set<MessageKind> kindsWithPendingClasses = new Set<MessageKind>.from([
49 // If you add something here, please file a *new* bug report. 49 // If you add something here, please file a *new* bug report.
50 ]); 50 ]);
51 51
52 /// Most messages can be tested without causing a fatal error. Add an exception
53 /// here if a fatal error is unavoidable.
54 /// Try to avoid adding exceptions here; a fatal error causes the compiler to
55 /// stop before analyzing all input, and it isn't safe to reuse it.
56 final Set<MessageKind> kindsWithFatalErrors = new Set<MessageKind>.from([
57 // If you add something here, please file a *new* bug report.
58 MessageKind.UNMATCHED_TOKEN,
59 MessageKind.UNTERMINATED_STRING,
60 ]);
61
62 Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) { 52 Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) {
63 Expect.isNotNull(kind.howToFix); 53 Expect.isNotNull(kind.howToFix);
64 Expect.isFalse(kind.examples.isEmpty); 54 Expect.isFalse(kind.examples.isEmpty);
65 55
66 return Future.forEach(kind.examples, (example) { 56 return Future.forEach(kind.examples, (example) {
67 if (example is String) { 57 if (example is String) {
68 example = {'main.dart': example}; 58 example = {'main.dart': example};
69 } else { 59 } else {
70 Expect.isTrue(example is Map, 60 Expect.isTrue(example is Map,
71 "Example must be either a String or a Map."); 61 "Example must be either a String or a Map.");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (!unexpectedMessages.isEmpty) { 103 if (!unexpectedMessages.isEmpty) {
114 for (String message in unexpectedMessages) { 104 for (String message in unexpectedMessages) {
115 print("Unexpected message: $message"); 105 print("Unexpected message: $message");
116 } 106 }
117 if (!kindsWithExtraMessages.contains(kind)) { 107 if (!kindsWithExtraMessages.contains(kind)) {
118 // Try changing the error reporting logic before adding an exception 108 // Try changing the error reporting logic before adding an exception
119 // to [kindsWithExtraMessages]. 109 // to [kindsWithExtraMessages].
120 throw 'Unexpected messages found.'; 110 throw 'Unexpected messages found.';
121 } 111 }
122 } 112 }
123 Expect.isTrue(!compiler.compilerWasCancelled ||
124 kindsWithFatalErrors.contains(kind));
125 113
126 bool pendingStuff = false; 114 bool pendingStuff = false;
127 for (var e in compiler.resolver.pendingClassesToBePostProcessed) { 115 for (var e in compiler.resolver.pendingClassesToBePostProcessed) {
128 pendingStuff = true; 116 pendingStuff = true;
129 compiler.reportInfo( 117 compiler.reportInfo(
130 e, MessageKind.GENERIC, 118 e, MessageKind.GENERIC,
131 {'text': 'Pending class to be post-processed.'}); 119 {'text': 'Pending class to be post-processed.'});
132 } 120 }
133 for (var e in compiler.resolver.pendingClassesToBeResolved) { 121 for (var e in compiler.resolver.pendingClassesToBeResolved) {
134 pendingStuff = true; 122 pendingStuff = true;
135 compiler.reportInfo( 123 compiler.reportInfo(
136 e, MessageKind.GENERIC, 124 e, MessageKind.GENERIC,
137 {'text': 'Pending class to be resolved.'}); 125 {'text': 'Pending class to be resolved.'});
138 } 126 }
139 Expect.isTrue(!pendingStuff || kindsWithPendingClasses.contains(kind)); 127 Expect.isTrue(!pendingStuff || kindsWithPendingClasses.contains(kind));
140 128
141 if (!pendingStuff && !compiler.compilerWasCancelled) { 129 if (!pendingStuff) {
142 // If there is pending stuff, or the compiler was cancelled, we 130 // If there is pending stuff, or the compiler was cancelled, we
143 // shouldn't reuse the compiler. 131 // shouldn't reuse the compiler.
144 cachedCompiler = compiler; 132 cachedCompiler = compiler;
145 } 133 }
146 }); 134 });
147 }).then((_) => cachedCompiler); 135 }).then((_) => cachedCompiler);
148 } 136 }
OLDNEW
« no previous file with comments | « dart/tests/compiler/dart2js/incremental/compile_all.dart ('k') | dart/tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698