| 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 { |
| 203 'main.dart': |
| 204 """ |
| 205 import 'dart:async'; // This imports a class Future. |
| 206 import 'future.dart'; |
| 207 |
| 208 void main() {}""", |
| 209 |
| 210 'future.dart': |
| 211 """ |
| 212 library future; |
| 213 |
| 214 class Future {}"""}, |
| 215 |
| 216 const { |
| 217 'main.dart': |
| 218 """ |
| 219 import 'future.dart'; |
| 220 import 'dart:async'; // This imports a class Future. |
| 221 |
| 222 void main() {}""", |
| 223 |
| 224 'future.dart': |
| 225 """ |
| 226 library future; |
| 227 |
| 228 class Future {}"""}, |
| 229 |
| 230 const { |
| 231 'main.dart': |
| 232 """ |
| 233 import 'export.dart'; |
| 234 import 'dart:async'; // This imports a class Future. |
| 235 |
| 236 void main() {}""", |
| 237 |
| 238 'future.dart': |
| 239 """ |
| 240 library future; |
| 241 |
| 242 class Future {}""", |
| 243 |
| 244 'export.dart': |
| 245 """ |
| 246 library export; |
| 247 |
| 248 export 'future.dart';"""}]); |
| 249 |
| 191 static const MessageKind DUPLICATE_EXPORT = const MessageKind( | 250 static const MessageKind DUPLICATE_EXPORT = const MessageKind( |
| 192 'Error: Duplicate export of "#{name}".'); | 251 'Error: Duplicate export of "#{name}".'); |
| 193 | 252 |
| 194 static const DualKind NOT_A_TYPE = const DualKind( | 253 static const DualKind NOT_A_TYPE = const DualKind( |
| 195 error: const MessageKind('Error: "#{node}" is not a type.'), | 254 error: const MessageKind('Error: "#{node}" is not a type.'), |
| 196 warning: const MessageKind('Warning: "#{node}" is not a type.')); | 255 warning: const MessageKind('Warning: "#{node}" is not a type.')); |
| 197 | 256 |
| 198 static const MessageKind NOT_A_PREFIX = const MessageKind( | 257 static const MessageKind NOT_A_PREFIX = const MessageKind( |
| 199 'Error: "#{node}" is not a prefix.'); | 258 'Error: "#{node}" is not a prefix.'); |
| 200 | 259 |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 | 1212 |
| 1154 class CompileTimeConstantError extends Diagnostic { | 1213 class CompileTimeConstantError extends Diagnostic { |
| 1155 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) | 1214 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) |
| 1156 : super(kind, arguments, terse); | 1215 : super(kind, arguments, terse); |
| 1157 } | 1216 } |
| 1158 | 1217 |
| 1159 class CompilationError extends Diagnostic { | 1218 class CompilationError extends Diagnostic { |
| 1160 CompilationError(MessageKind kind, Map arguments, bool terse) | 1219 CompilationError(MessageKind kind, Map arguments, bool terse) |
| 1161 : super(kind, arguments, terse); | 1220 : super(kind, arguments, terse); |
| 1162 } | 1221 } |
| OLD | NEW |