Method: GraphQL::Language::Visitor#on_argument_children

Defined in:
lib/graphql/language/visitor.rb

#on_argument_children(new_node) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/graphql/language/visitor.rb', line 142

def on_argument_children(new_node)
  new_node.children.each do |value_node|
    new_child_and_node = case value_node
    when Language::Nodes::VariableIdentifier
      on_variable_identifier_with_modifications(value_node, new_node)
    when Language::Nodes::InputObject
      on_input_object_with_modifications(value_node, new_node)
    when Language::Nodes::Enum
      on_enum_with_modifications(value_node, new_node)
    when Language::Nodes::NullValue
      on_null_value_with_modifications(value_node, new_node)
    else
      raise ArgumentError, "Invariant: unexpected argument value node #{value_node.class} (#{value_node.inspect})"
    end
    # Reassign `node` in case the child hook makes a modification
    if new_child_and_node.is_a?(Array)
      new_node = new_child_and_node[1]
    end
  end
  new_node
end