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

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

Issue 8479049: Allow for instance checking of methods and function aliases. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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/ResolveVisitor.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
index 133fac6e4465660fdf5f7f91e24919a51b5a46b0..94302583c9431d37c21aafa01941ea4e2a892624 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
@@ -7,6 +7,7 @@ package com.google.dart.compiler.resolver;
import com.google.dart.compiler.ErrorCode;
import com.google.dart.compiler.ast.DartCatchBlock;
import com.google.dart.compiler.ast.DartFunction;
+import com.google.dart.compiler.ast.DartFunctionTypeAlias;
import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.DartNodeTraverser;
import com.google.dart.compiler.ast.DartParameter;
@@ -67,6 +68,46 @@ abstract class ResolveVisitor extends DartNodeTraverser<Element> {
return element;
}
+ final FunctionAliasElement resolveFunctionAlias(DartFunctionTypeAlias node) {
+ List<TypeVariable> typeVariables = Elements.makeTypeVariables(node.getTypeParameters(),
+ node.getSymbol());
+ if (typeVariables != null) {
+ for (TypeVariable typeParameter : typeVariables) {
+ TypeVariableElement variable = (TypeVariableElement) typeParameter.getElement();
+ DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode();
+ DartTypeNode boundNode = typeParameterNode.getBound();
+ Type bound;
+ if (boundNode != null) {
+ bound = getContext().resolveType(boundNode, true, ResolverErrorCode.NO_SUCH_TYPE);
+ boundNode.setType(bound);
+ } else {
+ bound = typeProvider.getObjectType();
+ }
+ variable.setBound(bound);
+ }
+ }
+ DartTypeNode returnType = node.getReturnTypeNode();
+ if (returnType != null) {
+ for (DartTypeNode typeNode : returnType.getTypeArguments()) {
zundel 2011/11/08 15:28:42 It looks to me like these two sections of this met
+// if (!(typeNode.getType().getElement() instanceof TypeVariableElement)) {
+// continue;//??
+// }
+ TypeVariableElement variable = (TypeVariableElement) typeNode.getType().getElement();
+ DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode();
+ DartTypeNode boundNode = typeParameterNode.getBound();
+ Type bound;
+ if (boundNode != null) {
+ bound = getContext().resolveType(boundNode, true, ResolverErrorCode.NO_SUCH_TYPE);
+ boundNode.setType(bound);
+ } else {
+ bound = typeProvider.getObjectType();
+ }
+ variable.setBound(bound);
+ }
+ }
+ return null;
+ }
+
abstract boolean isStaticContext();
@Override

Powered by Google App Engine
This is Rietveld 408576698