interceptor v0.3.0 Interceptor.FunctionArguments View Source
Link to this section Summary
Functions
Use this function to get a tuple containing a list with the names of the function arguments and the list of the arguments in AST form
Link to this section Functions
Use this function to get a tuple containing a list with the names of the function arguments and the list of the arguments in AST form.
For the function def abcd(a, b, c), do: 123
you would get:
{
[:a, :b, :c],
[{:a, [], Elixir}, {:b, [], Elixir}, {:c, [], Elixir}]
}
For a function with one or more “anonymous” arguments, this function will assign each argument like this to a random variable.
For the function def foo(x, y, {bar}), do: 42
it would return:
{
[:x, :y, :a1b2c3d],
[
{:x, [], Elixir},
{:y, [], Elixir},
{:=, [], [{:{}, [], [{:bar, [], Elixir}]}, {:a1b2c3d, [], Elixir}]}
]
}
Notice the last assignment to the a1b2c3d
random variable, returning
the argument list in AST form as if the
the function was defined like def foo(x, y, {bar} = a1b2c3d), do: 42
.