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

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: 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 194 // Const constructors (factory or not) may not have a body.
195 'CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY': new Message( 195 'CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY': new Message(
floitsch 2016/03/08 10:56:52 As long as we haven't published the messages datab
Johnni Winther 2016/03/10 08:55:42 Done.
196 id: 'LGJGHW', 196 id: 'LGJGHW',
197 subId: 0, 197 subId: 0,
198 categories: [Category.parserError], 198 categories: [Category.parserError],
199 template: "Const constructor or factory can't have a body.", 199 template: "Const constructor or factory can't have a body.",
200 howToFix: "Remove the 'const' keyword or the body.", 200 howToFix: "Remove the 'const' keyword or the body.",
201 usedBy: [dart2js], 201 usedBy: [],
202 examples: const [ 202 examples: const [
203 r""" 203 r"""
204 class C { 204 class C {
205 const C() {} 205 const C() {}
206 } 206 }
207 207
208 main() => new C();""", 208 main() => new C();""",
209 r""" 209 r"""
210 class C { 210 class C {
211 const factory C() {} 211 const factory C() {}
212 } 212 }
213 213
214 main() => new C();""" 214 main() => new C();"""
215 ]), 215 ]),
216 // Const constructors may not have a body. 216 // Const constructors may not have a body.
217 'CONST_CONSTRUCTOR_WITH_BODY': new Message( 217 'CONST_CONSTRUCTOR_WITH_BODY': new Message(
218 id: 'LGJGHW', 218 id: 'LGJGHW',
219 subId: 1, 219 subId: 1,
220 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY", 220 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY",
221 categories: [Category.parserError], 221 categories: [Category.parserError],
222 template: "Const constructor can't have a body.", 222 template: "Const constructor can't have a body.",
223 howToFix: "Try removing the 'const' keyword or the body.", 223 howToFix: "Try removing the 'const' keyword or the body.",
224 usedBy: [analyzer], 224 usedBy: [analyzer, dart2js],
225 examples: const [ 225 examples: const [
226 r""" 226 r"""
227 class C { 227 class C {
228 const C() {} 228 const C() {}
229 } 229 }
230 230
231 main() => new C();""" 231 main() => new C();"""
232 ]), 232 ]),
233 // Const constructor factories may only redirect (and must not have a body). 233 // Const constructor factories may only redirect (and must not have a body).
234 'CONST_FACTORY': new Message( 234 'CONST_FACTORY': new Message(
235 id: 'LGJGHW', 235 id: 'LGJGHW',
236 subId: 2, 236 subId: 2,
237 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY", 237 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY",
238 categories: [Category.parserError], 238 categories: [Category.parserError],
239 template: "Only redirecting factory constructors can be declared to " 239 template: "Only redirecting factory constructors can be declared to "
240 "be 'const'.", 240 "be 'const'.",
241 howToFix: "Try removing the 'const' keyword or replacing the body with " 241 howToFix: "Try removing the 'const' keyword or replacing the body with "
242 "'=' followed by a valid target.", 242 "'=' followed by a valid target.",
243 usedBy: [analyzer], 243 usedBy: [analyzer, dart2js],
244 examples: const [ 244 examples: const [
245 r""" 245 r"""
246 class C { 246 class C {
247 const factory C() {} 247 const factory C() {}
248 } 248 }
249 249
250 main() => new C();""" 250 main() => new C();"""
251 ]), 251 ]),
252 252
253 'EXTRANEOUS_MODIFIER': new Message( 253 'EXTRANEOUS_MODIFIER': new Message(
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 main() { x = 3; } 897 main() { x = 3; }
898 """, 898 """,
899 """ 899 """
900 const x = 1; 900 const x = 1;
901 main() { x = 3; } 901 main() { x = 3; }
902 """, 902 """,
903 "get foo => null main() { foo = 5; }", 903 "get foo => null main() { foo = 5; }",
904 "const foo = 0 main() { foo = 5; }", 904 "const foo = 0 main() { foo = 5; }",
905 ]), 905 ]),
906 }; 906 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698