Last active
August 22, 2016 18:39
-
-
Save deadtrickster/d35636c39fa96d536490c18eb775c9c8 to your computer and use it in GitHub Desktop.
Elixir SuperMacro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/elixir-lang/elixir/blob/f4b5e43fc10f6fd6ef84a5ceda8aa3c37131b5a1/lib/elixir/src/elixir_def.erl | |
https://github.com/elixir-lang/elixir/blob/133fc0c40ebdc179b14d51f3e853e3264fd18b5f/lib/elixir/src/elixir_locals.erl | |
https://github.com/elixir-lang/elixir/blob/f33c00bc73650c9ff6ab641b1ad88be9c5c69fc8/lib/elixir/src/elixir_dispatch.erl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule SuperMacro do | |
:ets.insert(:elixir_module.defs_table(SuperMacro), | |
{{:def, {:qwe, 2}}, | |
:defmacro, 0, | |
nil, | |
true, nil, | |
{0, true, 0}}) | |
:ets.insert(:elixir_module.defs_table(SuperMacro), | |
{{:clauses,{:qwe, 2}}, | |
{:clause, 0, | |
[{:var, 0, :_}, | |
{:var,0, :ping}, | |
{:var,0, :pong}], | |
[], | |
[{:tuple, 0, | |
[{:atom, 0, :'+'}, | |
{nil, 0}, | |
{:cons, 0, | |
{:var, 0, :ping}, | |
{:cons, 0, | |
{:var, 0, :pong}, | |
{nil, 0}}}]}]}}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment