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

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

Issue 1503063002: Handle const loop variable. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « no previous file | pkg/compiler/lib/src/parser/parser.dart » ('j') | pkg/compiler/lib/src/parser/parser.dart » ('J')
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 5913cb02da724ee567159b7c654aa8a00b793474..7445a04d254c7344efc8d0ea1fc9ab0a97b2f5b3 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -146,6 +146,7 @@ enum MessageKind {
CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS,
CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD,
+ CONST_LOOP_VARIABLE,
CONST_MAP_KEY_OVERRIDES_EQUALS,
CONST_WITHOUT_INITIALIZER,
CONSTRUCTOR_CALL_EXPECTED,
@@ -2057,6 +2058,16 @@ void main() {
examples: const [
"class C { static final field; } main() => C.field;"]),
+ MessageKind.CONST_LOOP_VARIABLE:
+ const MessageTemplate(MessageKind.CONST_LOOP_VARIABLE,
+ "A loop variable cannot be constant.",
+ howToFix: "Try remove the 'const' modifier or "
+ "replacing it with a 'final' modifier.",
+ examples: const ["""
+void main() {
+ for (const c in []) {}
+}"""]),
+
MessageKind.MEMBER_USES_CLASS_NAME:
const MessageTemplate(MessageKind.MEMBER_USES_CLASS_NAME,
"Member variable can't have the same name as the class it is "
« no previous file with comments | « no previous file | pkg/compiler/lib/src/parser/parser.dart » ('j') | pkg/compiler/lib/src/parser/parser.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698