This repository has been archived on 2023-08-07. You can view files and clone it, but cannot push or open issues or pull requests.
temple/lib/temple/ast/right_arrow.ex

24 lines
472 B
Elixir
Raw Normal View History

defmodule Temple.Ast.RightArrow do
2021-01-02 18:21:48 +00:00
@moduledoc false
2020-11-05 00:57:03 +00:00
@behaviour Temple.Parser
2021-04-09 03:04:26 +00:00
use TypedStruct
2020-11-05 00:57:03 +00:00
typedstruct do
field :elixir_ast, Macro.t()
field :children, [map()]
end
@impl true
2020-11-05 00:57:03 +00:00
def applicable?({:->, _, _}), do: true
def applicable?(_), do: false
@impl true
def run({func, meta, [pattern, args]}) do
children = Temple.Parser.parse(args)
2021-03-25 03:01:13 +00:00
Temple.Ast.new(__MODULE__, elixir_ast: {func, meta, [pattern]}, children: children)
2021-04-09 03:04:26 +00:00
end
2020-11-05 00:57:03 +00:00
end