File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,22 @@ defmodule Macro.Env do
44
55 The current environment can be accessed at any time as
66 `__ENV__`. Inside macros, the caller environment can be
7- accessed as `__CALLER__`. It contains the following fields:
7+ accessed as `__CALLER__`.
8+
9+ An instance of `Macro.Env` must not be modified by hand. If you need to
10+ create a custom environment to pass to `Code.eval_quoted/3`, use the
11+ following trick:
12+
13+ def make_custom_env do
14+ import SomeModule, only: [some_function: 2]
15+ alias A.B.C
16+ __ENV__
17+ end
18+
19+ You may then call `make_custom_env()` to get a struct with the desired
20+ imports and aliases included.
21+
22+ It contains the following fields:
823
924 * `module` - the current module name
1025 * `file` - the current file name as a binary
You can’t perform that action at this time.
0 commit comments