OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.body_builder; | 5 library fasta.body_builder; |
6 | 6 |
7 import '../fasta_codes.dart' | 7 import '../fasta_codes.dart' |
8 show | 8 show |
9 FastaMessage, | 9 FastaMessage, |
10 codeConstFieldWithoutInitializer, | 10 codeConstFieldWithoutInitializer, |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 fields.add(field); | 432 fields.add(field); |
433 if (initializer != null) { | 433 if (initializer != null) { |
434 if (field.next != null) { | 434 if (field.next != null) { |
435 // TODO(ahe): This can happen, for example, if a final field is | 435 // TODO(ahe): This can happen, for example, if a final field is |
436 // combined with a setter. | 436 // combined with a setter. |
437 internalError( | 437 internalError( |
438 "Unhandled: '${field.name}' has more than one declaration."); | 438 "Unhandled: '${field.name}' has more than one declaration."); |
439 } | 439 } |
440 field.initializer = initializer; | 440 field.initializer = initializer; |
441 _typeInferrer.inferFieldInitializer(field.builtType, initializer); | 441 _typeInferrer.inferFieldInitializer( |
| 442 field.hasImplicitType ? null : field.builtType, initializer); |
442 } | 443 } |
443 } | 444 } |
444 pop(); // Type. | 445 pop(); // Type. |
445 pop(); // Modifiers. | 446 pop(); // Modifiers. |
446 List annotations = pop(); | 447 List annotations = pop(); |
447 if (annotations != null) { | 448 if (annotations != null) { |
448 Field field = fields.first.target; | 449 Field field = fields.first.target; |
449 // The first (and often only field) will not get a clone. | 450 // The first (and often only field) will not get a clone. |
450 annotations.forEach(field.addAnnotation); | 451 annotations.forEach(field.addAnnotation); |
451 for (int i = 1; i < fields.length; i++) { | 452 for (int i = 1; i < fields.length; i++) { |
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3686 if (starToken == null) { | 3687 if (starToken == null) { |
3687 return AsyncMarker.Async; | 3688 return AsyncMarker.Async; |
3688 } else { | 3689 } else { |
3689 assert(identical(starToken.stringValue, "*")); | 3690 assert(identical(starToken.stringValue, "*")); |
3690 return AsyncMarker.AsyncStar; | 3691 return AsyncMarker.AsyncStar; |
3691 } | 3692 } |
3692 } else { | 3693 } else { |
3693 return internalError("Unknown async modifier: $asyncToken"); | 3694 return internalError("Unknown async modifier: $asyncToken"); |
3694 } | 3695 } |
3695 } | 3696 } |
OLD | NEW |