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 library dart2js.parser.partial_elements; | 5 library dart2js.parser.partial_elements; |
6 | 6 |
7 import '../compiler.dart' show | 7 import '../compiler.dart' show |
8 Compiler; | 8 Compiler; |
9 import '../dart_types.dart' show DynamicType; | 9 import '../dart_types.dart' show DynamicType; |
10 import '../diagnostics/diagnostic_listener.dart'; | 10 import '../diagnostics/diagnostic_listener.dart'; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 definitions = parse( | 274 definitions = parse( |
275 listener, element, declarationSite, | 275 listener, element, declarationSite, |
276 (Parser parser) => parser.parseMember(beginToken)); | 276 (Parser parser) => parser.parseMember(beginToken)); |
277 | 277 |
278 if (!hasParseError && | 278 if (!hasParseError && |
279 !definitions.modifiers.isVar && | 279 !definitions.modifiers.isVar && |
280 !definitions.modifiers.isFinal && | 280 !definitions.modifiers.isFinal && |
281 !definitions.modifiers.isConst && | 281 !definitions.modifiers.isConst && |
282 definitions.type == null && | 282 definitions.type == null && |
283 !definitions.isErroneous) { | 283 !definitions.isErroneous) { |
284 listener.reportError( | 284 listener.reportErrorMessage( |
285 definitions, | 285 definitions, |
286 MessageKind.GENERIC, | 286 MessageKind.GENERIC, |
287 { 'text': 'A field declaration must start with var, final, ' | 287 { 'text': 'A field declaration must start with var, final, ' |
288 'const, or a type annotation.' }); | 288 'const, or a type annotation.' }); |
289 } | 289 } |
290 }); | 290 }); |
291 return definitions; | 291 return definitions; |
292 } | 292 } |
293 | 293 |
294 computeType(Element element, Compiler compiler) { | 294 computeType(Element element, Compiler compiler) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 490 } |
491 doParse(new Parser(listener)); | 491 doParse(new Parser(listener)); |
492 } on ParserError catch (e) { | 492 } on ParserError catch (e) { |
493 partial.hasParseError = true; | 493 partial.hasParseError = true; |
494 return new ErrorNode(element.position, e.reason); | 494 return new ErrorNode(element.position, e.reason); |
495 } | 495 } |
496 Node node = listener.popNode(); | 496 Node node = listener.popNode(); |
497 assert(listener.nodes.isEmpty); | 497 assert(listener.nodes.isEmpty); |
498 return node; | 498 return node; |
499 } | 499 } |
OLD | NEW |