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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/VariableDeclaration.java

Issue 11787017: Initial implementation of MemoryIndexStoreImpl and IndexContributor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update for review comments Created 7 years, 11 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: 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();
}
+
}

Powered by Google App Engine
This is Rietveld 408576698