Skip to content

Commit 2965d6d

Browse files
authored
[macros] Appling a macro in the wrong place is an error. (#3556)
1 parent e410078 commit 2965d6d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

working/macros/feature-specification.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ implement in order to apply the macro in a given phase on a given declaration.
666666
For example, a macro applied to classes in the declaration phase implements
667667
`ClassDeclarationsMacro` and its `buildDeclarationsForClass` method.
668668

669+
The set of macro interfaces implemented determines where the macro can
670+
usefully be applied, and it is a compile error to apply it anywhere else. For
671+
example, if a macro does not implement any of the `Class*Macro` interfaces, it
672+
is a compile error to apply it to a class.
673+
669674
When a Dart implementation executes macros, it invokes these builder methods at
670675
the appropriate phase for the declarations the macro is applied to. Each builder
671676
method is passed two arguments which give the macro the context and capabilities

0 commit comments

Comments
 (0)