OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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.typechecker; | 5 library dart2js.typechecker; |
6 | 6 |
7 import 'common/names.dart' show Identifiers; | 7 import 'common/names.dart' show Identifiers; |
8 import 'common/resolution.dart' show Resolution; | 8 import 'common/resolution.dart' show Resolution; |
9 import 'common/tasks.dart' show CompilerTask; | 9 import 'common/tasks.dart' show CompilerTask; |
10 import 'common.dart'; | 10 import 'common.dart'; |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 if (unaliasedBound.treatAsDynamic) { | 764 if (unaliasedBound.treatAsDynamic) { |
765 return new DynamicAccess(); | 765 return new DynamicAccess(); |
766 } | 766 } |
767 InterfaceType interface = | 767 InterfaceType interface = |
768 Types.computeInterfaceType(resolution, unaliasedBound); | 768 Types.computeInterfaceType(resolution, unaliasedBound); |
769 ElementAccess access = getAccess(memberName, unaliasedBound, interface); | 769 ElementAccess access = getAccess(memberName, unaliasedBound, interface); |
770 if (access != null) { | 770 if (access != null) { |
771 return access; | 771 return access; |
772 } | 772 } |
773 if (receiverElement != null && | 773 if (receiverElement != null && |
774 (receiverElement.isVariable || receiverElement.isParameter || | 774 (receiverElement.isVariable || |
| 775 receiverElement.isParameter || |
775 (receiverElement.isInitializingFormal && | 776 (receiverElement.isInitializingFormal && |
776 compiler.options.enableInitializingFormalAccess))) { | 777 compiler.options.enableInitializingFormalAccess))) { |
777 Link<TypePromotion> typePromotions = typePromotionsMap[receiverElement]; | 778 Link<TypePromotion> typePromotions = typePromotionsMap[receiverElement]; |
778 if (typePromotions != null) { | 779 if (typePromotions != null) { |
779 while (!typePromotions.isEmpty) { | 780 while (!typePromotions.isEmpty) { |
780 TypePromotion typePromotion = typePromotions.head; | 781 TypePromotion typePromotion = typePromotions.head; |
781 if (!typePromotion.isValid) { | 782 if (!typePromotion.isValid) { |
782 DartType unaliasedBound = | 783 DartType unaliasedBound = |
783 Types.computeUnaliasedBound(resolution, typePromotion.type); | 784 Types.computeUnaliasedBound(resolution, typePromotion.type); |
784 if (!unaliasedBound.treatAsDynamic) { | 785 if (!unaliasedBound.treatAsDynamic) { |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 return null; | 1083 return null; |
1083 } | 1084 } |
1084 } | 1085 } |
1085 | 1086 |
1086 ElementAccess createResolvedAccess(Send node, String name, Element element) { | 1087 ElementAccess createResolvedAccess(Send node, String name, Element element) { |
1087 checkPrivateAccess(node, element, name); | 1088 checkPrivateAccess(node, element, name); |
1088 return createPromotedAccess(element); | 1089 return createPromotedAccess(element); |
1089 } | 1090 } |
1090 | 1091 |
1091 ElementAccess createPromotedAccess(Element element) { | 1092 ElementAccess createPromotedAccess(Element element) { |
1092 if (element.isVariable || element.isParameter || | 1093 if (element.isVariable || |
| 1094 element.isParameter || |
1093 (element.isInitializingFormal && | 1095 (element.isInitializingFormal && |
1094 compiler.options.enableInitializingFormalAccess)) { | 1096 compiler.options.enableInitializingFormalAccess)) { |
1095 TypePromotion typePromotion = getKnownTypePromotion(element); | 1097 TypePromotion typePromotion = getKnownTypePromotion(element); |
1096 if (typePromotion != null) { | 1098 if (typePromotion != null) { |
1097 return new PromotedAccess(element, typePromotion.type); | 1099 return new PromotedAccess(element, typePromotion.type); |
1098 } | 1100 } |
1099 } | 1101 } |
1100 return new ResolvedAccess(element); | 1102 return new ResolvedAccess(element); |
1101 } | 1103 } |
1102 | 1104 |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 | 2045 |
2044 visitTypedef(Typedef node) { | 2046 visitTypedef(Typedef node) { |
2045 // Do not typecheck [Typedef] nodes. | 2047 // Do not typecheck [Typedef] nodes. |
2046 } | 2048 } |
2047 | 2049 |
2048 visitNode(Node node) { | 2050 visitNode(Node node) { |
2049 reporter.internalError(node, | 2051 reporter.internalError(node, |
2050 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2052 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
2051 } | 2053 } |
2052 } | 2054 } |
OLD | NEW |