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

Unified 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, 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
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..53b32a849323eefad77b43ae80b64b40a4c79b38 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,15 @@ 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 [
+ "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
+ ]),
+
MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED: const MessageTemplate(
MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED,
"Initializing formal parameter only allowed in generative "

Powered by Google App Engine
This is Rietveld 408576698