Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/VariableDeclaration.java |
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/VariableDeclaration.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/VariableDeclaration.java |
index 0deb91b136123c08648603cf07c23266d93c6baa..d488da746515f2937dc85391fbc29dc0c764a96c 100644 |
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/VariableDeclaration.java |
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/VariableDeclaration.java |
@@ -13,6 +13,7 @@ |
*/ |
package com.google.dart.engine.ast; |
+import com.google.dart.engine.element.VariableElement; |
import com.google.dart.engine.scanner.Token; |
import java.util.List; |
@@ -67,6 +68,16 @@ public class VariableDeclaration extends Declaration { |
return visitor.visitVariableDeclaration(this); |
} |
+ /** |
+ * Return the {@link VariableElement} associated with this variable, or {@code null} if the AST |
+ * structure has not been resolved. |
+ * |
+ * @return the {@link VariableElement} associated with this variable |
+ */ |
+ public VariableElement getElement() { |
+ return name != null ? (VariableElement) name.getElement() : null; |
+ } |
+ |
@Override |
public Token getEndToken() { |
if (initializer != null) { |
@@ -142,4 +153,5 @@ public class VariableDeclaration extends Declaration { |
protected Token getFirstTokenAfterCommentAndMetadata() { |
return name.getBeginToken(); |
} |
+ |
} |