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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/ConstructorElementImplementation.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/ConstructorElementImplementation.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/ConstructorElementImplementation.java b/compiler/java/com/google/dart/compiler/resolver/ConstructorElementImplementation.java
index 9f4a96ad32e62d21cdf99871f21430df66e140b8..7f174aaf8d1fb583548e4a30ff1df7d4ea68ec5d 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ConstructorElementImplementation.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ConstructorElementImplementation.java
@@ -4,12 +4,16 @@
package com.google.dart.compiler.resolver;
+import com.google.dart.compiler.ast.DartIdentifier;
import com.google.dart.compiler.ast.DartMethodDefinition;
-import com.google.dart.compiler.ast.Modifiers;
+import com.google.dart.compiler.ast.DartNode;
+import com.google.dart.compiler.ast.DartParameterizedTypeNode;
+import com.google.dart.compiler.ast.DartPropertyAccess;
class ConstructorElementImplementation extends MethodElementImplementation
implements ConstructorElement {
private final ClassElement constructorType;
+ private final String rawName;
private ConstructorElement defaultConstructor;
private ConstructorElementImplementation(DartMethodDefinition node,
@@ -18,18 +22,28 @@ class ConstructorElementImplementation extends MethodElementImplementation
ClassElement constructorType) {
super(node, name, declaringClass);
this.constructorType = constructorType;
+ this.rawName = getRawName(node.getName());
}
- private ConstructorElementImplementation(String name,
- ClassElement declaringClass,
- ClassElement constructorType) {
- super(name, declaringClass, Modifiers.NONE.makeFactory());
- this.constructorType = constructorType;
+ private static String getRawName(DartNode name) {
+ if (name instanceof DartIdentifier) {
+ return ((DartIdentifier) name).getName();
+ } else if (name instanceof DartParameterizedTypeNode) {
+ return getRawName(((DartParameterizedTypeNode) name).getExpression());
+ } else {
+ DartPropertyAccess propertyAccess = (DartPropertyAccess) name;
+ return getRawName(propertyAccess.getQualifier()) + "." + getRawName(propertyAccess.getName());
+ }
}
public ClassElement getConstructorType() {
return constructorType;
}
+
+ @Override
+ public String getRawName() {
+ return rawName;
+ }
@Override
public ElementKind getKind() {
@@ -40,6 +54,11 @@ class ConstructorElementImplementation extends MethodElementImplementation
public boolean isConstructor() {
return true;
}
+
+ @Override
+ public boolean isSynthetic() {
+ return false;
+ }
@Override
public ConstructorElement getDefaultConstructor() {
@@ -57,10 +76,4 @@ class ConstructorElementImplementation extends MethodElementImplementation
ClassElement constructorType) {
return new ConstructorElementImplementation(node, name, declaringClass, constructorType);
}
-
- public static ConstructorElementImplementation named(String name,
- ClassElement declaringClass,
- ClassElement constructorType) {
- return new ConstructorElementImplementation(name, declaringClass, constructorType);
- }
}

Powered by Google App Engine
This is Rietveld 408576698