inline_fragment.ex (1002B)
1 defmodule Absinthe.Language.InlineFragment do 2 @moduledoc false 3 4 alias Absinthe.{Blueprint, Language} 5 6 defstruct type_condition: nil, 7 directives: [], 8 selection_set: nil, 9 loc: %{line: nil} 10 11 @type t :: %__MODULE__{ 12 type_condition: nil | Language.NamedType.t(), 13 directives: [Language.Directive.t()], 14 selection_set: Language.SelectionSet.t(), 15 loc: Language.loc_t() 16 } 17 18 defimpl Blueprint.Draft do 19 def convert(node, doc) do 20 %Blueprint.Document.Fragment.Inline{ 21 type_condition: Blueprint.Draft.convert(node.type_condition, doc), 22 selections: Blueprint.Draft.convert(node.selection_set.selections, doc), 23 directives: Blueprint.Draft.convert(node.directives, doc), 24 source_location: source_location(node) 25 } 26 end 27 28 defp source_location(%{loc: nil}) do 29 nil 30 end 31 32 defp source_location(%{loc: loc}) do 33 Blueprint.SourceLocation.at(loc) 34 end 35 end 36 end