Class: Rubinius::AST::OpAssign2

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

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, node_name, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk

Constructor Details

#initialize(line, receiver, name, op, value) ⇒ OpAssign2

Returns a new instance of OpAssign2.



64
65
66
67
68
69
70
71
# File 'lib/compiler/ast/operators.rb', line 64

def initialize(line, receiver, name, op, value)
  @line = line
  @receiver = receiver
  @name = name
  @op = op
  @value = value
  @assign = name.to_s[-1] == ?= ? name : :"#{name}="
end

Instance Attribute Details

#assignObject

Returns the value of attribute assign.



62
63
64
# File 'lib/compiler/ast/operators.rb', line 62

def assign
  @assign
end

#nameObject

Returns the value of attribute name.



62
63
64
# File 'lib/compiler/ast/operators.rb', line 62

def name
  @name
end

#opObject

Returns the value of attribute op.



62
63
64
# File 'lib/compiler/ast/operators.rb', line 62

def op
  @op
end

#receiverObject

Returns the value of attribute receiver.



62
63
64
# File 'lib/compiler/ast/operators.rb', line 62

def receiver
  @receiver
end

#valueObject

Returns the value of attribute value.



62
63
64
# File 'lib/compiler/ast/operators.rb', line 62

def value
  @value
end

Instance Method Details

#to_sexpObject



73
74
75
76
# File 'lib/compiler/ast/operators.rb', line 73

def to_sexp
  op = @op == :or ? :"||" : :"&&"
  [:op_asgn2, @receiver.to_sexp, :"#{@name}=", op, @value.to_sexp]
end