| 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 if (node.elsePart != null) { | 709 if (node.elsePart != null) { |
| 710 analyzeUntyped(node.elsePart); | 710 analyzeUntyped(node.elsePart); |
| 711 } | 711 } |
| 712 } | 712 } |
| 713 | 713 |
| 714 void checkPrivateAccess(Node node, Element element, String name) { | 714 void checkPrivateAccess(Node node, Element element, String name) { |
| 715 if (name != null && | 715 if (name != null && |
| 716 Name.isPrivateName(name) && | 716 Name.isPrivateName(name) && |
| 717 element.library != currentLibrary) { | 717 element.library != currentLibrary) { |
| 718 reportTypeWarning(node, MessageKind.PRIVATE_ACCESS, | 718 reportTypeWarning(node, MessageKind.PRIVATE_ACCESS, |
| 719 {'name': name, 'libraryName': element.library.libraryOrScriptName}); | 719 {'name': name, 'libraryName': element.library.name}); |
| 720 } | 720 } |
| 721 } | 721 } |
| 722 | 722 |
| 723 ElementAccess lookupMember(Node node, ResolutionDartType receiverType, | 723 ElementAccess lookupMember(Node node, ResolutionDartType receiverType, |
| 724 String name, MemberKind memberKind, Element receiverElement, | 724 String name, MemberKind memberKind, Element receiverElement, |
| 725 {bool lookupClassMember: false, bool isHint: false}) { | 725 {bool lookupClassMember: false, bool isHint: false}) { |
| 726 if (receiverType.treatAsDynamic) { | 726 if (receiverType.treatAsDynamic) { |
| 727 return const DynamicAccess(); | 727 return const DynamicAccess(); |
| 728 } | 728 } |
| 729 | 729 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 // error message. If the target is a proxy, no warning needs to be emitted. | 805 // error message. If the target is a proxy, no warning needs to be emitted. |
| 806 // Otherwise, try to emit the most precise warning. | 806 // Otherwise, try to emit the most precise warning. |
| 807 if (!interface.element.isProxy && !analyzingInitializer) { | 807 if (!interface.element.isProxy && !analyzingInitializer) { |
| 808 bool foundPrivateMember = false; | 808 bool foundPrivateMember = false; |
| 809 if (memberName.isPrivate) { | 809 if (memberName.isPrivate) { |
| 810 void findPrivateMember(MemberSignature member) { | 810 void findPrivateMember(MemberSignature member) { |
| 811 if (memberName.isSimilarTo(member.name)) { | 811 if (memberName.isSimilarTo(member.name)) { |
| 812 PrivateName privateName = member.name; | 812 PrivateName privateName = member.name; |
| 813 LibraryElement library = privateName.library; | 813 LibraryElement library = privateName.library; |
| 814 reportMessage(node, MessageKind.PRIVATE_ACCESS, | 814 reportMessage(node, MessageKind.PRIVATE_ACCESS, |
| 815 {'name': name, 'libraryName': library.libraryOrScriptName}, | 815 {'name': name, 'libraryName': library.name}, |
| 816 isHint: isHint); | 816 isHint: isHint); |
| 817 foundPrivateMember = true; | 817 foundPrivateMember = true; |
| 818 } | 818 } |
| 819 } | 819 } |
| 820 | 820 |
| 821 // TODO(johnniwinther): Avoid computation of all class members. | 821 // TODO(johnniwinther): Avoid computation of all class members. |
| 822 MembersCreator.computeAllClassMembers(resolution, interface.element); | 822 MembersCreator.computeAllClassMembers(resolution, interface.element); |
| 823 if (lookupClassMember) { | 823 if (lookupClassMember) { |
| 824 interface.element.forEachClassMember(findPrivateMember); | 824 interface.element.forEachClassMember(findPrivateMember); |
| 825 } else { | 825 } else { |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 | 2054 |
| 2055 visitTypedef(Typedef node) { | 2055 visitTypedef(Typedef node) { |
| 2056 // Do not typecheck [Typedef] nodes. | 2056 // Do not typecheck [Typedef] nodes. |
| 2057 } | 2057 } |
| 2058 | 2058 |
| 2059 visitNode(Node node) { | 2059 visitNode(Node node) { |
| 2060 reporter.internalError(node, | 2060 reporter.internalError(node, |
| 2061 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2061 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
| 2062 } | 2062 } |
| 2063 } | 2063 } |
| OLD | NEW |