class GraphQL::Upgrader::Member::FieldFinder
def add_location(send_node:,source_node:)
-
source_node
(node
) -- The node whose source defines the bounds of the definition (eg, the surrounding block) -
send_node
(node
) -- The node which might be a `field` call, etc
def add_location(send_node:,source_node:) receiver_node, method_name, *arg_nodes = *send_node # Implicit self and one of the recognized methods if receiver_node.nil? && DEFINITION_METHODS.include?(method_name) name = arg_nodes[0] # This field may have already been added because # we find `(block ...)` nodes _before_ we find `(send ...)` nodes. if @locations[method_name][name].nil? starting_idx = source_node.loc.expression.begin.begin_pos ending_idx = source_node.loc.expression.end.end_pos @locations[method_name][name] = [starting_idx, ending_idx] end end end