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

Side by Side 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: Updated cf. comments. 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/parser/parser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5
6 /** 6 /**
7 * The messages in this file should meet the following guide lines: 7 * The messages in this file should meet the following guide lines:
8 * 8 *
9 * 1. The message should be a complete sentence starting with an uppercase 9 * 1. The message should be a complete sentence starting with an uppercase
10 * letter, and ending with a period. 10 * letter, and ending with a period.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 COMPILER_CRASHED, 139 COMPILER_CRASHED,
140 COMPLEX_RETURNING_NSM, 140 COMPLEX_RETURNING_NSM,
141 COMPLEX_THROWING_NSM, 141 COMPLEX_THROWING_NSM,
142 CONSIDER_ANALYZE_ALL, 142 CONSIDER_ANALYZE_ALL,
143 CONST_CALLS_NON_CONST, 143 CONST_CALLS_NON_CONST,
144 CONST_CALLS_NON_CONST_FOR_IMPLICIT, 144 CONST_CALLS_NON_CONST_FOR_IMPLICIT,
145 CONST_CONSTRUCTOR_HAS_BODY, 145 CONST_CONSTRUCTOR_HAS_BODY,
146 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS, 146 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS,
147 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, 147 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
148 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, 148 CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD,
149 CONST_LOOP_VARIABLE,
149 CONST_MAP_KEY_OVERRIDES_EQUALS, 150 CONST_MAP_KEY_OVERRIDES_EQUALS,
150 CONST_WITHOUT_INITIALIZER, 151 CONST_WITHOUT_INITIALIZER,
151 CONSTRUCTOR_CALL_EXPECTED, 152 CONSTRUCTOR_CALL_EXPECTED,
152 CONSTRUCTOR_IS_NOT_CONST, 153 CONSTRUCTOR_IS_NOT_CONST,
153 CONSTRUCTOR_WITH_RETURN_TYPE, 154 CONSTRUCTOR_WITH_RETURN_TYPE,
154 CYCLIC_CLASS_HIERARCHY, 155 CYCLIC_CLASS_HIERARCHY,
155 CYCLIC_COMPILE_TIME_CONSTANTS, 156 CYCLIC_COMPILE_TIME_CONSTANTS,
156 CYCLIC_REDIRECTING_FACTORY, 157 CYCLIC_REDIRECTING_FACTORY,
157 CYCLIC_TYPE_VARIABLE, 158 CYCLIC_TYPE_VARIABLE,
158 CYCLIC_TYPEDEF, 159 CYCLIC_TYPEDEF,
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 }"""]), 2051 }"""]),
2051 2052
2052 MessageKind.FINAL_WITHOUT_INITIALIZER: 2053 MessageKind.FINAL_WITHOUT_INITIALIZER:
2053 const MessageTemplate(MessageKind.FINAL_WITHOUT_INITIALIZER, 2054 const MessageTemplate(MessageKind.FINAL_WITHOUT_INITIALIZER,
2054 "A final variable must be initialized.", 2055 "A final variable must be initialized.",
2055 howToFix: "Try adding an initializer or " 2056 howToFix: "Try adding an initializer or "
2056 "removing the 'final' modifier.", 2057 "removing the 'final' modifier.",
2057 examples: const [ 2058 examples: const [
2058 "class C { static final field; } main() => C.field;"]), 2059 "class C { static final field; } main() => C.field;"]),
2059 2060
2061 MessageKind.CONST_LOOP_VARIABLE:
2062 const MessageTemplate(MessageKind.CONST_LOOP_VARIABLE,
2063 "A loop variable cannot be constant.",
2064 howToFix: "Try remove the 'const' modifier or "
2065 "replacing it with a 'final' modifier.",
2066 examples: const ["""
2067 void main() {
2068 for (const c in []) {}
2069 }"""]),
2070
2060 MessageKind.MEMBER_USES_CLASS_NAME: 2071 MessageKind.MEMBER_USES_CLASS_NAME:
2061 const MessageTemplate(MessageKind.MEMBER_USES_CLASS_NAME, 2072 const MessageTemplate(MessageKind.MEMBER_USES_CLASS_NAME,
2062 "Member variable can't have the same name as the class it is " 2073 "Member variable can't have the same name as the class it is "
2063 "declared in.", 2074 "declared in.",
2064 howToFix: "Try renaming the variable.", 2075 howToFix: "Try renaming the variable.",
2065 examples: const [""" 2076 examples: const ["""
2066 class A { var A; } 2077 class A { var A; }
2067 main() { 2078 main() {
2068 var a = new A(); 2079 var a = new A();
2069 a.A = 1; 2080 a.A = 1;
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after
3628 static String convertToString(value) { 3639 static String convertToString(value) {
3629 if (value is ErrorToken) { 3640 if (value is ErrorToken) {
3630 // Shouldn't happen. 3641 // Shouldn't happen.
3631 return value.assertionMessage; 3642 return value.assertionMessage;
3632 } else if (value is Token) { 3643 } else if (value is Token) {
3633 value = value.value; 3644 value = value.value;
3634 } 3645 }
3635 return '$value'; 3646 return '$value';
3636 } 3647 }
3637 } 3648 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/parser/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698