Chromium Code Reviews| Index: frog/leg/elements/elements.dart |
| diff --git a/frog/leg/elements/elements.dart b/frog/leg/elements/elements.dart |
| index 2db8b5c485eac375f3e0cb55e1bbefc1ea37af46..c738f335abf750e09743e65df42ee5a647b43f33 100644 |
| --- a/frog/leg/elements/elements.dart |
| +++ b/frog/leg/elements/elements.dart |
| @@ -779,6 +779,51 @@ class ClassElement extends ContainerElement { |
| return supertype === null ? null : supertype.element; |
| } |
| + /** |
| + * Runs through all members of this class. |
| + * |
| + * The enclosing class is passed to the callback. This is useful when |
| + * [includeSuperMembers] is [:true:]. |
| + */ |
| + void forEachMember([void f(ClassElement enclosingClass, Element member), |
| + includeBackendMembers = false, |
| + includeSuperMembers = false]) { |
| + ClassElement classElement = this; |
| + do { |
| + for (Element element in classElement.members) { |
| + f(classElement, element); |
| + } |
| + if (includeBackendMembers) { |
| + for (Element element in classElement.backendMembers) { |
| + f(classElement, element); |
| + } |
| + } |
| + |
|
karlklose
2012/03/29 10:48:04
I would remove this line, the structure of the loo
floitsch
2012/03/29 22:44:50
Done.
|
| + classElement = includeSuperMembers ? classElement.superclass : null; |
| + } while(classElement !== null); |
| + } |
| + |
| + /** |
| + * Runs through all instance-field members of this class. |
| + * |
| + * The enclosing class is passed to the callback. This is useful when |
| + * [includeSuperMembers] is [:true:]. |
| + * |
| + * When [includeBackendMembers] and [includeSuperMembers] are both [:true:] |
| + * then the fields are visited in the same order as they need to be given |
| + * to the JavaScript constructor. |
| + */ |
| + void forEachInstanceField([void f(ClassElement enclosingClass, Element field), |
| + includeBackendMembers = false, |
| + includeSuperMembers = false]) { |
| + forEachMember((ClassElement enclosingClass, Element member) { |
| + if (member.isInstanceMember() && member.kind == ElementKind.FIELD) { |
| + f(enclosingClass, member); |
| + } |
| + }, includeBackendMembers, |
| + includeSuperMembers); |
|
karlklose
2012/03/29 10:48:04
This indentation looks strange. Use the parameter
floitsch
2012/03/29 22:44:50
Moved function out of the call.
If you disagree wi
|
| + } |
| + |
| bool isInterface() => false; |
| bool isNative() => nativeName != null; |
| SourceString nativeName; |