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

Unified Diff: pkg/compiler/lib/src/diagnostics/messages.dart

Issue 2896393003: Remove factory body in *.fromEnvironment, and implement this same behavior (Closed)
Patch Set: turn warning into a hint Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/common_elements.dart ('k') | pkg/compiler/lib/src/elements/entities.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/diagnostics/messages.dart
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index 6424772cfe7aabfff580b8a65835ba917077deb6..74582dd1191f65415e77090e6993e86a217bff66 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -155,6 +155,7 @@ enum MessageKind {
FORIN_NOT_ASSIGNABLE,
FORMAL_DECLARED_CONST,
FORMAL_DECLARED_STATIC,
+ FROM_ENVIRONMENT_MUST_BE_CONST,
FUNCTION_TYPE_FORMAL_WITH_DEFAULT,
FUNCTION_WITH_INITIALIZER,
GENERIC,
@@ -1078,6 +1079,13 @@ main() => new C(0);"""
"This const constructor is not allowed due to "
"non-final fields."),
+ MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST: const MessageTemplate(
+ MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST,
+ "#{className}.fromEnvironment can only be used as a "
+ "const constructor.",
+ howToFix: "Try replacing `new` with `const`.",
+ examples: const ["main() { new bool.fromEnvironment('X'); }"]),
+
MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED: const MessageTemplate(
MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED,
"Initializing formal parameter only allowed in generative "
« no previous file with comments | « pkg/compiler/lib/src/common_elements.dart ('k') | pkg/compiler/lib/src/elements/entities.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698