class RuboCop::AST::NodePattern::Compiler::AtomSubcompiler

/docs/modules/ROOT/pages/node_pattern.adoc
Doc on how this fits in the compiling process:
This value responds to ‘===`.
Generates code that evaluates to a value (Ruby object)

def visit_const

def visit_const
  node.child
end

def visit_named_parameter

def visit_named_parameter
  compiler.named_parameter(node.child)
end

def visit_other_type

Assumes other types are node patterns.
def visit_other_type
  compiler.with_temp_variables do |compare|
    code = compiler.compile_as_node_pattern(node, var: compare)
    "->(#{compare}) { #{code} }"
  end
end

def visit_positional_parameter

def visit_positional_parameter
  compiler.positional_parameter(node.child)
end

def visit_set

def visit_set
  set = node.children.map(&:child).to_set.freeze
  NodePattern::Sets[set]
end

def visit_symbol

def visit_symbol
  node.child.inspect
end

def visit_unify

def visit_unify
  compiler.bind(node.child) do
    raise Invalid, 'unified variables can not appear first as argument'
  end
end