Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Side by Side Diff: pkg/dart_messages/lib/shared_messages.dart

Issue 2751333002: Run dartfmt on dart_messages (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/dart_messages/bin/publish.dart ('k') | pkg/dart_messages/test/dart_messages_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 33
34 static final staticWarning = new Category("StaticWarning"); 34 static final staticWarning = new Category("StaticWarning");
35 35
36 static final hint = new Category("Hint"); 36 static final hint = new Category("Hint");
37 37
38 final String name; 38 final String name;
39 39
40 Category(this.name); 40 Category(this.name);
41 } 41 }
42 42
43 enum Platform { dart2js, analyzer, } 43 enum Platform {
44 dart2js,
45 analyzer,
46 }
44 const dart2js = Platform.dart2js; 47 const dart2js = Platform.dart2js;
45 const analyzer = Platform.analyzer; 48 const analyzer = Platform.analyzer;
46 49
47 class Message { 50 class Message {
48 /// Generic id for this message. 51 /// Generic id for this message.
49 /// 52 ///
50 /// This id should be shared by all errors that fall into the same category. 53 /// This id should be shared by all errors that fall into the same category.
51 /// In particular, we want errors of the same category to share the same 54 /// In particular, we want errors of the same category to share the same
52 /// explanation page, and want to disable warnings of the same category 55 /// explanation page, and want to disable warnings of the same category
53 /// with just one line. 56 /// with just one line.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 'CONST_ENUM': new Message( 265 'CONST_ENUM': new Message(
263 id: 'GRKIQE', 266 id: 'GRKIQE',
264 subId: 4, 267 subId: 4,
265 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the 268 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the
266 // example below triggers 'EXTRANEOUS_MODIFIER'. 269 // example below triggers 'EXTRANEOUS_MODIFIER'.
267 specializationOf: 'EXTRANEOUS_MODIFIER', 270 specializationOf: 'EXTRANEOUS_MODIFIER',
268 categories: [Category.parserError], 271 categories: [Category.parserError],
269 template: "Enums can't be declared to be 'const'.", 272 template: "Enums can't be declared to be 'const'.",
270 howToFix: "Try removing the 'const' keyword.", 273 howToFix: "Try removing the 'const' keyword.",
271 usedBy: [analyzer], 274 usedBy: [analyzer],
272 examples: const ["const enum Foo { x } main() {}",]), 275 examples: const [
276 "const enum Foo { x } main() {}",
277 ]),
273 278
274 'CONST_TYPEDEF': new Message( 279 'CONST_TYPEDEF': new Message(
275 id: 'GRKIQE', 280 id: 'GRKIQE',
276 subId: 5, 281 subId: 5,
277 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the 282 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the
278 // example below triggers 'EXTRANEOUS_MODIFIER'. 283 // example below triggers 'EXTRANEOUS_MODIFIER'.
279 specializationOf: 'EXTRANEOUS_MODIFIER', 284 specializationOf: 'EXTRANEOUS_MODIFIER',
280 categories: [Category.parserError], 285 categories: [Category.parserError],
281 template: "Type aliases can't be declared to be 'const'.", 286 template: "Type aliases can't be declared to be 'const'.",
282 howToFix: "Try removing the 'const' keyword.", 287 howToFix: "Try removing the 'const' keyword.",
283 usedBy: [analyzer], 288 usedBy: [analyzer],
284 examples: const ["const typedef void Foo(); main() {}",]), 289 examples: const [
290 "const typedef void Foo(); main() {}",
291 ]),
285 292
286 'CONST_AND_FINAL': new Message( 293 'CONST_AND_FINAL': new Message(
287 id: 'GRKIQE', 294 id: 'GRKIQE',
288 subId: 6, 295 subId: 6,
289 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the 296 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the
290 // example below triggers 'EXTRANEOUS_MODIFIER'. 297 // example below triggers 'EXTRANEOUS_MODIFIER'.
291 specializationOf: 'EXTRANEOUS_MODIFIER', 298 specializationOf: 'EXTRANEOUS_MODIFIER',
292 categories: [Category.parserError], 299 categories: [Category.parserError],
293 template: "Members can't be declared to be both 'const' and 'final'.", 300 template: "Members can't be declared to be both 'const' and 'final'.",
294 howToFix: "Try removing either the 'const' or 'final' keyword.", 301 howToFix: "Try removing either the 'const' or 'final' keyword.",
(...skipping 23 matching lines...) Expand all
318 ]), 325 ]),
319 326
320 'CLASS_IN_CLASS': new Message( 327 'CLASS_IN_CLASS': new Message(
321 // Dart2js currently reports this as an EXTRANEOUS_MODIFIER error. 328 // Dart2js currently reports this as an EXTRANEOUS_MODIFIER error.
322 // TODO(floitsch): make dart2js use this error instead. 329 // TODO(floitsch): make dart2js use this error instead.
323 id: 'DOTHQH', 330 id: 'DOTHQH',
324 categories: [Category.parserError], 331 categories: [Category.parserError],
325 template: "Classes can't be declared inside other classes.", 332 template: "Classes can't be declared inside other classes.",
326 howToFix: "Try moving the class to the top-level.", 333 howToFix: "Try moving the class to the top-level.",
327 usedBy: [analyzer], 334 usedBy: [analyzer],
328 examples: const ["class A { class B {} } main() { new A(); }",]), 335 examples: const [
336 "class A { class B {} } main() { new A(); }",
337 ]),
329 338
330 'CONSTRUCTOR_WITH_RETURN_TYPE': new Message( 339 'CONSTRUCTOR_WITH_RETURN_TYPE': new Message(
331 id: 'VOJBWY', 340 id: 'VOJBWY',
332 categories: [Category.parserError], 341 categories: [Category.parserError],
333 template: "Constructors can't have a return type.", 342 template: "Constructors can't have a return type.",
334 howToFix: "Try removing the return type.", 343 howToFix: "Try removing the return type.",
335 usedBy: [analyzer, dart2js], 344 usedBy: [analyzer, dart2js],
336 examples: const ["class A { int A() {} } main() { new A(); }",]), 345 examples: const [
346 "class A { int A() {} } main() { new A(); }",
347 ]),
337 348
338 'MISSING_EXPRESSION_IN_THROW': new Message( 349 'MISSING_EXPRESSION_IN_THROW': new Message(
339 id: 'FTGGMJ', 350 id: 'FTGGMJ',
340 subId: 0, 351 subId: 0,
341 categories: [Category.parserError], 352 categories: [Category.parserError],
342 template: "Missing expression after 'throw'.", 353 template: "Missing expression after 'throw'.",
343 howToFix: "Did you mean 'rethrow'?", 354 howToFix: "Did you mean 'rethrow'?",
344 usedBy: [analyzer, dart2js], 355 usedBy: [analyzer, dart2js],
345 examples: const [ 356 examples: const [
346 'main() { throw; }', 357 'main() { throw; }',
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 enum E { ONE } 581 enum E { ONE }
571 E e() { return E.TWO; } 582 E e() { return E.TWO; }
572 main() { e(); } 583 main() { e(); }
573 """ 584 """
574 ]), 585 ]),
575 586
576 'UNDEFINED_INSTANCE_GETTER_BUT_SETTER': new Message( 587 'UNDEFINED_INSTANCE_GETTER_BUT_SETTER': new Message(
577 id: 'ERUSKD', 588 id: 'ERUSKD',
578 subId: 5, 589 subId: 5,
579 specializationOf: 'UNDEFINED_GETTER', 590 specializationOf: 'UNDEFINED_GETTER',
580 categories: [Category.staticTypeWarning,], 591 categories: [
592 Category.staticTypeWarning,
593 ],
581 template: "The setter '#{memberName}' in class '#{className}' can" 594 template: "The setter '#{memberName}' in class '#{className}' can"
582 " not be used as a getter.", 595 " not be used as a getter.",
583 usedBy: [dart2js], 596 usedBy: [dart2js],
584 examples: const ["class A { set x(y) {} } main() { new A().x; }",]), 597 examples: const [
598 "class A { set x(y) {} } main() { new A().x; }",
599 ]),
585 600
586 /** 601 /**
587 * 12.18 Assignment: Evaluation of an assignment of the form 602 * 12.18 Assignment: Evaluation of an assignment of the form
588 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is 603 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is
589 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); 604 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e);
590 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, 605 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>,
591 * <i>e<sub>2</sub></i>). 606 * <i>e<sub>2</sub></i>).
592 * 607 *
593 * 12.29 Assignable Expressions: An assignable expression of the form 608 * 12.29 Assignable Expressions: An assignable expression of the form
594 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method 609 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method
595 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument 610 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument
596 * <i>e<sub>2</sub></i>. 611 * <i>e<sub>2</sub></i>.
597 * 612 *
598 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. 613 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>.
599 * It is a static type warning if <i>T</i> does not have an accessible 614 * It is a static type warning if <i>T</i> does not have an accessible
600 * instance member named <i>m</i>. 615 * instance member named <i>m</i>.
601 */ 616 */
602 'UNDEFINED_OPERATOR': new Message( 617 'UNDEFINED_OPERATOR': new Message(
603 id: 'ERUSKD', 618 id: 'ERUSKD',
604 subId: 6, 619 subId: 6,
605 categories: [Category.staticTypeWarning, Category.hint], 620 categories: [Category.staticTypeWarning, Category.hint],
606 template: "The operator '#{memberName}' is not defined for the " 621 template: "The operator '#{memberName}' is not defined for the "
607 "class '#{className}'.", 622 "class '#{className}'.",
608 usedBy: [dart2js, analyzer], 623 usedBy: [dart2js, analyzer],
609 examples: const ["class A {} main() { new A() + 3; }",]), 624 examples: const [
625 "class A {} main() { new A() + 3; }",
626 ]),
610 627
611 /** 628 /**
612 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. 629 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
613 * It is a static type warning if <i>T</i> does not have an accessible 630 * It is a static type warning if <i>T</i> does not have an accessible
614 * instance setter named <i>v=</i>. 631 * instance setter named <i>v=</i>.
615 * 632 *
616 * 12.18 Assignment: It is as static warning if an assignment of the form 633 * 12.18 Assignment: It is as static warning if an assignment of the form
617 * <i>v = e</i> occurs inside a top level or static function (be it function, 634 * <i>v = e</i> occurs inside a top level or static function (be it function,
618 * method, getter, or setter) or variable initializer and there is no 635 * method, getter, or setter) or variable initializer and there is no
619 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the 636 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the
620 * assignment. 637 * assignment.
621 * 638 *
622 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in 639 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in
623 * the enclosing lexical scope of the assignment, or if <i>C</i> does not 640 * the enclosing lexical scope of the assignment, or if <i>C</i> does not
624 * declare, implicitly or explicitly, a setter <i>v=</i>. 641 * declare, implicitly or explicitly, a setter <i>v=</i>.
625 */ 642 */
626 'UNDEFINED_SETTER': new Message( 643 'UNDEFINED_SETTER': new Message(
627 id: 'ERUSKD', 644 id: 'ERUSKD',
628 subId: 7, 645 subId: 7,
629 categories: [ 646 categories: [
630 Category.staticTypeWarning, 647 Category.staticTypeWarning,
631 Category.staticWarning, 648 Category.staticWarning,
632 Category.hint 649 Category.hint
633 ], 650 ],
634 template: "The setter '#{memberName}' is not defined for the " 651 template: "The setter '#{memberName}' is not defined for the "
635 "class '#{className}'.", 652 "class '#{className}'.",
636 usedBy: [dart2js, analyzer], 653 usedBy: [dart2js, analyzer],
637 // TODO(eernst): When this.x access is available, add examples here, 654 // TODO(eernst): When this.x access is available, add examples here,
638 // e.g., "class A { var x; A(this.x) : x = 3; } main() => new A(2);" 655 // e.g., "class A { var x; A(this.x) : x = 3; } main() => new A(2);"
639 examples: const ["class A {} main() { new A().x = 499; }",]), 656 examples: const [
657 "class A {} main() { new A().x = 499; }",
658 ]),
640 659
641 'NO_SUCH_SUPER_MEMBER': new Message( 660 'NO_SUCH_SUPER_MEMBER': new Message(
642 id: 'ERUSKD', 661 id: 'ERUSKD',
643 subId: 8, 662 subId: 8,
644 categories: [Category.staticTypeWarning], 663 categories: [Category.staticTypeWarning],
645 template: 664 template:
646 "Can't resolve '#{memberName}' in a superclass of '#{className}'.", 665 "Can't resolve '#{memberName}' in a superclass of '#{className}'.",
647 usedBy: [dart2js]), 666 usedBy: [dart2js]),
648 667
649 /** 668 /**
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 * the enclosing lexical scope of the assignment, or if <i>C</i> does not 765 * the enclosing lexical scope of the assignment, or if <i>C</i> does not
747 * declare, implicitly or explicitly, a setter <i>v=</i>. 766 * declare, implicitly or explicitly, a setter <i>v=</i>.
748 767
749 */ 768 */
750 'UNDEFINED_SUPER_SETTER': new Message( 769 'UNDEFINED_SUPER_SETTER': new Message(
751 id: 'ERUSKD', 770 id: 'ERUSKD',
752 subId: 12, 771 subId: 12,
753 categories: [Category.staticTypeWarning, Category.staticWarning], 772 categories: [Category.staticTypeWarning, Category.staticWarning],
754 template: "The setter '#{memberName}' is not defined in a superclass " 773 template: "The setter '#{memberName}' is not defined in a superclass "
755 "of '#{className}'.", 774 "of '#{className}'.",
756 usedBy: [analyzer, dart2js,], 775 usedBy: [
776 analyzer,
777 dart2js,
778 ],
757 examples: const [ 779 examples: const [
758 """ 780 """
759 class A {} 781 class A {}
760 class B extends A { 782 class B extends A {
761 foo() { super.x = 499; } 783 foo() { super.x = 499; }
762 } 784 }
763 main() { new B().foo(); } 785 main() { new B().foo(); }
764 """, 786 """,
765 // TODO(floitsch): reenable this test. 787 // TODO(floitsch): reenable this test.
766 /* 788 /*
(...skipping 18 matching lines...) Expand all
785 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., 807 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ...,
786 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). 808 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>).
787 */ 809 */
788 'UNDEFINED_FUNCTION': new Message( 810 'UNDEFINED_FUNCTION': new Message(
789 id: 'ERUSKD', 811 id: 'ERUSKD',
790 subId: 13, 812 subId: 13,
791 specializationOf: 'CANNOT_RESOLVE', 813 specializationOf: 'CANNOT_RESOLVE',
792 categories: [Category.staticTypeWarning], 814 categories: [Category.staticTypeWarning],
793 template: "The function '#{memberName}' is not defined.", 815 template: "The function '#{memberName}' is not defined.",
794 usedBy: [analyzer], 816 usedBy: [analyzer],
795 examples: const ["main() { foo(); }",]), 817 examples: const [
818 "main() { foo(); }",
819 ]),
796 820
797 'UNDEFINED_STATIC_GETTER_BUT_SETTER': new Message( 821 'UNDEFINED_STATIC_GETTER_BUT_SETTER': new Message(
798 id: 'ERUSKD', 822 id: 'ERUSKD',
799 subId: 14, 823 subId: 14,
800 specializationOf: 'CANNOT_RESOLVE', 824 specializationOf: 'CANNOT_RESOLVE',
801 categories: [Category.staticTypeWarning], 825 categories: [Category.staticTypeWarning],
802 template: "Cannot resolve getter '#{name}'.", 826 template: "Cannot resolve getter '#{name}'.",
803 usedBy: [dart2js], 827 usedBy: [dart2js],
804 examples: const ["set foo(x) {} main() { foo; }",]), 828 examples: const [
829 "set foo(x) {} main() { foo; }",
830 ]),
805 831
806 'UNDEFINED_STATIC_SETTER_BUT_GETTER': new Message( 832 'UNDEFINED_STATIC_SETTER_BUT_GETTER': new Message(
807 id: 'ERUSKD', 833 id: 'ERUSKD',
808 subId: 15, 834 subId: 15,
809 specializationOf: 'CANNOT_RESOLVE', 835 specializationOf: 'CANNOT_RESOLVE',
810 categories: [Category.staticTypeWarning], 836 categories: [Category.staticTypeWarning],
811 template: "Cannot resolve setter '#{name}'.", 837 template: "Cannot resolve setter '#{name}'.",
812 usedBy: [dart2js], 838 usedBy: [dart2js],
813 examples: const [ 839 examples: const [
814 """ 840 """
(...skipping 12 matching lines...) Expand all
827 main() { x = 3; } 853 main() { x = 3; }
828 """, 854 """,
829 """ 855 """
830 const x = 1; 856 const x = 1;
831 main() { x = 3; } 857 main() { x = 3; }
832 """, 858 """,
833 "get foo => null main() { foo = 5; }", 859 "get foo => null main() { foo = 5; }",
834 "const foo = 0 main() { foo = 5; }", 860 "const foo = 0 main() { foo = 5; }",
835 ]), 861 ]),
836 }; 862 };
OLDNEW
« no previous file with comments | « pkg/dart_messages/bin/publish.dart ('k') | pkg/dart_messages/test/dart_messages_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698