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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if (!messageFound && checkMessage(message)) { | 106 if (!messageFound && checkMessage(message)) { |
107 messageFound = true; | 107 messageFound = true; |
108 } else { | 108 } else { |
109 unexpectedMessages.add(message); | 109 unexpectedMessages.add(message); |
110 } | 110 } |
111 } | 111 } |
112 Expect.isTrue( | 112 Expect.isTrue( |
113 messageFound, | 113 messageFound, |
114 '${template.kind}} does not match any in\n ' | 114 '${template.kind}} does not match any in\n ' |
115 '${messages.join('\n ')}'); | 115 '${messages.join('\n ')}'); |
116 var reporter = compiler.reporter; | 116 dynamic reporter = compiler.reporter; |
117 Expect.isFalse(reporter.hasCrashed); | 117 Expect.isFalse(reporter.hasCrashed); |
118 if (!unexpectedMessages.isEmpty) { | 118 if (!unexpectedMessages.isEmpty) { |
119 for (CollectedMessage message in unexpectedMessages) { | 119 for (CollectedMessage message in unexpectedMessages) { |
120 print("Unexpected message: $message"); | 120 print("Unexpected message: $message"); |
121 } | 121 } |
122 if (!kindsWithExtraMessages.contains(template.kind)) { | 122 if (!kindsWithExtraMessages.contains(template.kind)) { |
123 // Try changing the error reporting logic before adding an exception | 123 // Try changing the error reporting logic before adding an exception |
124 // to [kindsWithExtraMessages]. | 124 // to [kindsWithExtraMessages]. |
125 throw 'Unexpected messages found.'; | 125 throw 'Unexpected messages found.'; |
126 } | 126 } |
(...skipping 14 matching lines...) Expand all Loading... |
141 .isTrue(!pendingStuff || kindsWithPendingClasses.contains(template)); | 141 .isTrue(!pendingStuff || kindsWithPendingClasses.contains(template)); |
142 | 142 |
143 if (!pendingStuff) { | 143 if (!pendingStuff) { |
144 // If there is pending stuff, or the compiler was cancelled, we | 144 // If there is pending stuff, or the compiler was cancelled, we |
145 // shouldn't reuse the compiler. | 145 // shouldn't reuse the compiler. |
146 cachedCompiler = compiler; | 146 cachedCompiler = compiler; |
147 } | 147 } |
148 }); | 148 }); |
149 }).then((_) => cachedCompiler); | 149 }).then((_) => cachedCompiler); |
150 } | 150 } |
OLD | NEW |