OLD | NEW |
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 may not have a body. | 194 // Const constructors may not have a body. |
195 'CONST_CONSTRUCTOR_WITH_BODY': new Message( | 195 'CONST_CONSTRUCTOR_WITH_BODY': new Message( |
196 id: 'LGJGHW', | 196 id: 'LGJGHW', |
197 subId: 0, | 197 subId: 0, |
198 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY", | |
199 categories: [Category.parserError], | 198 categories: [Category.parserError], |
200 template: "Const constructor can't have a body.", | 199 template: "Const constructor can't have a body.", |
201 howToFix: "Try removing the 'const' keyword or the body.", | 200 howToFix: "Try removing the 'const' keyword or the body.", |
202 usedBy: [analyzer, dart2js], | 201 usedBy: [analyzer, dart2js], |
203 examples: const [ | 202 examples: const [ |
204 r""" | 203 r""" |
205 class C { | 204 class C { |
206 const C() {} | 205 const C() {} |
207 } | 206 } |
208 | 207 |
209 main() => new C();""" | 208 main() => new C();""" |
210 ]), | 209 ]), |
211 // Const constructor factories may only redirect (and must not have a body). | 210 // Const constructor factories may only redirect (and must not have a body). |
212 'CONST_FACTORY': new Message( | 211 'CONST_FACTORY': new Message( |
213 id: 'LGJGHW', | 212 id: 'LGJGHW', |
214 subId: 1, | 213 subId: 1, |
215 specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY", | |
216 categories: [Category.parserError], | 214 categories: [Category.parserError], |
217 template: "Only redirecting factory constructors can be declared to " | 215 template: "Only redirecting factory constructors can be declared to " |
218 "be 'const'.", | 216 "be 'const'.", |
219 howToFix: "Try removing the 'const' keyword or replacing the body with " | 217 howToFix: "Try removing the 'const' keyword or replacing the body with " |
220 "'=' followed by a valid target.", | 218 "'=' followed by a valid target.", |
221 usedBy: [analyzer, dart2js], | 219 usedBy: [analyzer, dart2js], |
222 examples: const [ | 220 examples: const [ |
223 r""" | 221 r""" |
224 class C { | 222 class C { |
225 const factory C() {} | 223 const factory C() {} |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 main() { x = 3; } | 873 main() { x = 3; } |
876 """, | 874 """, |
877 """ | 875 """ |
878 const x = 1; | 876 const x = 1; |
879 main() { x = 3; } | 877 main() { x = 3; } |
880 """, | 878 """, |
881 "get foo => null main() { foo = 5; }", | 879 "get foo => null main() { foo = 5; }", |
882 "const foo = 0 main() { foo = 5; }", | 880 "const foo = 0 main() { foo = 5; }", |
883 ]), | 881 ]), |
884 }; | 882 }; |
OLD | NEW |