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 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
| 11 import 'package:compiler/src/compiler.dart' show Compiler; | 11 import 'package:compiler/src/compiler.dart' show Compiler; |
| 12 import 'package:compiler/src/diagnostics/messages.dart' | 12 import 'package:compiler/src/diagnostics/messages.dart' |
| 13 show MessageKind, MessageTemplate; | 13 show MessageKind, MessageTemplate; |
| 14 import 'package:compiler/compiler_new.dart' show Diagnostic; | 14 import 'package:compiler/compiler_new.dart' show Diagnostic; |
| 15 | 15 |
| 16 import 'memory_compiler.dart'; | 16 import 'memory_compiler.dart'; |
| 17 | 17 |
| 18 const String ESCAPE_REGEXP = r'[[\]{}()*+?.\\^$|]'; | 18 const String ESCAPE_REGEXP = r'[[\]{}()*+?.\\^$|]'; |
| 19 | 19 |
| 20 /// Most examples generate a single diagnostic. | 20 /// Most examples generate a single diagnostic. |
| 21 /// Add an exception here if a single diagnostic cannot be produced. | 21 /// Add an exception here if a single diagnostic cannot be produced. |
| 22 /// However, consider that a single concise diagnostic is easier to understand, | 22 /// However, consider that a single concise diagnostic is easier to understand, |
| 23 /// so try to change error reporting logic before adding an exception. | 23 /// so try to change error reporting logic before adding an exception. |
| 24 final Set<MessageKind> kindsWithExtraMessages = new Set<MessageKind>.from([ | 24 final Set<MessageKind> kindsWithExtraMessages = new Set<MessageKind>.from([ |
| 25 // If you add something here, please file a *new* bug report. | |
|
ahe
2017/01/28 00:33:33
Given that we're moving away from this front-end,
Johnni Winther
2017/01/30 09:04:39
Acknowledged.
| |
| 26 // See http://dartbug.com/18361: | 25 // See http://dartbug.com/18361: |
| 27 MessageKind.CANNOT_EXTEND_MALFORMED, | 26 MessageKind.CANNOT_EXTEND_MALFORMED, |
| 28 MessageKind.CANNOT_IMPLEMENT_MALFORMED, | 27 MessageKind.CANNOT_IMPLEMENT_MALFORMED, |
| 29 MessageKind.CANNOT_MIXIN, | 28 MessageKind.CANNOT_MIXIN, |
| 30 MessageKind.CANNOT_MIXIN_MALFORMED, | 29 MessageKind.CANNOT_MIXIN_MALFORMED, |
| 31 MessageKind.CANNOT_INSTANTIATE_ENUM, | 30 MessageKind.CANNOT_INSTANTIATE_ENUM, |
| 32 MessageKind.CYCLIC_TYPEDEF_ONE, | 31 MessageKind.CYCLIC_TYPEDEF_ONE, |
| 33 MessageKind.DUPLICATE_DEFINITION, | 32 MessageKind.DUPLICATE_DEFINITION, |
| 34 MessageKind.EQUAL_MAP_ENTRY_KEY, | 33 MessageKind.EQUAL_MAP_ENTRY_KEY, |
| 35 MessageKind.FINAL_FUNCTION_TYPE_PARAMETER, | 34 MessageKind.FINAL_FUNCTION_TYPE_PARAMETER, |
| 36 MessageKind.FORMAL_DECLARED_CONST, | 35 MessageKind.FORMAL_DECLARED_CONST, |
| 37 MessageKind.FORMAL_DECLARED_STATIC, | 36 MessageKind.FORMAL_DECLARED_STATIC, |
| 38 MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT, | 37 MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT, |
| 39 MessageKind.HIDDEN_IMPLICIT_IMPORT, | 38 MessageKind.HIDDEN_IMPLICIT_IMPORT, |
| 40 MessageKind.HIDDEN_IMPORT, | 39 MessageKind.HIDDEN_IMPORT, |
| 41 MessageKind.INHERIT_GETTER_AND_METHOD, | 40 MessageKind.INHERIT_GETTER_AND_METHOD, |
| 42 MessageKind.UNIMPLEMENTED_METHOD, | 41 MessageKind.UNIMPLEMENTED_METHOD, |
| 43 MessageKind.UNIMPLEMENTED_METHOD_ONE, | 42 MessageKind.UNIMPLEMENTED_METHOD_ONE, |
| 44 MessageKind.VAR_FUNCTION_TYPE_PARAMETER, | 43 MessageKind.VAR_FUNCTION_TYPE_PARAMETER, |
| 44 MessageKind.UNMATCHED_TOKEN, | |
|
ahe
2017/01/28 00:33:33
The message is repeated: first during diet parsing
| |
| 45 ]); | 45 ]); |
| 46 | 46 |
| 47 /// Most messages can be tested without causing a fatal error. Add an exception | 47 /// Most messages can be tested without causing a fatal error. Add an exception |
| 48 /// here if a fatal error is unavoidable and leads to pending classes. | 48 /// here if a fatal error is unavoidable and leads to pending classes. |
| 49 /// Try to avoid adding exceptions here; a fatal error causes the compiler to | 49 /// Try to avoid adding exceptions here; a fatal error causes the compiler to |
| 50 /// stop before analyzing all input, and it isn't safe to reuse it. | 50 /// stop before analyzing all input, and it isn't safe to reuse it. |
| 51 final Set<MessageKind> kindsWithPendingClasses = new Set<MessageKind>.from([ | 51 final Set<MessageKind> kindsWithPendingClasses = new Set<MessageKind>.from([ |
| 52 // If you add something here, please file a *new* bug report. | 52 // If you add something here, please file a *new* bug report. |
| 53 ]); | 53 ]); |
| 54 | 54 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |