Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Annotation.java |
=================================================================== |
--- editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Annotation.java (revision 22889) |
+++ editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/ast/Annotation.java (working copy) |
@@ -13,6 +13,7 @@ |
*/ |
package com.google.dart.engine.ast; |
+import com.google.dart.engine.element.Element; |
import com.google.dart.engine.scanner.Token; |
/** |
@@ -120,6 +121,21 @@ |
return constructorName; |
} |
+ /** |
+ * Return the element associated with this annotation, or {@code null} if the AST structure has |
+ * not been resolved or if this annotation could not be resolved. |
+ * |
+ * @return the element associated with this annotation |
+ */ |
+ public Element getElement() { |
+ if (constructorName != null) { |
+ return constructorName.getElement(); |
+ } else if (name != null) { |
+ return name.getElement(); |
+ } |
+ return null; |
+ } |
+ |
@Override |
public Token getEndToken() { |
if (arguments != null) { |