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

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

Issue 10913033: Issue 4849. Disabling using inferred types for warnings should also disable invocation argument typ… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Replace <dynamic> with Dynamic 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 0cc2c64a0681f4bac88abd2aa9c28cd53229357a..625046664f494d87ec1a4f25a33d11cc8296f35e 100644
--- a/compiler/java/com/google/dart/compiler/type/Types.java
+++ b/compiler/java/com/google/dart/compiler/type/Types.java
@@ -5,6 +5,7 @@
package com.google.dart.compiler.type;
import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -648,10 +649,21 @@ public class Types {
inferred = (Type) Proxy.newProxyInstance(type.getClass().getClassLoader(),
interfaces, new InvocationHandler() {
@Override
+ @SuppressWarnings("unchecked")
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (args == null && method.getName().equals("isInferred")) {
return true;
}
+ if (type instanceof FunctionType) {
+ if (args == null && method.getName().equals("getParameterTypes")) {
+ List<Type> originalTypes = (List<Type>) method.invoke(type, args);
+ return Lists.transform(originalTypes, new Function<Type, Type>() {
+ public Type apply(Type input) {
+ return makeInferred(input);
+ }
+ });
+ }
+ }
return method.invoke(type, args);
}
});

Powered by Google App Engine
This is Rietveld 408576698