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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 class Category { | 68 class Category { |
69 static final analysisOptionsError = new Category("AnalysisOptionsError"); | 69 static final analysisOptionsError = new Category("AnalysisOptionsError"); |
70 | 70 |
71 static final analysisOptionsWarning = new Category("AnalysisOptionsWarning"); | 71 static final analysisOptionsWarning = new Category("AnalysisOptionsWarning"); |
72 | 72 |
73 static final checkedModeCompileTimeError = | 73 static final checkedModeCompileTimeError = |
74 new Category("CheckedModeCompileTimeError"); | 74 new Category("CheckedModeCompileTimeError"); |
75 | 75 |
76 static final parserError = new Category("ParserError"); | 76 static final parserError = new Category("ParserError"); |
77 | 77 |
| 78 static final compileTimeError = new Category("CompileTimeError"); |
| 79 |
78 final String name; | 80 final String name; |
79 | 81 |
80 Category(this.name); | 82 Category(this.name); |
81 } | 83 } |
82 | 84 |
83 enum Platform { dart2js, analyzer, } | 85 enum Platform { dart2js, analyzer, } |
84 const dart2js = Platform.dart2js; | 86 const dart2js = Platform.dart2js; |
85 const analyzer = Platform.analyzer; | 87 const analyzer = Platform.analyzer; |
86 | 88 |
87 class Message { | 89 class Message { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 usedBy: [analyzer], | 396 usedBy: [analyzer], |
395 examples: const ["class A { class B {} } main() { new A(); }",]), | 397 examples: const ["class A { class B {} } main() { new A(); }",]), |
396 | 398 |
397 'CONSTRUCTOR_WITH_RETURN_TYPE': new Message( | 399 'CONSTRUCTOR_WITH_RETURN_TYPE': new Message( |
398 id: 'VOJBWY', | 400 id: 'VOJBWY', |
399 category: Category.parserError, | 401 category: Category.parserError, |
400 template: "Constructors can't have a return type", | 402 template: "Constructors can't have a return type", |
401 howToFix: "Try removing the return type.", | 403 howToFix: "Try removing the return type.", |
402 usedBy: [analyzer, dart2js], | 404 usedBy: [analyzer, dart2js], |
403 examples: const ["class A { int A() {} } main() { new A(); }",]), | 405 examples: const ["class A { int A() {} } main() { new A(); }",]), |
| 406 |
| 407 /** |
| 408 * 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. |
| 410 */ |
| 411 'RETURN_IN_GENERATIVE_CONSTRUCTOR': new Message( |
| 412 id: 'UOTDQH', |
| 413 category: Category.compileTimeError, |
| 414 template: "Constructors can't return values.", |
| 415 howToFix: |
| 416 "Try removing the return statement or using a factory constructor.", |
| 417 usedBy: [ |
| 418 analyzer, |
| 419 dart2js |
| 420 ], |
| 421 examples: const [ |
| 422 """ |
| 423 class C { |
| 424 C() { |
| 425 return 1; |
| 426 } |
| 427 } |
| 428 |
| 429 main() => new C();""" |
| 430 ]), |
| 431 |
| 432 /** |
| 433 * 13.12 Return: It is a compile-time error if a return statement of the form |
| 434 * <i>return e;</i> appears in a generator function. |
| 435 */ |
| 436 'RETURN_IN_GENERATOR': new Message( |
| 437 id: 'JRUTUQ', |
| 438 subId: 0, |
| 439 category: Category.compileTimeError, |
| 440 template: "Can't return a value from a generator function " |
| 441 "(using the '#{modifier}' modifier).", |
| 442 howToFix: "Try removing the value, replacing 'return' with 'yield' or" |
| 443 " changing the method body modifier", |
| 444 usedBy: [ |
| 445 analyzer, |
| 446 dart2js |
| 447 ], |
| 448 examples: const [ |
| 449 """ |
| 450 foo() async* { return 0; } |
| 451 main() => foo(); |
| 452 """, |
| 453 """ |
| 454 foo() sync* { return 0; } |
| 455 main() => foo(); |
| 456 """ |
| 457 ]), |
404 }; | 458 }; |
OLD | NEW |