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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/CoreTypeProviderImplementation.java

Issue 8322014: Adds static type checking to the foreach loop. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased past r505 (Array -> List in TATs) Created 9 years, 2 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/resolver/CoreTypeProviderImplementation.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/CoreTypeProviderImplementation.java b/compiler/java/com/google/dart/compiler/resolver/CoreTypeProviderImplementation.java
index 0529374d7f8cc1fb5472bb1f702ce947e4e2431e..a18c7ad78eed99c609e37afeacb72a20da3ad669 100644
--- a/compiler/java/com/google/dart/compiler/resolver/CoreTypeProviderImplementation.java
+++ b/compiler/java/com/google/dart/compiler/resolver/CoreTypeProviderImplementation.java
@@ -33,6 +33,7 @@ public class CoreTypeProviderImplementation implements CoreTypeProvider {
private final InterfaceType objectType;
private final InterfaceType isolateType;
private final InterfaceType stringImplementation;
+ private final InterfaceType iteratorType;
public CoreTypeProviderImplementation(Scope scope, DartCompilerListener listener) {
this.intType = getType("int", scope, listener);
@@ -53,6 +54,7 @@ public class CoreTypeProviderImplementation implements CoreTypeProvider {
this.objectType = getType("Object", scope, listener);
this.isolateType = getType("Isolate", scope, listener);
this.stringImplementation = getType("StringImplementation", scope, listener);
+ iteratorType = getType("Iterator", scope, listener);
}
private static InterfaceType getType(String name, Scope scope, DartCompilerListener listener) {
@@ -158,4 +160,10 @@ public class CoreTypeProviderImplementation implements CoreTypeProvider {
public InterfaceType getIsolateType() {
return isolateType;
}
+
+ @Override
+ public InterfaceType getIteratorType(Type elementType) {
+ return iteratorType.subst(Arrays.asList(elementType),
+ iteratorType.getElement().getTypeParameters());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698