Chromium Code Reviews| 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 '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 MessageKind.FORMAL_DECLARED_STATIC, | 33 MessageKind.FORMAL_DECLARED_STATIC, |
| 34 MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT, | 34 MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT, |
| 35 MessageKind.HIDDEN_IMPLICIT_IMPORT, | 35 MessageKind.HIDDEN_IMPLICIT_IMPORT, |
| 36 MessageKind.HIDDEN_IMPORT, | 36 MessageKind.HIDDEN_IMPORT, |
| 37 MessageKind.INHERIT_GETTER_AND_METHOD, | 37 MessageKind.INHERIT_GETTER_AND_METHOD, |
| 38 MessageKind.UNIMPLEMENTED_METHOD, | 38 MessageKind.UNIMPLEMENTED_METHOD, |
| 39 MessageKind.UNIMPLEMENTED_METHOD_ONE, | 39 MessageKind.UNIMPLEMENTED_METHOD_ONE, |
| 40 MessageKind.VAR_FUNCTION_TYPE_PARAMETER, | 40 MessageKind.VAR_FUNCTION_TYPE_PARAMETER, |
| 41 MessageKind.VOID_NOT_ALLOWED, | 41 MessageKind.VOID_NOT_ALLOWED, |
| 42 | 42 |
| 43 MessageKind.HEX_DIGIT_EXPECTED, // http://dartbug.com/18574 | |
| 44 MessageKind.UNMATCHED_TOKEN, // http://dartbug.com/18574 | 43 MessageKind.UNMATCHED_TOKEN, // http://dartbug.com/18574 |
| 45 MessageKind.UNTERMINATED_COMMENT, // http://dartbug.com/18574 | 44 /// Hard to avoid for multiline strings; there is no case where a multiline |
| 46 MessageKind.UNTERMINATED_STRING, // http://dartbug.com/18574 | 45 /// string can be legitimately followed by EOM, so it is unavoidable that |
| 46 /// the parser will expect a token to follow. | |
| 47 MessageKind.UNTERMINATED_STRING, // hard to avoid for multiline strings | |
|
ahe
2014/06/23 14:28:49
Could you restore the bug number and remove the co
srawlins
2014/07/15 20:07:08
Done.
ahe
2014/07/16 07:54:18
What you have implemented is the same pattern as i
srawlins
2014/08/12 04:32:58
Somehow this sorted itself out in the last few wee
| |
| 47 ]); | 48 ]); |
| 48 | 49 |
| 49 /// Most messages can be tested without causing a fatal error. Add an exception | 50 /// Most messages can be tested without causing a fatal error. Add an exception |
| 50 /// here if a fatal error is unavoidable and leads to pending classes. | 51 /// here if a fatal error is unavoidable and leads to pending classes. |
| 51 /// Try to avoid adding exceptions here; a fatal error causes the compiler to | 52 /// Try to avoid adding exceptions here; a fatal error causes the compiler to |
| 52 /// stop before analyzing all input, and it isn't safe to reuse it. | 53 /// stop before analyzing all input, and it isn't safe to reuse it. |
| 53 final Set<MessageKind> kindsWithPendingClasses = new Set<MessageKind>.from([ | 54 final Set<MessageKind> kindsWithPendingClasses = new Set<MessageKind>.from([ |
| 54 // If you add something here, please file a *new* bug report. | 55 // If you add something here, please file a *new* bug report. |
| 55 ]); | 56 ]); |
| 56 | 57 |
| 57 /// Most messages can be tested without causing a fatal error. Add an exception | 58 /// Most messages can be tested without causing a fatal error. Add an exception |
| 58 /// here if a fatal error is unavoidable. | 59 /// here if a fatal error is unavoidable. |
| 59 /// Try to avoid adding exceptions here; a fatal error causes the compiler to | 60 /// Try to avoid adding exceptions here; a fatal error causes the compiler to |
| 60 /// stop before analyzing all input, and it isn't safe to reuse it. | 61 /// stop before analyzing all input, and it isn't safe to reuse it. |
| 61 final Set<MessageKind> kindsWithFatalErrors = new Set<MessageKind>.from([ | 62 final Set<MessageKind> kindsWithFatalErrors = new Set<MessageKind>.from([ |
| 62 // If you add something here, please file a *new* bug report. | 63 // If you add something here, please file a *new* bug report. |
| 63 MessageKind.HEX_DIGIT_EXPECTED, | |
| 64 MessageKind.UNMATCHED_TOKEN, | 64 MessageKind.UNMATCHED_TOKEN, |
| 65 MessageKind.UNTERMINATED_STRING, | 65 MessageKind.UNTERMINATED_STRING, |
| 66 ]); | 66 ]); |
| 67 | 67 |
| 68 Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) { | 68 Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) { |
| 69 Expect.isNotNull(kind.howToFix); | 69 Expect.isNotNull(kind.howToFix); |
| 70 Expect.isFalse(kind.examples.isEmpty); | 70 Expect.isFalse(kind.examples.isEmpty); |
| 71 | 71 |
| 72 return Future.forEach(kind.examples, (example) { | 72 return Future.forEach(kind.examples, (example) { |
| 73 if (example is String) { | 73 if (example is String) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 Expect.isTrue(!pendingStuff || kindsWithPendingClasses.contains(kind)); | 144 Expect.isTrue(!pendingStuff || kindsWithPendingClasses.contains(kind)); |
| 145 | 145 |
| 146 if (!pendingStuff && !compiler.compilerWasCancelled) { | 146 if (!pendingStuff && !compiler.compilerWasCancelled) { |
| 147 // If there is pending stuff, or the compiler was cancelled, we | 147 // If there is pending stuff, or the compiler was cancelled, we |
| 148 // shouldn't reuse the compiler. | 148 // shouldn't reuse the compiler. |
| 149 cachedCompiler = compiler; | 149 cachedCompiler = compiler; |
| 150 } | 150 } |
| 151 }); | 151 }); |
| 152 }).then((_) => cachedCompiler); | 152 }).then((_) => cachedCompiler); |
| 153 } | 153 } |
| OLD | NEW |