Skip to content

Commit 89bebbd

Browse files
authored
add interfacesOf method to ClassIntrospector, and some cleanup (#2004)
I had originally thought we allowed cycles in the class hierarchy when it comes to interfaces, but it doesn't look like we do, so we can still have a well defined ordering here (which was the only reason I left this off prior). Also removed the section about adding macro applications to existing declarations. You should be able to just directly invoke the macros inside your macro instead.
1 parent a594308 commit 89bebbd

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

working/macros/api/builders.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ abstract class ClassIntrospector {
7070

7171
/// All of the classes that are mixed in with `with` clauses.
7272
Future<List<ClassDeclaration>> mixinsOf(ClassDeclaration clazz);
73+
74+
/// All of the classes that are implemented with an `implements` clause.
75+
Future<List<ClassDeclaration>> interfacesOf(ClassDeclaration clazz);
7376
}
7477

7578
/// The api used by [Macro]s to reflect on the currently available

working/macros/api/introspection.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ abstract class ClassDeclaration implements TypeDeclaration {
5858
TypeAnnotation? get superclass;
5959

6060
/// All the `implements` type annotations.
61-
Iterable<TypeAnnotation> get implements;
61+
Iterable<TypeAnnotation> get interfaces;
6262

6363
/// All the `with` type annotations.
6464
Iterable<TypeAnnotation> get mixins;

working/macros/feature-specification.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,14 +649,6 @@ If a macro application is added which runs in the same phase as the current
649649
one, then it is immediately expanded after execution of the current macro,
650650
following the normal ordering rules.
651651

652-
#### Adding macro applications to existing declarations
653-
654-
Macro applications can be added to existing declarations using the builder
655-
classes. Macros added in this way are always prepended to the list of existing
656-
macros on the declaration (which makes them run *last*).
657-
658-
**TODO**: Update the builder APIs to allow this.
659-
660652
#### Ordering violations
661653

662654
Both of these mechanisms allow for normal macro ordering to be circumvented.

0 commit comments

Comments
 (0)