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

Side by Side Diff: pkg/compiler/lib/src/diagnostics/messages.dart

Issue 2896393003: Remove factory body in *.fromEnvironment, and implement this same behavior (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
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 /// The messages in this file should follow the [Guide for Writing 5 /// The messages in this file should follow the [Guide for Writing
6 /// Diagnostics](../../../../front_end/lib/src/fasta/diagnostics.md). 6 /// Diagnostics](../../../../front_end/lib/src/fasta/diagnostics.md).
7 /// 7 ///
8 /// Other things to keep in mind: 8 /// Other things to keep in mind:
9 /// 9 ///
10 /// An INFO message should always be preceded by a non-INFO message, and the 10 /// An INFO message should always be preceded by a non-INFO message, and the
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 EXTRA_CATCH_DECLARATION, 148 EXTRA_CATCH_DECLARATION,
149 EXTRA_FORMALS, 149 EXTRA_FORMALS,
150 EXTRANEOUS_MODIFIER, 150 EXTRANEOUS_MODIFIER,
151 EXTRANEOUS_MODIFIER_REPLACE, 151 EXTRANEOUS_MODIFIER_REPLACE,
152 FACTORY_REDIRECTION_IN_NON_FACTORY, 152 FACTORY_REDIRECTION_IN_NON_FACTORY,
153 FINAL_FUNCTION_TYPE_PARAMETER, 153 FINAL_FUNCTION_TYPE_PARAMETER,
154 FINAL_WITHOUT_INITIALIZER, 154 FINAL_WITHOUT_INITIALIZER,
155 FORIN_NOT_ASSIGNABLE, 155 FORIN_NOT_ASSIGNABLE,
156 FORMAL_DECLARED_CONST, 156 FORMAL_DECLARED_CONST,
157 FORMAL_DECLARED_STATIC, 157 FORMAL_DECLARED_STATIC,
158 FROM_ENVIRONMENT_MUST_BE_CONST,
158 FUNCTION_TYPE_FORMAL_WITH_DEFAULT, 159 FUNCTION_TYPE_FORMAL_WITH_DEFAULT,
159 FUNCTION_WITH_INITIALIZER, 160 FUNCTION_WITH_INITIALIZER,
160 GENERIC, 161 GENERIC,
161 GETTER_MISMATCH, 162 GETTER_MISMATCH,
162 UNDEFINED_INSTANCE_GETTER_BUT_SETTER, 163 UNDEFINED_INSTANCE_GETTER_BUT_SETTER,
163 HEX_DIGIT_EXPECTED, 164 HEX_DIGIT_EXPECTED,
164 HIDDEN_HINTS, 165 HIDDEN_HINTS,
165 HIDDEN_IMPLICIT_IMPORT, 166 HIDDEN_IMPLICIT_IMPORT,
166 HIDDEN_IMPORT, 167 HIDDEN_IMPORT,
167 HIDDEN_WARNINGS, 168 HIDDEN_WARNINGS,
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 const MessageTemplate( 1072 const MessageTemplate(
1072 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, 1073 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD,
1073 "This non-final field prevents using const constructors."), 1074 "This non-final field prevents using const constructors."),
1074 1075
1075 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR: 1076 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR:
1076 const MessageTemplate( 1077 const MessageTemplate(
1077 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, 1078 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
1078 "This const constructor is not allowed due to " 1079 "This const constructor is not allowed due to "
1079 "non-final fields."), 1080 "non-final fields."),
1080 1081
1082 MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST: const MessageTemplate(
1083 MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST,
1084 "#{className}.fromEnvironment can only be used as a "
1085 "const constructor.",
1086 howToFix: "Try replacing `new` with `const`.",
1087 examples: const [
1088 "abstract class A {} main() { new bool.fromEnvironment('X'); }"
Bob Nystrom 2017/05/24 19:52:09 What's the "abstract class A {}" part for?
Siggi Cherem (dart-lang) 2017/05/24 20:37:19 Thanks for catching that, I copied code form a dif
1089 ]),
1090
1081 MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED: const MessageTemplate( 1091 MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED: const MessageTemplate(
1082 MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED, 1092 MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED,
1083 "Initializing formal parameter only allowed in generative " 1093 "Initializing formal parameter only allowed in generative "
1084 "constructor."), 1094 "constructor."),
1085 1095
1086 MessageKind.INVALID_PARAMETER: const MessageTemplate( 1096 MessageKind.INVALID_PARAMETER: const MessageTemplate(
1087 MessageKind.INVALID_PARAMETER, "Cannot resolve parameter."), 1097 MessageKind.INVALID_PARAMETER, "Cannot resolve parameter."),
1088 1098
1089 MessageKind.NOT_INSTANCE_FIELD: const MessageTemplate( 1099 MessageKind.NOT_INSTANCE_FIELD: const MessageTemplate(
1090 MessageKind.NOT_INSTANCE_FIELD, 1100 MessageKind.NOT_INSTANCE_FIELD,
(...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after
3792 static String convertToString(value) { 3802 static String convertToString(value) {
3793 if (value is ErrorToken) { 3803 if (value is ErrorToken) {
3794 // Shouldn't happen. 3804 // Shouldn't happen.
3795 return value.assertionMessage; 3805 return value.assertionMessage;
3796 } else if (value is Token) { 3806 } else if (value is Token) {
3797 value = value.lexeme; 3807 value = value.lexeme;
3798 } 3808 }
3799 return '$value'; 3809 return '$value';
3800 } 3810 }
3801 } 3811 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698