Andre Henriques
47c040e75f
All checks were successful
continuous-integration/drone/push Build is passing
44 lines
595 B
Elixir
44 lines
595 B
Elixir
defmodule Test do
|
|
|
|
defmacro test() do
|
|
quote do
|
|
a = 1
|
|
end
|
|
end
|
|
|
|
defmacro createfuncBase(name, do: do_exp, else: else_exp) do
|
|
b1 = quote do
|
|
false -> unquote(else_exp)
|
|
end
|
|
|
|
b2 = b1 ++ do_exp
|
|
|
|
t = quote do
|
|
def test(v) do
|
|
case v do
|
|
unquote(b2)
|
|
end
|
|
end
|
|
end
|
|
|
|
IO.puts("test #{inspect(t)}")
|
|
|
|
t
|
|
end
|
|
|
|
end
|
|
|
|
defmodule Test2 do
|
|
require Test
|
|
|
|
def test2() do
|
|
a = 2
|
|
test
|
|
IO.puts("#{a}")
|
|
end
|
|
|
|
Test.createfuncBase :lol do
|
|
true -> :test
|
|
else :test1 end
|
|
end
|