@@ -83,9 +83,14 @@ Here, if `myCoolMacro` resolves to an instance of a class implementing one or
83
83
more of the macro interfaces, then the annotation is treated as an application
84
84
of the ` myCoolMacro ` macro to the class MyClass.
85
85
86
- ### Arguments
86
+ Macro applications can also be passed arguments, either in the form of
87
+ [ Code] [ ] expressions or certain types of literal values. See
88
+ [ Macro Arguments] ( #Macro-arguments ) for more information on how these arguments
89
+ are handled when executing macros.
87
90
88
- Macro applications can also be passed arguments. For example:
91
+ ### Code Arguments
92
+
93
+ Consider this example macro application:
89
94
90
95
``` dart
91
96
int get a => 1;
@@ -97,11 +102,11 @@ class SomeClass {
97
102
}
98
103
```
99
104
100
- Here, ` Add ` is a macro that takes its arguments and produces a function body
101
- that adds them using ` + ` and returns the result.
105
+ Here, ` Add ` is a macro that takes its arguments as expressions and produces a
106
+ function body that adds them using ` + ` and returns the result.
102
107
103
108
Because macros are applied at compile time, the arguments are passed to the
104
- macro as objects representing unevaluated pieces of code . Here, the ` Add ` macro
109
+ macro as objects representing unevaluated expressions . Here, the ` Add ` macro
105
110
receives objects that represent the * literal* ` 1 ` and * the expression* ` a + b ` .
106
111
It takes those and composes them into a function body like:
107
112
0 commit comments