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

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

Issue 10827339: Issue 4460. Mark inferred type variable in for-in loop as inferred (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/Types.java
diff --git a/compiler/java/com/google/dart/compiler/type/Types.java b/compiler/java/com/google/dart/compiler/type/Types.java
index 6de2bcbcc0525582149acaa1e8892ccd77a44820..404712705bb0c122126c55007452648534a6164b 100644
--- a/compiler/java/com/google/dart/compiler/type/Types.java
+++ b/compiler/java/com/google/dart/compiler/type/Types.java
@@ -506,12 +506,16 @@ public class Types {
* {@link Type#isInferred()}.
*/
public static Type makeInferred(Type type) {
- if (type != null) {
- Set<Class<?>> interfaceSet = getAllImplementedInterfaces(type.getClass());
- if (!interfaceSet.isEmpty()) {
- Class<?>[] interfaces = (Class[]) interfaceSet.toArray(new Class[interfaceSet.size()]);
- type = makeInferred(type, interfaces);
- }
+ if (type == null) {
+ return null;
+ }
+ if (type.isInferred()) {
+ return type;
+ }
+ Set<Class<?>> interfaceSet = getAllImplementedInterfaces(type.getClass());
+ if (!interfaceSet.isEmpty()) {
+ Class<?>[] interfaces = (Class[]) interfaceSet.toArray(new Class[interfaceSet.size()]);
+ return makeInferred(type, interfaces);
}
return type;
}

Powered by Google App Engine
This is Rietveld 408576698