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

Side by Side Diff: pkg/dart_messages/lib/shared_messages.dart

Issue 1768143003: Use specific messages for const constructor with body. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 9 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // An update to this file must be followed by regenerating the corresponding 5 // An update to this file must be followed by regenerating the corresponding
6 // json, dart2js and analyzer file. Use `publish.dart` in the bin directory. 6 // json, dart2js and analyzer file. Use `publish.dart` in the bin directory.
7 // 7 //
8 // Every message in this file must have an id. Use `message_id.dart` in the 8 // Every message in this file must have an id. Use `message_id.dart` in the
9 // bin directory to generate a fresh one. 9 // bin directory to generate a fresh one.
10 10
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 { 184 {
185 'fileA.dart': ''' 185 'fileA.dart': '''
186 or a map from file to content. 186 or a map from file to content.
187 again multiline''', 187 again multiline''',
188 'fileB.dart': ''' 188 'fileB.dart': '''
189 with possibly multiple files. 189 with possibly multiple files.
190 muliline too''' 190 muliline too'''
191 } 191 }
192 ]), 192 ]),
193 193
194 // Const constructors (factory or not) may not have a body.
195 'CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY': new Message(
196 id: 'LGJGHW',
197 subId: 0,
198 categories: [Category.parserError],
199 template: "Const constructor or factory can't have a body.",
200 howToFix: "Remove the 'const' keyword or the body.",
201 usedBy: [dart2js],
202 examples: const [
203 r"""
204 class C {
205 const C() {}
206 }
207
208 main() => new C();""",
209 r"""
210 class C {
211 const factory C() {}
212 }
213
214 main() => new C();"""
215 ]),
216 // Const constructors may not have a body. 194 // Const constructors may not have a body.
217 'CONST_CONSTRUCTOR_WITH_BODY': new Message( 195 'CONST_CONSTRUCTOR_WITH_BODY': new Message(
218 id: 'LGJGHW', 196 id: 'LGJGHW',
219 subId: 1, 197 subId: 0,
220 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY", 198 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY",
221 categories: [Category.parserError], 199 categories: [Category.parserError],
222 template: "Const constructor can't have a body.", 200 template: "Const constructor can't have a body.",
223 howToFix: "Try removing the 'const' keyword or the body.", 201 howToFix: "Try removing the 'const' keyword or the body.",
224 usedBy: [analyzer], 202 usedBy: [analyzer, dart2js],
225 examples: const [ 203 examples: const [
226 r""" 204 r"""
227 class C { 205 class C {
228 const C() {} 206 const C() {}
229 } 207 }
230 208
231 main() => new C();""" 209 main() => new C();"""
232 ]), 210 ]),
233 // Const constructor factories may only redirect (and must not have a body). 211 // Const constructor factories may only redirect (and must not have a body).
234 'CONST_FACTORY': new Message( 212 'CONST_FACTORY': new Message(
235 id: 'LGJGHW', 213 id: 'LGJGHW',
236 subId: 2, 214 subId: 1,
237 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY", 215 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY",
238 categories: [Category.parserError], 216 categories: [Category.parserError],
239 template: "Only redirecting factory constructors can be declared to " 217 template: "Only redirecting factory constructors can be declared to "
240 "be 'const'.", 218 "be 'const'.",
241 howToFix: "Try removing the 'const' keyword or replacing the body with " 219 howToFix: "Try removing the 'const' keyword or replacing the body with "
242 "'=' followed by a valid target.", 220 "'=' followed by a valid target.",
243 usedBy: [analyzer], 221 usedBy: [analyzer, dart2js],
244 examples: const [ 222 examples: const [
245 r""" 223 r"""
246 class C { 224 class C {
247 const factory C() {} 225 const factory C() {}
248 } 226 }
249 227
250 main() => new C();""" 228 main() => new C();"""
251 ]), 229 ]),
252 230
253 'EXTRANEOUS_MODIFIER': new Message( 231 'EXTRANEOUS_MODIFIER': new Message(
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 main() { x = 3; } 875 main() { x = 3; }
898 """, 876 """,
899 """ 877 """
900 const x = 1; 878 const x = 1;
901 main() { x = 3; } 879 main() { x = 3; }
902 """, 880 """,
903 "get foo => null main() { foo = 5; }", 881 "get foo => null main() { foo = 5; }",
904 "const foo = 0 main() { foo = 5; }", 882 "const foo = 0 main() { foo = 5; }",
905 ]), 883 ]),
906 }; 884 };
OLDNEW
« no previous file with comments | « pkg/dart_messages/lib/generated/shared_messages.json ('k') | tests/compiler/dart2js/patch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698