Class: CodeTools::AST::OpAssignAnd

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/code/ast/operators.rb

Direct Known Subclasses

OpAssignOr

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

#initialize(line, left, right) ⇒ OpAssignAnd

Returns a new instance of OpAssignAnd.



431
432
433
434
435
# File 'lib/rubinius/code/ast/operators.rb', line 431

def initialize(line, left, right)
  @line = line
  @left = left
  @right = right
end

Instance Attribute Details

#leftObject

Returns the value of attribute left.



429
430
431
# File 'lib/rubinius/code/ast/operators.rb', line 429

def left
  @left
end

#rightObject

Returns the value of attribute right.



429
430
431
# File 'lib/rubinius/code/ast/operators.rb', line 429

def right
  @right
end

Instance Method Details

#bytecode(g) ⇒ Object



437
438
439
440
441
442
443
444
445
446
447
# File 'lib/rubinius/code/ast/operators.rb', line 437

def bytecode(g)
  pos(g)

  @left.bytecode(g)
  lbl = g.new_label
  g.dup
  g.goto_if_false lbl
  g.pop
  @right.bytecode(g)
  lbl.set!
end

#defined(g) ⇒ Object



449
450
451
# File 'lib/rubinius/code/ast/operators.rb', line 449

def defined(g)
  g.push_literal "assignment"
end

#sexp_nameObject



453
454
455
# File 'lib/rubinius/code/ast/operators.rb', line 453

def sexp_name
  :op_asgn_and
end

#to_sexpObject



457
458
459
# File 'lib/rubinius/code/ast/operators.rb', line 457

def to_sexp
  [sexp_name, @left.to_sexp, @right.to_sexp]
end