Class: Minjs::ECMA262::This

Inherits:
Literal show all
Defined in:
lib/minjs/ecma262/literal.rb

Overview

Class of ECMA262 ‘this’ element

See Also:

Instance Attribute Summary

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Literal

#lt?, #priority, #side_effect?, #ws?

Methods inherited from Base

#add_remove_paren, #concat, #replace

Constructor Details

#initializeThis

Returns a new instance of This.



145
146
# File 'lib/minjs/ecma262/literal.rb', line 145

def initialize
end

Instance Method Details

#==(obj) ⇒ Object

compare object



162
163
164
# File 'lib/minjs/ecma262/literal.rb', line 162

def ==(obj)
  self.class == obj.class
end

#deep_dupObject

duplicate object

See Also:



150
151
152
# File 'lib/minjs/ecma262/literal.rb', line 150

def deep_dup
  self.class.new
end

#left_hand_side_exp?Boolean

Returns true if expression is kind of LeftHandSideExpression.

Returns:

  • (Boolean)

    true if expression is kind of LeftHandSideExpression.



173
174
175
# File 'lib/minjs/ecma262/literal.rb', line 173

def left_hand_side_exp?
  true
end

#to_js(options = {}) ⇒ Object

Returns a ECMAScript string containg the representation of element.

See Also:



168
169
170
# File 'lib/minjs/ecma262/literal.rb', line 168

def to_js(options = {})
  "this"
end

#traverse(parent) {|parent, _self| ... } ⇒ Object

Traverses this children and itself with given block.

Yields:

Yield Parameters:

See Also:



157
158
159
# File 'lib/minjs/ecma262/literal.rb', line 157

def traverse(parent, &block)
  yield parent, self
end