Class: Unparser::Emitter::Index::Assign

Inherits:
Unparser::Emitter::Index show all
Defined in:
lib/unparser/emitter/index.rb

Overview

Emitter for assign to index nodes

Constant Summary collapse

VALUE_RANGE =
(1..-2).freeze
NO_VALUE_PARENT =
%i[and_asgn op_asgn or_asgn].to_set.freeze

Constants inherited from Unparser::Emitter

NO_INDENT, REGISTRY

Constants included from Constants

Constants::BINARY_OPERATORS, Constants::KEYWORDS, Constants::K_ALIAS, Constants::K_AND, Constants::K_BEGIN, Constants::K_BREAK, Constants::K_CASE, Constants::K_CLASS, Constants::K_DEF, Constants::K_DEFINE, Constants::K_DEFINED, Constants::K_DO, Constants::K_EEND, Constants::K_ELSE, Constants::K_ELSIF, Constants::K_ENCODING, Constants::K_END, Constants::K_ENSURE, Constants::K_FALSE, Constants::K_FILE, Constants::K_FOR, Constants::K_IF, Constants::K_IN, Constants::K_MODULE, Constants::K_NEXT, Constants::K_NIL, Constants::K_NOT, Constants::K_OR, Constants::K_POSTEXE, Constants::K_PREEXE, Constants::K_REDO, Constants::K_RESCUE, Constants::K_RETRY, Constants::K_RETURN, Constants::K_SELF, Constants::K_SUPER, Constants::K_THEN, Constants::K_TRUE, Constants::K_UNDEF, Constants::K_UNLESS, Constants::K_UNTIL, Constants::K_WHEN, Constants::K_WHILE, Constants::K_YIELD, Constants::UNARY_OPERATORS

Constants included from Generation

Generation::EXTRA_NL

Instance Method Summary collapse

Methods inherited from Unparser::Emitter

emitter, #node_type

Methods included from Generation

#symbol_name, #write_to_buffer

Methods included from NodeHelpers

#n, #n?, #s, #unwrap_single_begin

Instance Method Details

#dispatchObject



47
48
49
50
51
52
# File 'lib/unparser/emitter/index.rb', line 47

def dispatch
  emit_receiver
  emit_operation(children[VALUE_RANGE])
  write(' = ')
  visit(children.last)
end

#emit_heredoc_remindersObject



43
44
45
# File 'lib/unparser/emitter/index.rb', line 43

def emit_heredoc_reminders
  emitter(children.last).emit_heredoc_reminders
end

#emit_mlhsObject



54
55
56
57
# File 'lib/unparser/emitter/index.rb', line 54

def emit_mlhs
  emit_receiver
  emit_operation(children.drop(1))
end