Skip to content

Commit 880e0f7

Browse files
jakemac53lrhn
authored andcommitted
specify conditional imports and introspection (#3195)
Closes #3036.
1 parent 30e541f commit 880e0f7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

working/macros/feature-specification.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,23 @@ The primary limitation of this approach is that you will not be able to inspect
103103
the actual types of declarations where the type was omitted prior to phase 3,
104104
but this situation will also be made very explicit to macro authors.
105105

106+
#### Conditional URI directives
107+
108+
When introspecting on a program, which conditional uri directives are selected
109+
(even transitively) may affect what a macro sees. This means that macros may
110+
produce different code based on the conditions present in these directives and
111+
the compilation environment.
112+
113+
It is necessary that it works this way (as opposed to choosing the default for
114+
instance), because we do not require anything other than the selected URI to be
115+
present during compilation. Even the default URI may be missing.
116+
117+
In particular this complicates the debugging experience, as the analysis
118+
environment in the IDE would ideally match up with the compilation environment
119+
for an app during debugging, otherwise stack traces, breakpoints, etc may not
120+
match up. It is generally anticipated that these situations should be rare,
121+
because typically the APIs exposed from conditional directives are identical.
122+
106123
### Ordering in metaprogramming
107124

108125
Macros can read the user's Dart program and modify it. They are also written in

0 commit comments

Comments
 (0)