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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/AbstractElement.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/AbstractElement.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/AbstractElement.java b/compiler/java/com/google/dart/compiler/resolver/AbstractElement.java
index e44167e3969e93d1d92eab7c937be06ce1dfb8ed..4bacae9e0f4d0370e56ca95927cc0713660299bd 100644
--- a/compiler/java/com/google/dart/compiler/resolver/AbstractElement.java
+++ b/compiler/java/com/google/dart/compiler/resolver/AbstractElement.java
@@ -4,17 +4,20 @@
package com.google.dart.compiler.resolver;
-import com.google.dart.compiler.ast.DartLabel;
import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.Modifiers;
+import com.google.dart.compiler.common.SourceInfo;
import com.google.dart.compiler.type.Type;
import com.google.dart.compiler.type.Types;
abstract class AbstractElement implements Element {
- private DartNode node;
+ private final DartNode node;
private final String name;
+ private SourceInfo sourceInfo;
AbstractElement(DartNode node, String name) {
+ // TODO(scheglov) in the future we will not use ASTNode and remove null check
+ this.sourceInfo = node != null ? node.getSourceInfo() : SourceInfo.UNKNOWN;
this.node = node;
this.name = name;
}
@@ -24,12 +27,6 @@ abstract class AbstractElement implements Element {
return node;
}
- // This method can be removed if NormalizeAst is integrated in Normalizer.
- @Override
- public void setNode(DartLabel node) {
- this.node = node;
- }
-
@Override
public String getName() {
return name;
@@ -68,7 +65,17 @@ abstract class AbstractElement implements Element {
}
@Override
- public EnclosingElement getEnclosingElement() {
+ public Element getEnclosingElement() {
return null;
}
+
+ @Override
+ public SourceInfo getNameLocation() {
+ return sourceInfo;
+ }
+
+ @Override
+ public final SourceInfo getSourceInfo() {
+ return sourceInfo;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698