ExPanda.Walker
(ExPanda v0.2.1)
View Source
Recursive AST walker that expands macros while preserving structural forms.
The walker traverses the AST top-down, applying these rules:
- Structural forms (
defmodule,def/defp,defmacro/defmacrop): preserved as-is, with their bodies recursively expanded. - Directives (
alias,import,require): applied to the environment for subsequent expansions, preserved in output. use: expanded by callingMACRO-__using__/2directly, then re-walked.- Blocks (
__block__): each statement walked sequentially, threading the env. - Expressions: expanded via
:elixir_expand.expand/3(orMacro.expand/2fallback). - Failures: unexpandable nodes are kept with an
@unexpandedmarker prepended.
Summary
Functions
Walk and expand the AST starting from the given environment.
Functions
@spec walk(Macro.t(), Macro.Env.t()) :: {Macro.t(), Macro.Env.t()}
Walk and expand the AST starting from the given environment.
Returns {expanded_ast, final_env}.