@@ -299,6 +299,7 @@ defmodule Macro.Env do
299
299
300
300
It does not check or assert the module is available.
301
301
This is used by tools which need to mimic the Elixir compiler.
302
+ The appropriate `:require` compiler tracing event will be emitted.
302
303
303
304
## Additional options
304
305
@@ -337,7 +338,8 @@ defmodule Macro.Env do
337
338
Defines the given `module` as imported in the environment.
338
339
339
340
It assumes `module` is available. This is used by tools which
340
- need to mimic the Elixir compiler.
341
+ need to mimic the Elixir compiler. The appropriate `:import`
342
+ compiler tracing event will be emitted.
341
343
342
344
## Additional options
343
345
@@ -381,6 +383,7 @@ defmodule Macro.Env do
381
383
Defines the given `as` an alias to `module` in the environment.
382
384
383
385
This is used by tools which need to mimic the Elixir compiler.
386
+ The appropriate `:alias` compiler tracing event will be emitted.
384
387
385
388
## Additional options
386
389
@@ -484,6 +487,9 @@ defmodule Macro.Env do
484
487
If the import points to a function, it returns a tuple
485
488
with the module and the function name.
486
489
490
+ If any import is found, the appropriate compiler tracing
491
+ event will be emitted.
492
+
487
493
Otherwise returns `:error`.
488
494
489
495
## Options
@@ -533,6 +539,9 @@ defmodule Macro.Env do
533
539
required, it returns a tuple with the module and a function
534
540
that expands the macro. The function expects the metadata
535
541
to be attached to the expansion and the arguments of the macro.
542
+ The appropriate `:remote_macro` compiler tracing event will
543
+ be emitted if a macro is found (note a `:remote_function`
544
+ event is not emitted in `:error` cases).
536
545
537
546
Otherwise returns `:error`.
538
547
@@ -579,6 +588,15 @@ defmodule Macro.Env do
579
588
end
580
589
end
581
590
591
+ @ doc """
592
+ Returns an environment in the guard context.
593
+ """
594
+ @ doc since: "1.17.0"
595
+ @ spec to_guard ( t ) :: t
596
+ def to_guard ( % { __struct__: Macro.Env } = env ) do
597
+ % { env | context: :guard }
598
+ end
599
+
582
600
@ doc """
583
601
Returns an environment in the match context.
584
602
"""
0 commit comments