Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 const DONT_KNOW_HOW_TO_FIX = ""; | 7 const DONT_KNOW_HOW_TO_FIX = ""; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * The messages in this file should meet the following guide lines: | 10 * The messages in this file should meet the following guide lines: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 * 1. what is wrong, 2. why is it wrong, 3. how do I fix it. However, we | 68 * 1. what is wrong, 2. why is it wrong, 3. how do I fix it. However, we |
| 69 * combine the first two in [template] and the last in [howToFix]. | 69 * combine the first two in [template] and the last in [howToFix]. |
| 70 */ | 70 */ |
| 71 class MessageKind { | 71 class MessageKind { |
| 72 /// Should describe what is wrong and why. | 72 /// Should describe what is wrong and why. |
| 73 final String template; | 73 final String template; |
| 74 | 74 |
| 75 /// Should describe how to fix the problem. Elided when using --terse option. | 75 /// Should describe how to fix the problem. Elided when using --terse option. |
| 76 final String howToFix; | 76 final String howToFix; |
| 77 | 77 |
| 78 /// Examples will be checked by | 78 /** |
| 79 /// tests/compiler/dart2js/message_kind_test.dart. | 79 * Examples will be checked by |
| 80 final List<String> examples; | 80 * tests/compiler/dart2js/message_kind_test.dart. |
| 81 * | |
| 82 * An example is either a String containing the example source code or a Map | |
| 83 * from filenames to source code. In the latter case, the filename for the | |
| 84 * main library code must be 'main.dart'. | |
| 85 */ | |
| 86 final List examples; | |
| 81 | 87 |
| 82 const MessageKind(this.template, {this.howToFix, this.examples}); | 88 const MessageKind(this.template, {this.howToFix, this.examples}); |
| 83 | 89 |
| 84 /// Do not use this. It is here for legacy and debugging. It violates item 4 | 90 /// Do not use this. It is here for legacy and debugging. It violates item 4 |
| 85 /// above. | 91 /// above. |
| 86 static const MessageKind GENERIC = const MessageKind('#{text}'); | 92 static const MessageKind GENERIC = const MessageKind('#{text}'); |
| 87 | 93 |
| 88 static const DualKind NOT_ASSIGNABLE = const DualKind( | 94 static const DualKind NOT_ASSIGNABLE = const DualKind( |
| 89 error: const MessageKind( | 95 error: const MessageKind( |
| 90 'Error: "#{fromType}" is not assignable to "#{toType}".'), | 96 'Error: "#{fromType}" is not assignable to "#{toType}".'), |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 static const MessageKind DUPLICATE_DEFINITION = const MessageKind( | 187 static const MessageKind DUPLICATE_DEFINITION = const MessageKind( |
| 182 'Error: Duplicate definition of "#{name}".'); | 188 'Error: Duplicate definition of "#{name}".'); |
| 183 | 189 |
| 184 static const MessageKind EXISTING_DEFINITION = const MessageKind( | 190 static const MessageKind EXISTING_DEFINITION = const MessageKind( |
| 185 'Info: Existing definition of "#{name}".'); | 191 'Info: Existing definition of "#{name}".'); |
| 186 | 192 |
| 187 static const DualKind DUPLICATE_IMPORT = const DualKind( | 193 static const DualKind DUPLICATE_IMPORT = const DualKind( |
| 188 error: const MessageKind('Error: Duplicate import of "#{name}".'), | 194 error: const MessageKind('Error: Duplicate import of "#{name}".'), |
| 189 warning: const MessageKind('Warning: Duplicate import of "#{name}".')); | 195 warning: const MessageKind('Warning: Duplicate import of "#{name}".')); |
| 190 | 196 |
| 197 static const MessageKind HIDDEN_IMPORT = const MessageKind( | |
| 198 "Warning: '#{name}' from library '#{hiddenUri}' by '#{name}' " | |
| 199 "from library '#{hidingUri}'.", | |
| 200 howToFix: "Try adding 'hide #{name}' to the import of '#{hiddenUri}'.", | |
| 201 examples: const [ | |
| 202 const {'main.dart': """ | |
|
ahe
2013/09/17 10:47:18
I think these examples would be easier to read if
Johnni Winther
2013/09/18 06:14:11
Done.
| |
| 203 import 'dart:async'; // This imports a class Future. | |
| 204 import 'future.dart'; | |
| 205 | |
| 206 void main() {}""", 'future.dart': """ | |
|
ahe
2013/09/17 10:47:18
This is somewhat hard to read. Also, please add a
Johnni Winther
2013/09/18 06:14:11
Done.
| |
| 207 library future; | |
| 208 | |
| 209 class Future {}"""}, | |
| 210 const {'main.dart': """ | |
| 211 import 'future.dart'; | |
| 212 import 'dart:async'; // This imports a class Future. | |
| 213 | |
| 214 void main() {}""", 'future.dart': """ | |
| 215 library future; | |
| 216 | |
| 217 class Future {}"""}, | |
| 218 const {'main.dart': """ | |
| 219 import 'export.dart'; | |
| 220 import 'dart:async'; // This imports a class Future. | |
| 221 | |
| 222 void main() {}""", 'future.dart': """ | |
| 223 library future; | |
| 224 | |
| 225 class Future {}""", 'export.dart': """ | |
| 226 library export; | |
| 227 | |
| 228 export 'future.dart';"""}]); | |
| 229 | |
| 191 static const MessageKind DUPLICATE_EXPORT = const MessageKind( | 230 static const MessageKind DUPLICATE_EXPORT = const MessageKind( |
| 192 'Error: Duplicate export of "#{name}".'); | 231 'Error: Duplicate export of "#{name}".'); |
| 193 | 232 |
| 194 static const DualKind NOT_A_TYPE = const DualKind( | 233 static const DualKind NOT_A_TYPE = const DualKind( |
| 195 error: const MessageKind('Error: "#{node}" is not a type.'), | 234 error: const MessageKind('Error: "#{node}" is not a type.'), |
| 196 warning: const MessageKind('Warning: "#{node}" is not a type.')); | 235 warning: const MessageKind('Warning: "#{node}" is not a type.')); |
| 197 | 236 |
| 198 static const MessageKind NOT_A_PREFIX = const MessageKind( | 237 static const MessageKind NOT_A_PREFIX = const MessageKind( |
| 199 'Error: "#{node}" is not a prefix.'); | 238 'Error: "#{node}" is not a prefix.'); |
| 200 | 239 |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 | 1124 |
| 1086 class CompileTimeConstantError extends Diagnostic { | 1125 class CompileTimeConstantError extends Diagnostic { |
| 1087 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) | 1126 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) |
| 1088 : super(kind, arguments, terse); | 1127 : super(kind, arguments, terse); |
| 1089 } | 1128 } |
| 1090 | 1129 |
| 1091 class CompilationError extends Diagnostic { | 1130 class CompilationError extends Diagnostic { |
| 1092 CompilationError(MessageKind kind, Map arguments, bool terse) | 1131 CompilationError(MessageKind kind, Map arguments, bool terse) |
| 1093 : super(kind, arguments, terse); | 1132 : super(kind, arguments, terse); |
| 1094 } | 1133 } |
| OLD | NEW |