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

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

Issue 9692002: Step back and remove more getNode() invocations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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/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 ebd26cfdefb65255c650e27f4a31b9913d6aa79c..7d8b81f573723629e766ece3e16c348bb53e8ed4 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
@@ -5,11 +5,11 @@
package com.google.dart.compiler.resolver;
import com.google.dart.compiler.ErrorCode;
+import com.google.dart.compiler.ast.ASTVisitor;
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.ASTVisitor;
import com.google.dart.compiler.ast.DartParameter;
import com.google.dart.compiler.ast.DartTypeNode;
import com.google.dart.compiler.ast.DartTypeParameter;
@@ -78,14 +78,15 @@ abstract class ResolveVisitor extends ASTVisitor<Element> {
void bindTypeVariable(TypeVariableElement variable) {
DartTypeParameter typeParameterNode = (DartTypeParameter) variable.getNode();
DartTypeNode boundNode = typeParameterNode.getBound();
- Type bound;
if (boundNode != null) {
- bound = getContext().resolveType(boundNode, true, isFactoryContext(), ResolverErrorCode.NO_SUCH_TYPE);
+ Type bound =
+ getContext().resolveType(
+ boundNode,
+ true,
+ isFactoryContext(),
+ ResolverErrorCode.NO_SUCH_TYPE);
boundNode.setType(bound);
- } else {
- bound = typeProvider.getObjectType();
}
- variable.setBound(bound);
}
void bindTypeVariables(List<TypeVariable> typeVariables) {
@@ -110,8 +111,12 @@ abstract class ResolveVisitor extends ASTVisitor<Element> {
? ResolverErrorCode.NO_SUCH_TYPE
: TypeErrorCode.NO_SUCH_TYPE;
Type type = resolveType(node.getTypeNode(), isStaticContext(), isFactoryContext(), typeErrorCode);
- VariableElement element = Elements.parameterElement(node, node.getParameterName(),
- node.getModifiers());
+ VariableElement element =
+ Elements.parameterElement(
+ getEnclosingElement(),
+ node,
+ node.getParameterName(),
+ node.getModifiers());
List<DartParameter> functionParameters = node.getFunctionParameters();
if (functionParameters != null) {
List<VariableElement> parameterElements =
@@ -125,6 +130,10 @@ abstract class ResolveVisitor extends ASTVisitor<Element> {
Elements.setType(element, type);
return recordElement(node, element);
}
+
+ protected Element getEnclosingElement() {
+ return null;
+ }
final Type resolveType(DartTypeNode node, boolean isStatic, boolean isFactory,
ErrorCode errorCode) {

Powered by Google App Engine
This is Rietveld 408576698