class Minjs::ECMA262::Null

Class of ECMA262 Null element

Every Null literal in source elements is converted to this class object.

This class is singleton

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

Public Class Methods

get() click to toggle source

get instance

# File lib/minjs/ecma262/literal.rb, line 223
def self.get
  @@instance
end

Private Class Methods

new(val) click to toggle source
# File lib/minjs/ecma262/literal.rb, line 187
def initialize(val)
  @val = :null
end

Public Instance Methods

==(obj) click to toggle source

compare object

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

duplicate object @see Base#deep_dup

# File lib/minjs/ecma262/literal.rb, line 193
def deep_dup
  self #not dup
end
ecma262_typeof() click to toggle source

return results of ‘typeof’ operator.

@return [Symbol] :boolean

# File lib/minjs/ecma262/literal.rb, line 266
def ecma262_typeof
  :boolean
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 216
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 235
def to_ecma262_boolean
  false
end
to_ecma262_number() click to toggle source

Returns results of ToNumber()

Returns number if value is trivial, otherwise nil.

@return [Numeric]

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

# File lib/minjs/ecma262/literal.rb, line 259
def to_ecma262_number
  0
end
to_ecma262_string() click to toggle source

Returns results of ToString()

Returns string if value is trivial, otherwise nil.

@return [Numeric]

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

# File lib/minjs/ecma262/literal.rb, line 247
def to_ecma262_string
  "null"
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 211
def to_js(options = {})
  "null"
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 200
def traverse(parent, &block)
  yield parent, self
end