module Minjs::ECMA262::UnaryOperation
Module of typically unary operation expression.
Typically unary operation expression has one values(val) and operation symbol.
Attributes
val[R]
Public Instance Methods
==(obj)
click to toggle source
compare object
# File lib/minjs/ecma262/expression.rb, line 152 def ==(obj) self.class == obj.class and self.val == obj.val end
add_paren()
click to toggle source
add parenthesis if need
# File lib/minjs/ecma262/expression.rb, line 143 def add_paren if @val.priority > self.priority @val = ExpParen.new(@val) end self end
deep_dup()
click to toggle source
duplicate object @see Base#deep_dup
# File lib/minjs/ecma262/expression.rb, line 158 def deep_dup self.class.new(@val.deep_dup) end
remove_paren()
click to toggle source
remove parenthesis if possible
# File lib/minjs/ecma262/expression.rb, line 135 def remove_paren if @val.kind_of? ExpParen and @val.val.priority <= self.priority @val = @val.val end self end
replace(from, to)
click to toggle source
Replaces children object. @see Base#replace
# File lib/minjs/ecma262/expression.rb, line 164 def replace(from, to) if @val .eql? from @val = to end end
side_effect?()
click to toggle source
Returns this element has side effect or not. @return [Boolean]
# File lib/minjs/ecma262/expression.rb, line 185 def side_effect? @val.side_effect? end
to_js(options = {})
click to toggle source
Returns a ECMAScript string containg the representation of element. @see Base#to_js
# File lib/minjs/ecma262/expression.rb, line 179 def to_js(options = {}) concat options, sym, @val end
traverse(parent) { |parent, self| ... }
click to toggle source
Traverses this children and itself with given block. @see Base#traverse
# File lib/minjs/ecma262/expression.rb, line 172 def traverse(parent, &block) @val.traverse(self, &block) yield parent, self end