OLD | NEW |
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/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 for (CollectedMessage message in messages) { | 117 for (CollectedMessage message in messages) { |
118 if (!messageFound && checkMessage(message)) { | 118 if (!messageFound && checkMessage(message)) { |
119 messageFound = true; | 119 messageFound = true; |
120 } else { | 120 } else { |
121 unexpectedMessages.add(message); | 121 unexpectedMessages.add(message); |
122 } | 122 } |
123 } | 123 } |
124 Expect.isTrue(messageFound, | 124 Expect.isTrue(messageFound, |
125 '${template.kind}} does not match any in\n ' | 125 '${template.kind}} does not match any in\n ' |
126 '${messages.join('\n ')}'); | 126 '${messages.join('\n ')}'); |
127 Expect.isFalse(compiler.reporter.hasCrashed); | 127 var reporter = compiler.reporter; |
| 128 Expect.isFalse(reporter.hasCrashed); |
128 if (!unexpectedMessages.isEmpty) { | 129 if (!unexpectedMessages.isEmpty) { |
129 for (CollectedMessage message in unexpectedMessages) { | 130 for (CollectedMessage message in unexpectedMessages) { |
130 print("Unexpected message: $message"); | 131 print("Unexpected message: $message"); |
131 } | 132 } |
132 if (!kindsWithExtraMessages.contains(template.kind)) { | 133 if (!kindsWithExtraMessages.contains(template.kind)) { |
133 // Try changing the error reporting logic before adding an exception | 134 // Try changing the error reporting logic before adding an exception |
134 // to [kindsWithExtraMessages]. | 135 // to [kindsWithExtraMessages]. |
135 throw 'Unexpected messages found.'; | 136 throw 'Unexpected messages found.'; |
136 } | 137 } |
137 } | 138 } |
(...skipping 15 matching lines...) Expand all Loading... |
153 kindsWithPendingClasses.contains(template)); | 154 kindsWithPendingClasses.contains(template)); |
154 | 155 |
155 if (!pendingStuff) { | 156 if (!pendingStuff) { |
156 // If there is pending stuff, or the compiler was cancelled, we | 157 // If there is pending stuff, or the compiler was cancelled, we |
157 // shouldn't reuse the compiler. | 158 // shouldn't reuse the compiler. |
158 cachedCompiler = compiler; | 159 cachedCompiler = compiler; |
159 } | 160 } |
160 }); | 161 }); |
161 }).then((_) => cachedCompiler); | 162 }).then((_) => cachedCompiler); |
162 } | 163 } |
OLD | NEW |