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 (receiverType.treatAsDynamic) { | 709 if (receiverType.treatAsDynamic) { |
710 return const DynamicAccess(); | 710 return const DynamicAccess(); |
711 } | 711 } |
712 | 712 |
713 Name memberName = new Name(name, currentLibrary, | 713 Name memberName = new Name(name, currentLibrary, |
714 isSetter: memberKind == MemberKind.SETTER); | 714 isSetter: memberKind == MemberKind.SETTER); |
715 | 715 |
716 // Lookup the class or interface member [name] in [interface]. | 716 // Lookup the class or interface member [name] in [interface]. |
717 MemberSignature lookupMemberSignature(Name name, InterfaceType interface) { | 717 MemberSignature lookupMemberSignature(Name name, InterfaceType interface) { |
718 MembersCreator.computeClassMembersByName( | 718 MembersCreator.computeClassMembersByName( |
719 compiler, interface.element, name.text); | 719 resolution, interface.element, name.text); |
720 return lookupClassMember || analyzingInitializer | 720 return lookupClassMember || analyzingInitializer |
721 ? interface.lookupClassMember(name) | 721 ? interface.lookupClassMember(name) |
722 : interface.lookupInterfaceMember(name); | 722 : interface.lookupInterfaceMember(name); |
723 } | 723 } |
724 | 724 |
725 // Compute the access of [name] on [type]. This function takes the special | 725 // Compute the access of [name] on [type]. This function takes the special |
726 // 'call' method into account. | 726 // 'call' method into account. |
727 ElementAccess getAccess( | 727 ElementAccess getAccess( |
728 Name name, DartType unaliasedBound, InterfaceType interface) { | 728 Name name, DartType unaliasedBound, InterfaceType interface) { |
729 MemberSignature member = lookupMemberSignature(memberName, interface); | 729 MemberSignature member = lookupMemberSignature(memberName, interface); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 MessageKind.PRIVATE_ACCESS, | 792 MessageKind.PRIVATE_ACCESS, |
793 { | 793 { |
794 'name': name, | 794 'name': name, |
795 'libraryName': privateName.library.libraryOrScriptName | 795 'libraryName': privateName.library.libraryOrScriptName |
796 }, | 796 }, |
797 isHint: isHint); | 797 isHint: isHint); |
798 foundPrivateMember = true; | 798 foundPrivateMember = true; |
799 } | 799 } |
800 } | 800 } |
801 // TODO(johnniwinther): Avoid computation of all class members. | 801 // TODO(johnniwinther): Avoid computation of all class members. |
802 MembersCreator.computeAllClassMembers(compiler, interface.element); | 802 MembersCreator.computeAllClassMembers(resolution, interface.element); |
803 if (lookupClassMember) { | 803 if (lookupClassMember) { |
804 interface.element.forEachClassMember(findPrivateMember); | 804 interface.element.forEachClassMember(findPrivateMember); |
805 } else { | 805 } else { |
806 interface.element.forEachInterfaceMember(findPrivateMember); | 806 interface.element.forEachInterfaceMember(findPrivateMember); |
807 } | 807 } |
808 } | 808 } |
809 if (!foundPrivateMember) { | 809 if (!foundPrivateMember) { |
810 switch (memberKind) { | 810 switch (memberKind) { |
811 case MemberKind.METHOD: | 811 case MemberKind.METHOD: |
812 reportMessage(node, MessageKind.UNDEFINED_METHOD, | 812 reportMessage(node, MessageKind.UNDEFINED_METHOD, |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2018 | 2018 |
2019 visitTypedef(Typedef node) { | 2019 visitTypedef(Typedef node) { |
2020 // Do not typecheck [Typedef] nodes. | 2020 // Do not typecheck [Typedef] nodes. |
2021 } | 2021 } |
2022 | 2022 |
2023 visitNode(Node node) { | 2023 visitNode(Node node) { |
2024 reporter.internalError(node, | 2024 reporter.internalError(node, |
2025 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2025 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
2026 } | 2026 } |
2027 } | 2027 } |
OLD | NEW |