OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // An update to this file must be followed by regenerating the corresponding | 5 // An update to this file must be followed by regenerating the corresponding |
6 // json, dart2js and analyzer file. Use `publish.dart` in the bin directory. | 6 // json, dart2js and analyzer file. Use `publish.dart` in the bin directory. |
7 // | 7 // |
8 // Every message in this file must have an id. Use `message_id.dart` in the | 8 // Every message in this file must have an id. Use `message_id.dart` in the |
9 // bin directory to generate a fresh one. | 9 // bin directory to generate a fresh one. |
10 | 10 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 'subId': message.subId, | 145 'subId': message.subId, |
146 'category': message.category.name, | 146 'category': message.category.name, |
147 'template': message.template, | 147 'template': message.template, |
148 'templateHoleOrder': message.templateHoleOrder, | 148 'templateHoleOrder': message.templateHoleOrder, |
149 'howToFix': message.howToFix, | 149 'howToFix': message.howToFix, |
150 'options': message.options, | 150 'options': message.options, |
151 'usedBy': message.usedBy.map((platform) => platform.toString()).toList(), | 151 'usedBy': message.usedBy.map((platform) => platform.toString()).toList(), |
152 'examples': message.examples, | 152 'examples': message.examples, |
153 }; | 153 }; |
154 }); | 154 }); |
155 return JSON.encode(jsonified); | 155 return new JsonEncoder.withIndent(' ').convert(jsonified); |
156 } | 156 } |
157 | 157 |
158 final Map<String, Message> MESSAGES = { | 158 final Map<String, Message> MESSAGES = { |
159 'exampleMessage': new Message( | 159 'exampleMessage': new Message( |
160 id: 'use an Id generated by bin/message_id.dart', | 160 id: 'use an Id generated by bin/message_id.dart', |
161 category: Category.analysisOptionsError, | 161 category: Category.analysisOptionsError, |
162 template: "#use #named #arguments", | 162 template: "#use #named #arguments", |
163 templateHoleOrder: ["arguments", "named", "use"], | 163 templateHoleOrder: ["arguments", "named", "use"], |
164 howToFix: "an explanation on how to fix things", | 164 howToFix: "an explanation on how to fix things", |
165 examples: [ | 165 examples: [ |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 examples: const ["class A { class B {} } main() { new A(); }",]), | 397 examples: const ["class A { class B {} } main() { new A(); }",]), |
398 | 398 |
399 'CONSTRUCTOR_WITH_RETURN_TYPE': new Message( | 399 'CONSTRUCTOR_WITH_RETURN_TYPE': new Message( |
400 id: 'VOJBWY', | 400 id: 'VOJBWY', |
401 category: Category.parserError, | 401 category: Category.parserError, |
402 template: "Constructors can't have a return type", | 402 template: "Constructors can't have a return type", |
403 howToFix: "Try removing the return type.", | 403 howToFix: "Try removing the return type.", |
404 usedBy: [analyzer, dart2js], | 404 usedBy: [analyzer, dart2js], |
405 examples: const ["class A { int A() {} } main() { new A(); }",]), | 405 examples: const ["class A { int A() {} } main() { new A(); }",]), |
406 | 406 |
| 407 'MISSING_EXPRESSION_IN_THROW': new Message( |
| 408 id: 'FTGGMJ', |
| 409 subId: 0, |
| 410 category: Category.parserError, |
| 411 template: "Throw expressions must compute the object to be thrown.", |
| 412 howToFix: "Did you mean 'rethrow'?", |
| 413 usedBy: [ |
| 414 analyzer, |
| 415 dart2js |
| 416 ], |
| 417 examples: const [ |
| 418 'main() { throw; }', |
| 419 'main() { try { throw 0; } catch(e) { throw; } }' |
| 420 ]), |
| 421 |
| 422 /** |
| 423 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form |
| 424 * <i>rethrow;</i> is not enclosed within a on-catch clause. |
| 425 */ |
| 426 'RETHROW_OUTSIDE_CATCH': new Message( |
| 427 id: 'MWETLC', |
| 428 category: Category.compileTimeError, |
| 429 template: 'Rethrow must be inside of catch clause', |
| 430 howToFix: "Try moving the expression into a catch clause, or " |
| 431 "using a 'throw' expression.", |
| 432 usedBy: [analyzer, dart2js], |
| 433 examples: const ["main() { rethrow; }"]), |
| 434 |
407 /** | 435 /** |
408 * 13.12 Return: It is a compile-time error if a return statement of the form | 436 * 13.12 Return: It is a compile-time error if a return statement of the form |
409 * <i>return e;</i> appears in a generative constructor. | 437 * <i>return e;</i> appears in a generative constructor. |
410 */ | 438 */ |
411 'RETURN_IN_GENERATIVE_CONSTRUCTOR': new Message( | 439 'RETURN_IN_GENERATIVE_CONSTRUCTOR': new Message( |
412 id: 'UOTDQH', | 440 id: 'UOTDQH', |
413 category: Category.compileTimeError, | 441 category: Category.compileTimeError, |
414 template: "Constructors can't return values.", | 442 template: "Constructors can't return values.", |
415 howToFix: | 443 howToFix: |
416 "Try removing the return statement or using a factory constructor.", | 444 "Try removing the return statement or using a factory constructor.", |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 """ | 477 """ |
450 foo() async* { return 0; } | 478 foo() async* { return 0; } |
451 main() => foo(); | 479 main() => foo(); |
452 """, | 480 """, |
453 """ | 481 """ |
454 foo() sync* { return 0; } | 482 foo() sync* { return 0; } |
455 main() => foo(); | 483 main() => foo(); |
456 """ | 484 """ |
457 ]), | 485 ]), |
458 }; | 486 }; |
OLD | NEW |