class Minjs::ECMA262::ECMA262RegExp

Class of ECMA262 RegExp element

@see www.ecma-international.org/ecma-262 ECMA262 7.8.5

Attributes

body[R]
flags[R]

Public Class Methods

new(body, flags) click to toggle source
# File lib/minjs/ecma262/literal.rb, line 919
def initialize(body, flags)
  @body = body
  @flags = flags
end

Public Instance Methods

==(obj) click to toggle source

compare object

# File lib/minjs/ecma262/literal.rb, line 950
def ==(obj)
  self.class == obj.class and @body == obj.body and @flags == obj.flags
end
deep_dup() click to toggle source

duplicate object @see Base#deep_dup

# File lib/minjs/ecma262/literal.rb, line 926
def deep_dup
  self.class.new(@body, @flags)
end
left_hand_side_exp?() click to toggle source

@return [Boolean] true if expression is kind of LeftHandSideExpression.

# File lib/minjs/ecma262/literal.rb, line 961
def left_hand_side_exp?
  true
end
to_ecma262_boolean() click to toggle source

Returns results of ToBoolean()

Returns true or false if trivial, otherwise nil.

@return [Boolean]

@see www.ecma-international.org/ecma-262 ECMA262 9.2

# File lib/minjs/ecma262/literal.rb, line 945
def to_ecma262_boolean
  true
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/literal.rb, line 956
def to_js(options = {})
  "/#{@body}/#{@flags}"
end
traverse(parent) { |parent, self| ... } click to toggle source

Traverses this children and itself with given block.

@see Base#traverse

# File lib/minjs/ecma262/literal.rb, line 933
def traverse(parent)
  yield parent, self
end