Chromium Code Reviews| Index: lib/compiler/implementation/world.dart |
| diff --git a/lib/compiler/implementation/world.dart b/lib/compiler/implementation/world.dart |
| index f616c5aa4c892251aa2f5984e0c03e6980e8324a..37fff42988ce3a6fbd4e9addec32e2cbbb974638 100644 |
| --- a/lib/compiler/implementation/world.dart |
| +++ b/lib/compiler/implementation/world.dart |
| @@ -3,6 +3,7 @@ |
| // BSD-style license that can be found in the LICENSE file. |
| class World { |
| + Compiler compiler; // Set in populate(). |
| final Map<ClassElement, Set<ClassElement>> subtypes; |
| World() : subtypes = new Map<ClassElement, Set<ClassElement>>(); |
| @@ -28,6 +29,10 @@ class World { |
| addSubtypes(cls); |
| } |
| }); |
| + |
| + // Mark the world as populated. |
| + assert(compiler !== null); |
| + this.compiler = compiler; |
| } |
| /** |
| @@ -35,6 +40,7 @@ class World { |
| * selector named [member] on a receiver whose type is [type]. |
| */ |
| MemberSet _memberSetFor(Type type, SourceString member) { |
| + assert(compiler !== null); |
| ClassElement cls = type.element; |
| MemberSet result = new MemberSet(member); |
| Element element = cls.lookupMember(member); |
| @@ -69,6 +75,17 @@ class World { |
| }); |
| return (fieldCount == 1 && nonFieldCount == 0) ? field : null; |
| } |
| + |
| + bool mayHaveUserDefinedNoSuchMethod(Type type) { |
|
ahe
2012/08/02 17:15:05
We should consider this class as "delete-only" as
kasperl
2012/08/03 05:21:00
Yeah, that's probably better.
|
| + MemberSet memberSet = _memberSetFor(type, Compiler.NO_SUCH_METHOD); |
| + // TODO(kasperl): Only return true if the set contains an instance |
| + // method with the right signature. Remember to disregard the |
| + // implementation in Object. |
| + for (Element element in memberSet.elements) { |
| + if (element.getEnclosingClass() !== compiler.objectClass) return true; |
| + } |
| + return false; |
| + } |
| } |
| /** |