| 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.resolution.constructors; | 5 library dart2js.resolution.constructors; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../compiler.dart' show | 8 import '../compiler.dart' show |
| 9 Compiler; | 9 Compiler; |
| 10 import '../constants/constructors.dart' show | 10 import '../constants/constructors.dart' show |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 return result; | 560 return result; |
| 561 } | 561 } |
| 562 | 562 |
| 563 ConstructorResult visitTypeAnnotation(TypeAnnotation node) { | 563 ConstructorResult visitTypeAnnotation(TypeAnnotation node) { |
| 564 // This is not really resolving a type-annotation, but the name of the | 564 // This is not really resolving a type-annotation, but the name of the |
| 565 // constructor. Therefore we allow deferred types. | 565 // constructor. Therefore we allow deferred types. |
| 566 DartType type = resolver.resolveTypeAnnotation( | 566 DartType type = resolver.resolveTypeAnnotation( |
| 567 node, | 567 node, |
| 568 malformedIsError: inConstContext, | 568 malformedIsError: inConstContext, |
| 569 deferredIsMalformed: false); | 569 deferredIsMalformed: false); |
| 570 registry.registerRequiredType(type, resolver.enclosingElement); | |
| 571 return constructorResultForType(node, type); | 570 return constructorResultForType(node, type); |
| 572 } | 571 } |
| 573 | 572 |
| 574 ConstructorResult visitSend(Send node) { | 573 ConstructorResult visitSend(Send node) { |
| 575 ConstructorResult receiver = visit(node.receiver); | 574 ConstructorResult receiver = visit(node.receiver); |
| 576 assert(invariant(node.receiver, receiver != null, | 575 assert(invariant(node.receiver, receiver != null, |
| 577 message: 'No result returned for $node.receiver.')); | 576 message: 'No result returned for $node.receiver.')); |
| 578 if (receiver.kind != null) { | 577 if (receiver.kind != null) { |
| 579 assert(invariant(node, receiver.element.isErroneous, | 578 assert(invariant(node, receiver.element.isErroneous, |
| 580 message: "Unexpected prefix result: $receiver.")); | 579 message: "Unexpected prefix result: $receiver.")); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 // constructors. | 753 // constructors. |
| 755 return null; | 754 return null; |
| 756 } | 755 } |
| 757 // TODO(johnniwinther): Use [Name] for lookup. | 756 // TODO(johnniwinther): Use [Name] for lookup. |
| 758 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 757 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
| 759 if (constructor != null) { | 758 if (constructor != null) { |
| 760 constructor = constructor.declaration; | 759 constructor = constructor.declaration; |
| 761 } | 760 } |
| 762 return constructor; | 761 return constructor; |
| 763 } | 762 } |
| OLD | NEW |