| 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 = "Computer says no!"; | 7 const DONT_KNOW_HOW_TO_FIX = "Computer says no!"; |
| 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 main() => new C(); | 805 main() => new C(); |
| 806 """, """ | 806 """, """ |
| 807 typedef C = Object with String; | 807 typedef C = Object with String; |
| 808 | 808 |
| 809 main() => new C(); | 809 main() => new C(); |
| 810 """]); | 810 """]); |
| 811 | 811 |
| 812 static const MessageKind CANNOT_EXTEND_ENUM = const MessageKind( | 812 static const MessageKind CANNOT_EXTEND_ENUM = const MessageKind( |
| 813 "Class '#{className}' can't extend the type '#{enumType}' because " | 813 "Class '#{className}' can't extend the type '#{enumType}' because " |
| 814 "it is declared by an enum.", | 814 "it is declared by an enum.", |
| 815 options: const ['--enable-enum'], | |
| 816 howToFix: "Try making '#{enumType}' a normal class or removing the " | 815 howToFix: "Try making '#{enumType}' a normal class or removing the " |
| 817 "'extends' clause.", | 816 "'extends' clause.", |
| 818 examples: const [""" | 817 examples: const [""" |
| 819 enum Enum { A } | 818 enum Enum { A } |
| 820 class B extends Enum {} | 819 class B extends Enum {} |
| 821 main() => new B();"""]); | 820 main() => new B();"""]); |
| 822 | 821 |
| 823 static const MessageKind CANNOT_IMPLEMENT_ENUM = const MessageKind( | 822 static const MessageKind CANNOT_IMPLEMENT_ENUM = const MessageKind( |
| 824 "Class '#{className}' can't implement the type '#{enumType}' " | 823 "Class '#{className}' can't implement the type '#{enumType}' " |
| 825 "because it is declared by an enum.", | 824 "because it is declared by an enum.", |
| 826 options: const ['--enable-enum'], | |
| 827 howToFix: "Try making '#{enumType}' a normal class or removing the " | 825 howToFix: "Try making '#{enumType}' a normal class or removing the " |
| 828 "type from the 'implements' clause.", | 826 "type from the 'implements' clause.", |
| 829 examples: const [""" | 827 examples: const [""" |
| 830 enum Enum { A } | 828 enum Enum { A } |
| 831 class B implements Enum {} | 829 class B implements Enum {} |
| 832 main() => new B();"""]); | 830 main() => new B();"""]); |
| 833 | 831 |
| 834 static const MessageKind CANNOT_MIXIN_ENUM = const MessageKind( | 832 static const MessageKind CANNOT_MIXIN_ENUM = const MessageKind( |
| 835 "Class '#{className}' can't mixin the type '#{enumType}' because it " | 833 "Class '#{className}' can't mixin the type '#{enumType}' because it " |
| 836 "is declared by an enum.", | 834 "is declared by an enum.", |
| 837 options: const ['--enable-enum'], | |
| 838 howToFix: "Try making '#{enumType}' a normal class or removing the " | 835 howToFix: "Try making '#{enumType}' a normal class or removing the " |
| 839 "type from the 'with' clause.", | 836 "type from the 'with' clause.", |
| 840 examples: const [""" | 837 examples: const [""" |
| 841 enum Enum { A } | 838 enum Enum { A } |
| 842 class B extends Object with Enum {} | 839 class B extends Object with Enum {} |
| 843 main() => new B();"""]); | 840 main() => new B();"""]); |
| 844 | 841 |
| 845 static const MessageKind CANNOT_INSTANTIATE_ENUM = const MessageKind( | 842 static const MessageKind CANNOT_INSTANTIATE_ENUM = const MessageKind( |
| 846 "Enum type '#{enumName}' cannot be instantiated.", | 843 "Enum type '#{enumName}' cannot be instantiated.", |
| 847 options: const ['--enable-enum'], | |
| 848 howToFix: "Try making '#{enumType}' a normal class or use an enum " | 844 howToFix: "Try making '#{enumType}' a normal class or use an enum " |
| 849 "constant.", | 845 "constant.", |
| 850 examples: const [""" | 846 examples: const [""" |
| 851 enum Enum { A } | 847 enum Enum { A } |
| 852 main() => new Enum(0);""", """ | 848 main() => new Enum(0);""", """ |
| 853 enum Enum { A } | 849 enum Enum { A } |
| 854 main() => const Enum(0);"""]); | 850 main() => const Enum(0);"""]); |
| 855 | 851 |
| 856 static const MessageKind EMPTY_ENUM_DECLARATION = const MessageKind( | 852 static const MessageKind EMPTY_ENUM_DECLARATION = const MessageKind( |
| 857 "Enum '#{enumName}' must contain at least one value.", | 853 "Enum '#{enumName}' must contain at least one value.", |
| 858 options: const ['--enable-enum'], | |
| 859 howToFix: "Try adding an enum constant or making #{enumName} a " | 854 howToFix: "Try adding an enum constant or making #{enumName} a " |
| 860 "normal class.", | 855 "normal class.", |
| 861 examples: const [""" | 856 examples: const [""" |
| 862 enum Enum {} | 857 enum Enum {} |
| 863 main() { Enum e; }"""]); | 858 main() { Enum e; }"""]); |
| 864 | 859 |
| 865 static const MessageKind MISSING_ENUM_CASES = const MessageKind( | 860 static const MessageKind MISSING_ENUM_CASES = const MessageKind( |
| 866 "Missing enum constants in switch statement: #{enumValues}.", | 861 "Missing enum constants in switch statement: #{enumValues}.", |
| 867 options: const ['--enable-enum'], | |
| 868 howToFix: "Try adding the missing constants or a default case.", | 862 howToFix: "Try adding the missing constants or a default case.", |
| 869 examples: const [""" | 863 examples: const [""" |
| 870 enum Enum { A, B } | 864 enum Enum { A, B } |
| 871 main() { | 865 main() { |
| 872 switch (Enum.A) { | 866 switch (Enum.A) { |
| 873 case Enum.B: break; | 867 case Enum.B: break; |
| 874 } | 868 } |
| 875 }""", """ | 869 }""", """ |
| 876 enum Enum { A, B, C } | 870 enum Enum { A, B, C } |
| 877 main() { | 871 main() { |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 "#{warnings} warning(s) suppressed in #{uri}."); | 2068 "#{warnings} warning(s) suppressed in #{uri}."); |
| 2075 | 2069 |
| 2076 static const MessageKind HIDDEN_HINTS = const MessageKind( | 2070 static const MessageKind HIDDEN_HINTS = const MessageKind( |
| 2077 "#{hints} hint(s) suppressed in #{uri}."); | 2071 "#{hints} hint(s) suppressed in #{uri}."); |
| 2078 | 2072 |
| 2079 static const MessageKind PREAMBLE = const MessageKind( | 2073 static const MessageKind PREAMBLE = const MessageKind( |
| 2080 "When run on the command-line, the compiled output might" | 2074 "When run on the command-line, the compiled output might" |
| 2081 " require a preamble file located in:\n" | 2075 " require a preamble file located in:\n" |
| 2082 " <sdk>/lib/_internal/compiler/js_lib/preambles."); | 2076 " <sdk>/lib/_internal/compiler/js_lib/preambles."); |
| 2083 | 2077 |
| 2084 | |
| 2085 static const MessageKind EXPERIMENTAL_ENUMS = const MessageKind( | |
| 2086 "Experimental language feature 'enums' is not supported.", | |
| 2087 howToFix: "Use option '--enable-enum' to use enum declarations.", | |
| 2088 examples: const [""" | |
| 2089 enum Enum { A, B, C } | |
| 2090 main() => print(Enum.A); | |
| 2091 """]); | |
| 2092 | |
| 2093 static const MessageKind EXPERIMENTAL_ASYNC_AWAIT = const MessageKind( | 2078 static const MessageKind EXPERIMENTAL_ASYNC_AWAIT = const MessageKind( |
| 2094 "Experimental language feature 'async/await' is not supported."); | 2079 "Experimental language feature 'async/await' is not supported."); |
| 2095 | 2080 |
| 2096 static const MessageKind INVALID_STARRED_KEYWORD = const MessageKind( | 2081 static const MessageKind INVALID_STARRED_KEYWORD = const MessageKind( |
| 2097 "Invalid '#{keyword}' keyword.", | 2082 "Invalid '#{keyword}' keyword.", |
| 2098 options: const ['--enable-async'], | 2083 options: const ['--enable-async'], |
| 2099 howToFix: "Try removing whitespace between '#{keyword}' and '*'.", | 2084 howToFix: "Try removing whitespace between '#{keyword}' and '*'.", |
| 2100 examples: const [ | 2085 examples: const [ |
| 2101 "main() async * {}", | 2086 "main() async * {}", |
| 2102 "main() sync * {}", | 2087 "main() sync * {}", |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 static String convertToString(value) { | 2439 static String convertToString(value) { |
| 2455 if (value is ErrorToken) { | 2440 if (value is ErrorToken) { |
| 2456 // Shouldn't happen. | 2441 // Shouldn't happen. |
| 2457 return value.assertionMessage; | 2442 return value.assertionMessage; |
| 2458 } else if (value is Token) { | 2443 } else if (value is Token) { |
| 2459 value = value.value; | 2444 value = value.value; |
| 2460 } | 2445 } |
| 2461 return '$value'; | 2446 return '$value'; |
| 2462 } | 2447 } |
| 2463 } | 2448 } |
| OLD | NEW |