Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: compiler/java/com/google/dart/compiler/type/InterfaceTypeImplementation.java

Issue 12088044: Issue 8169. Type inferred from 'query' is 'inferred exact'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't report problem when member exists, but not the unique. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiler/java/com/google/dart/compiler/type/InterfaceTypeImplementation.java
diff --git a/compiler/java/com/google/dart/compiler/type/InterfaceTypeImplementation.java b/compiler/java/com/google/dart/compiler/type/InterfaceTypeImplementation.java
index 5bb25bf3b987f89ab1c6707cea734efbb0d94b7b..d1dad430a4b0e78ca6a4a48999a0b0ed44466bb7 100644
--- a/compiler/java/com/google/dart/compiler/type/InterfaceTypeImplementation.java
+++ b/compiler/java/com/google/dart/compiler/type/InterfaceTypeImplementation.java
@@ -4,6 +4,7 @@
package com.google.dart.compiler.type;
+import com.google.common.collect.Lists;
import com.google.common.collect.MapMaker;
import com.google.dart.compiler.resolver.ClassElement;
import com.google.dart.compiler.resolver.Element;
@@ -255,33 +256,24 @@ class InterfaceTypeImplementation extends AbstractType implements InterfaceType
}
@Override
- public Member lookupSubTypeMember(String name) {
- Member foundMember = null;
- for (ClassElement subClass : subClasses.keySet()) {
- // find one or more members in subClass elements
- {
- Element element = subClass.lookupLocalElement(name);
- if (element != null) {
- if (foundMember != null) {
- return null;
- }
- foundMember = new MemberImplementation(this, element);
- continue;
- }
+ public List<Member> lookupSubTypeMembers(String name) {
+ List<Member> members = Lists.newArrayList();
+ fillSubTypeMember(members, name);
+ return members;
+ }
+
+ private void fillSubTypeMember(List<Member> members, String name) {
+ {
+ Member member = lookupMember(name);
+ if (member != null) {
+ members.add(member);
}
- // try to find deeper
+ }
+ for (ClassElement subClass : subClasses.keySet()) {
InterfaceType type = subClass.getType();
- if (type != null) {
- Member member = type.lookupSubTypeMember(name);
- if (member != null) {
- if (foundMember != null) {
- return null;
- }
- foundMember = member;
- }
+ if (type instanceof InterfaceTypeImplementation) {
+ ((InterfaceTypeImplementation)type).fillSubTypeMember(members, name);
}
}
- // may be found
- return foundMember;
}
}

Powered by Google App Engine
This is Rietveld 408576698