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.resolution.compute_members; | 5 library dart2js.resolution.compute_members; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/names.dart' show | 8 import '../common/names.dart' show |
9 Identifiers; | 9 Identifiers, |
| 10 Names; |
10 import '../common/resolution.dart' show | 11 import '../common/resolution.dart' show |
11 Resolution; | 12 Resolution; |
12 import '../compiler.dart' show | 13 import '../compiler.dart' show |
13 Compiler; | 14 Compiler; |
14 import '../dart_types.dart'; | 15 import '../dart_types.dart'; |
15 import '../elements/elements.dart' show | 16 import '../elements/elements.dart' show |
16 ClassElement, | 17 ClassElement, |
17 Element, | 18 Element, |
18 LibraryElement, | 19 LibraryElement, |
19 Member, | 20 Member, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 70 } |
70 | 71 |
71 /// Compute all members of [cls] with the given names. | 72 /// Compute all members of [cls] with the given names. |
72 void computeMembersByName(String name, Setlet<Name> names) { | 73 void computeMembersByName(String name, Setlet<Name> names) { |
73 computeMembers(name, names); | 74 computeMembers(name, names); |
74 } | 75 } |
75 | 76 |
76 /// Compute all members of [cls] and checked that [cls] implements its | 77 /// Compute all members of [cls] and checked that [cls] implements its |
77 /// interface unless it is abstract or declares a `noSuchMethod` method. | 78 /// interface unless it is abstract or declares a `noSuchMethod` method. |
78 void computeAllMembers() { | 79 void computeAllMembers() { |
79 Map<Name, Member> declaredMembers = computeMembers(null, null); | 80 computeMembers(null, null); |
80 if (!cls.isAbstract && | 81 if (!cls.isAbstract) { |
81 !declaredMembers.containsKey(const PublicName('noSuchMethod'))) { | 82 Member member = classMembers[Names.noSuchMethod_]; |
| 83 if (member != null && !member.declarer.isObject) { |
| 84 return; |
| 85 } |
82 // Check for unimplemented members on concrete classes that neither have | 86 // Check for unimplemented members on concrete classes that neither have |
83 // a `@proxy` annotation nor declare a `noSuchMethod` method. | 87 // a `@proxy` annotation nor declare a `noSuchMethod` method. |
84 checkInterfaceImplementation(); | 88 checkInterfaceImplementation(); |
85 } | 89 } |
86 } | 90 } |
87 | 91 |
88 /// Compute declared and inherited members of [cls] and return a map of the | 92 /// Compute declared and inherited members of [cls] and return a map of the |
89 /// declared members. | 93 /// declared members. |
90 /// | 94 /// |
91 /// If [name] and [names] are not null, the computation is restricted to | 95 /// If [name] and [names] are not null, the computation is restricted to |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 message: "Members have not been fully computed for $this.")); | 952 message: "Members have not been fully computed for $this.")); |
949 if (interfaceMembersAreClassMembers) { | 953 if (interfaceMembersAreClassMembers) { |
950 classMembers.forEach((_, member) { | 954 classMembers.forEach((_, member) { |
951 if (!member.isStatic) f(member); | 955 if (!member.isStatic) f(member); |
952 }); | 956 }); |
953 } else { | 957 } else { |
954 interfaceMembers.forEach((_, member) => f(member)); | 958 interfaceMembers.forEach((_, member) => f(member)); |
955 } | 959 } |
956 } | 960 } |
957 } | 961 } |
OLD | NEW |