| Index: lib/compiler/implementation/world.dart
|
| diff --git a/lib/compiler/implementation/world.dart b/lib/compiler/implementation/world.dart
|
| index 03e4e3a1906aa52d95b2ffbe54361c1c4aef6f59..38615cca942e177f64673b850199e8a4c06ed74f 100644
|
| --- a/lib/compiler/implementation/world.dart
|
| +++ b/lib/compiler/implementation/world.dart
|
| @@ -29,20 +29,25 @@ class World {
|
| }
|
|
|
| /**
|
| - * Returns a [MemberSet] that contains the possible targets of a
|
| - * selector named [member] on a receiver whose type is [type].
|
| + * Returns a [MemberSet] that contains the possible targets of the given
|
| + * [selector] on a receiver with the given [type].
|
| */
|
| - MemberSet _memberSetFor(Type type, SourceString member) {
|
| + MemberSet _memberSetFor(Type type, Selector selector) {
|
| assert(compiler !== null);
|
| ClassElement cls = type.element;
|
| - MemberSet result = new MemberSet(member);
|
| - Element element = cls.lookupMember(member);
|
| + SourceString name = selector.name;
|
| + LibraryElement library = selector.library;
|
| + MemberSet result = new MemberSet(name);
|
| + Element element = cls.lookupSelector(selector);
|
| if (element !== null) result.add(element);
|
|
|
| + bool isPrivate = name.isPrivate();
|
| Set<ClassElement> subtypesOfCls = subtypes[cls];
|
| if (subtypesOfCls !== null) {
|
| for (ClassElement sub in subtypesOfCls) {
|
| - element = sub.lookupLocalMember(member);
|
| + // Private members from a different library are not visible.
|
| + if (isPrivate && sub.getLibrary() != library) continue;
|
| + element = sub.lookupLocalMember(name);
|
| if (element !== null) result.add(element);
|
| }
|
| }
|
| @@ -50,11 +55,11 @@ class World {
|
| }
|
|
|
| /**
|
| - * Returns the single field with the given name, if such a field
|
| - * exists. If there are multple fields, or none, return null.
|
| + * Returns the single field with the given [selector]. If there is no such
|
| + * field, or there are multiple possible fields returns [:null:].
|
| */
|
| - VariableElement locateSingleField(Type type, SourceString member) {
|
| - MemberSet memberSet = _memberSetFor(type, member);
|
| + VariableElement locateSingleField(Type type, Selector selector) {
|
| + MemberSet memberSet = _memberSetFor(type, selector);
|
| int fieldCount = 0;
|
| int nonFieldCount = 0;
|
| VariableElement field;
|
| @@ -71,8 +76,8 @@ class World {
|
|
|
| Set<ClassElement> findNoSuchMethodHolders(Type type) {
|
| Set<ClassElement> result = new Set<ClassElement>();
|
| - MemberSet memberSet = _memberSetFor(type, Compiler.NO_SUCH_METHOD);
|
| Selector noSuchMethodSelector = new Selector.noSuchMethod();
|
| + MemberSet memberSet = _memberSetFor(type, noSuchMethodSelector);
|
| for (Element element in memberSet.elements) {
|
| ClassElement holder = element.getEnclosingClass();
|
| if (holder !== compiler.objectClass &&
|
|
|