Module: Minjs::ECMA262::AssignmentOperation

Instance Method Summary collapse

Instance Method Details

#==(obj) ⇒ Object



112
113
114
# File 'lib/minjs/ecma262/exp.rb', line 112

def ==(obj)
  self.class == obj.class and self.val == obj.val and self.val2 == obj.val2
end

#add_parenObject



102
103
104
105
106
107
108
109
110
# File 'lib/minjs/ecma262/exp.rb', line 102

def add_paren
  if @val.priority > PRIORITY_LEFT_HAND_SIDE
    @val = ExpParen.new(@val)
  end
  if @val2.priority > PRIORITY_ASSIGNMENT
    @val2 = ExpParen.new(@val2)
  end
  self
end

#ecma262_typeofObject



116
117
118
119
120
121
122
# File 'lib/minjs/ecma262/exp.rb', line 116

def ecma262_typeof
  if @val2.respond_to? :ecma262_typeof
    @val2.ecma262_typeof
  else
    nil
  end
end

#remove_parenObject



92
93
94
95
96
97
98
99
100
# File 'lib/minjs/ecma262/exp.rb', line 92

def remove_paren
  if @val.kind_of? ExpParen and @val.val.priority <= PRIORITY_LEFT_HAND_SIDE
    @val = @val.val if @val.remove_paren?
  end
  if @val2.kind_of? ExpParen and @val2.val.priority <= PRIORITY_ASSIGNMENT
    @val2 = @val2.val
  end
  self
end