| 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 main() => new C(); | 797 main() => new C(); |
| 798 """]); | 798 """]); |
| 799 | 799 |
| 800 static const MessageKind CANNOT_EXTEND_ENUM = const MessageKind( | 800 static const MessageKind CANNOT_EXTEND_ENUM = const MessageKind( |
| 801 "Class '#{className}' can't extend the type '#{enumType}' because " | 801 "Class '#{className}' can't extend the type '#{enumType}' because " |
| 802 "it is declared by an enum.", | 802 "it is declared by an enum.", |
| 803 options: const ['--enable-enum'], | 803 options: const ['--enable-enum'], |
| 804 howToFix: "Try making '#{enumType}' a normal class or removing the " | 804 howToFix: "Try making '#{enumType}' a normal class or removing the " |
| 805 "'extends' clause.", | 805 "'extends' clause.", |
| 806 examples: const [""" | 806 examples: const [""" |
| 807 enum Enum {} | 807 enum Enum { A } |
| 808 class A extends Enum {} | 808 class B extends Enum {} |
| 809 main() => new A();"""]); | 809 main() => new B();"""]); |
| 810 | 810 |
| 811 static const MessageKind CANNOT_IMPLEMENT_ENUM = const MessageKind( | 811 static const MessageKind CANNOT_IMPLEMENT_ENUM = const MessageKind( |
| 812 "Class '#{className}' can't implement the type '#{enumType}' " | 812 "Class '#{className}' can't implement the type '#{enumType}' " |
| 813 "because it is declared by an enum.", | 813 "because it is declared by an enum.", |
| 814 options: const ['--enable-enum'], | 814 options: const ['--enable-enum'], |
| 815 howToFix: "Try making '#{enumType}' a normal class or removing the " | 815 howToFix: "Try making '#{enumType}' a normal class or removing the " |
| 816 "type from the 'implements' clause.", | 816 "type from the 'implements' clause.", |
| 817 examples: const [""" | 817 examples: const [""" |
| 818 enum Enum {} | 818 enum Enum { A } |
| 819 class A implements Enum {} | 819 class B implements Enum {} |
| 820 main() => new A();"""]); | 820 main() => new B();"""]); |
| 821 | 821 |
| 822 static const MessageKind CANNOT_MIXIN_ENUM = const MessageKind( | 822 static const MessageKind CANNOT_MIXIN_ENUM = const MessageKind( |
| 823 "Class '#{className}' can't mixin the type '#{enumType}' because it " | 823 "Class '#{className}' can't mixin the type '#{enumType}' because it " |
| 824 "is declared by an enum.", | 824 "is declared by an enum.", |
| 825 options: const ['--enable-enum'], | 825 options: const ['--enable-enum'], |
| 826 howToFix: "Try making '#{enumType}' a normal class or removing the " | 826 howToFix: "Try making '#{enumType}' a normal class or removing the " |
| 827 "type from the 'with' clause.", | 827 "type from the 'with' clause.", |
| 828 examples: const [""" | 828 examples: const [""" |
| 829 enum Enum {} | 829 enum Enum { A } |
| 830 class A extends Object with Enum {} | 830 class B extends Object with Enum {} |
| 831 main() => new A();"""]); | 831 main() => new B();"""]); |
| 832 | 832 |
| 833 static const MessageKind CANNOT_INSTANTIATE_ENUM = const MessageKind( | 833 static const MessageKind CANNOT_INSTANTIATE_ENUM = const MessageKind( |
| 834 "Enum type '#{enumName}' cannot be instantiated.", | 834 "Enum type '#{enumName}' cannot be instantiated.", |
| 835 options: const ['--enable-enum'], | 835 options: const ['--enable-enum'], |
| 836 howToFix: "Try making '#{enumType}' a normal class or use an enum " | 836 howToFix: "Try making '#{enumType}' a normal class or use an enum " |
| 837 "constant.", | 837 "constant.", |
| 838 examples: const [""" | 838 examples: const [""" |
| 839 enum Enum { A } |
| 840 main() => new Enum(0, '');""", """ |
| 841 enum Enum { A } |
| 842 main() => const Enum(0, '');"""]); |
| 843 |
| 844 static const MessageKind EMPTY_ENUM_DECLARATION = const MessageKind( |
| 845 "Enum '#{enumName}' must contain at least one value.", |
| 846 options: const ['--enable-enum'], |
| 847 howToFix: "Try adding an enum constant or making #{enumName} a " |
| 848 "normal class.", |
| 849 examples: const [""" |
| 839 enum Enum {} | 850 enum Enum {} |
| 840 main() => new Enum(0, '');""", """ | 851 main() { Enum e; }"""]); |
| 841 enum Enum {} | 852 |
| 842 main() => const Enum(0, '');"""]); | 853 static const MessageKind MISSING_ENUM_CASES = const MessageKind( |
| 854 "Missing enum constants in switch statement: #{enumValues}.", |
| 855 options: const ['--enable-enum'], |
| 856 howToFix: "Try adding the missing constants or a default case.", |
| 857 examples: const [""" |
| 858 enum Enum { A, B } |
| 859 main() { |
| 860 switch (Enum.A) { |
| 861 case Enum.B: break; |
| 862 } |
| 863 }""", """ |
| 864 enum Enum { A, B, C } |
| 865 main() { |
| 866 switch (Enum.A) { |
| 867 case Enum.B: break; |
| 868 } |
| 869 }"""]); |
| 843 | 870 |
| 844 static const MessageKind DUPLICATE_EXTENDS_IMPLEMENTS = const MessageKind( | 871 static const MessageKind DUPLICATE_EXTENDS_IMPLEMENTS = const MessageKind( |
| 845 "'#{type}' can not be both extended and implemented."); | 872 "'#{type}' can not be both extended and implemented."); |
| 846 | 873 |
| 847 static const MessageKind DUPLICATE_IMPLEMENTS = const MessageKind( | 874 static const MessageKind DUPLICATE_IMPLEMENTS = const MessageKind( |
| 848 "'#{type}' must not occur more than once " | 875 "'#{type}' must not occur more than once " |
| 849 "in the implements clause."); | 876 "in the implements clause."); |
| 850 | 877 |
| 851 static const MessageKind MULTI_INHERITANCE = const MessageKind( | 878 static const MessageKind MULTI_INHERITANCE = const MessageKind( |
| 852 "Dart2js does not currently support inheritance of the same class with " | 879 "Dart2js does not currently support inheritance of the same class with " |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 static String convertToString(value) { | 2313 static String convertToString(value) { |
| 2287 if (value is ErrorToken) { | 2314 if (value is ErrorToken) { |
| 2288 // Shouldn't happen. | 2315 // Shouldn't happen. |
| 2289 return value.assertionMessage; | 2316 return value.assertionMessage; |
| 2290 } else if (value is Token) { | 2317 } else if (value is Token) { |
| 2291 value = value.value; | 2318 value = value.value; |
| 2292 } | 2319 } |
| 2293 return '$value'; | 2320 return '$value'; |
| 2294 } | 2321 } |
| 2295 } | 2322 } |
| OLD | NEW |