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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Elements.java

Issue 9315061: Specify the types for Element.classes, Element.elements and Node.nodes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed dynamic type error issue with VM. 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/Elements.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Elements.java b/compiler/java/com/google/dart/compiler/resolver/Elements.java
index 245423de16ae9fe5aa90f6cc1ae6015eb2cf63be..68be0355b2b7379685130d46553d345b52df76ea 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
@@ -278,6 +278,62 @@ static FieldElementImplementation fieldFromNode(DartField node,
}
/**
+ * @return <code>non-null</code> {@link MethodElement} if "holder", or one of its
+ * interfaces, or its superclass has {@link FieldElement} with getter.
+ */
+ public static MethodElement lookupFieldElementGetter(ClassElement holder, String name) {
+ Element element = holder.lookupLocalElement(name);
+ if (element instanceof FieldElement) {
+ FieldElement fieldElement = (FieldElement) element;
+ MethodElement result = fieldElement.getGetter();
+ if (result != null) {
+ return fieldElement.getGetter();
+ }
+ }
+ for (InterfaceType interfaceType : holder.getInterfaces()) {
+ MethodElement result = lookupFieldElementGetter(interfaceType.getElement(), name);
+ if (result != null) {
+ return result;
+ }
+ }
+ if (holder.getSupertype() != null) {
+ MethodElement result = lookupFieldElementGetter(holder.getSupertype().getElement(), name);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return <code>non-null</code> {@link MethodElement} if "holder", or one of its interfaces,
+ * or its superclass has {@link FieldElement} with setter.
+ */
+ public static MethodElement lookupFieldElementSetter(ClassElement holder, String name) {
+ Element element = holder.lookupLocalElement(name);
+ if (element instanceof FieldElement) {
+ FieldElement fieldElement = (FieldElement) element;
+ MethodElement result = fieldElement.getSetter();
+ if (result != null) {
+ return result;
+ }
+ }
+ for (InterfaceType interfaceType : holder.getInterfaces()) {
+ MethodElement result = lookupFieldElementSetter(interfaceType.getElement(), name);
+ if (result != null) {
+ return result;
+ }
+ }
+ if (holder.getSupertype() != null) {
+ MethodElement result = lookupFieldElementSetter(holder.getSupertype().getElement(), name);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
* @return <code>true</code> if {@link DartNode} of given {@link Element} if part of static
* {@link DartClassMember} or part of top level declaration.
*/

Powered by Google App Engine
This is Rietveld 408576698