variable.ex (724B)
1 defmodule Absinthe.Blueprint.Input.Variable do 2 @moduledoc false 3 4 alias __MODULE__ 5 alias Absinthe.{Blueprint, Phase} 6 7 @enforce_keys [:name] 8 defstruct [ 9 :name, 10 source_location: nil, 11 # Added by phases 12 flags: %{}, 13 errors: [] 14 ] 15 16 @type t :: %__MODULE__{ 17 name: String.t(), 18 source_location: nil | Blueprint.SourceLocation.t(), 19 # Added by phases 20 flags: Blueprint.flags_t(), 21 errors: [Phase.Error.t()] 22 } 23 24 @doc """ 25 Generate a use reference for a variable. 26 """ 27 @spec to_use(t) :: Variable.Use.t() 28 def to_use(%__MODULE__{} = node) do 29 %Variable.Use{ 30 name: node.name, 31 source_location: node.source_location 32 } 33 end 34 end