Class: Rubinius::AST::OpAssign1

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, arguments, op, value) ⇒ OpAssign1

Returns a new instance of OpAssign1.



45
46
47
48
49
50
51
52
# File 'lib/compiler/ast/operators.rb', line 45

def initialize(line, receiver, arguments, op, value)
  @line = line
  @receiver = receiver
  @op = op
  arguments = nil if arguments.is_a?(EmptyArray)
  @arguments = ActualArguments.new line, arguments
  @value = value
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



43
44
45
# File 'lib/compiler/ast/operators.rb', line 43

def arguments
  @arguments
end

#opObject

Returns the value of attribute op.



43
44
45
# File 'lib/compiler/ast/operators.rb', line 43

def op
  @op
end

#receiverObject

Returns the value of attribute receiver.



43
44
45
# File 'lib/compiler/ast/operators.rb', line 43

def receiver
  @receiver
end

#valueObject

Returns the value of attribute value.



43
44
45
# File 'lib/compiler/ast/operators.rb', line 43

def value
  @value
end

Instance Method Details

#to_sexpObject



54
55
56
57
58
# File 'lib/compiler/ast/operators.rb', line 54

def to_sexp
  arguments = [:arglist] + @arguments.to_sexp
  op = @op == :or ? :"||" : :"&&"
  [:op_asgn1, @receiver.to_sexp, arguments, op, @value.to_sexp]
end