Class: Minjs::ECMA262::Null
- Defined in:
- lib/minjs/ecma262/literal.rb
Overview
Class of ECMA262 Null element
Every Null literal in source elements is converted to this class object.
This class is singleton
Constant Summary collapse
- @@instance =
self.new(nil)
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.get ⇒ Object
get instance.
Instance Method Summary collapse
-
#==(obj) ⇒ Object
compare object.
-
#deep_dup ⇒ Object
duplicate object.
-
#ecma262_typeof ⇒ Symbol
return results of ‘typeof’ operator.
-
#initialize(val) ⇒ Null
constructor
A new instance of Null.
-
#left_hand_side_exp? ⇒ Boolean
True if expression is kind of LeftHandSideExpression.
-
#to_ecma262_boolean ⇒ Boolean
Returns results of ToBoolean().
-
#to_ecma262_number ⇒ Numeric
Returns results of ToNumber().
-
#to_ecma262_string ⇒ Numeric
Returns results of ToString().
-
#to_js(options = {}) ⇒ Object
Returns a ECMAScript string containg the representation of element.
-
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
Methods inherited from Literal
#lt?, #priority, #side_effect?, #ws?
Methods inherited from Base
#add_remove_paren, #concat, #replace
Constructor Details
#initialize(val) ⇒ Null
Returns a new instance of Null.
187 188 189 |
# File 'lib/minjs/ecma262/literal.rb', line 187 def initialize(val) @val = :null end |
Class Method Details
.get ⇒ Object
get instance
223 224 225 |
# File 'lib/minjs/ecma262/literal.rb', line 223 def self.get @@instance end |
Instance Method Details
#==(obj) ⇒ Object
compare object
205 206 207 |
# File 'lib/minjs/ecma262/literal.rb', line 205 def ==(obj) self.class == obj.class end |
#deep_dup ⇒ Object
duplicate object
193 194 195 |
# File 'lib/minjs/ecma262/literal.rb', line 193 def deep_dup self #not dup end |
#ecma262_typeof ⇒ Symbol
return results of ‘typeof’ operator.
266 267 268 |
# File 'lib/minjs/ecma262/literal.rb', line 266 def ecma262_typeof :boolean end |
#left_hand_side_exp? ⇒ Boolean
Returns true if expression is kind of LeftHandSideExpression.
216 217 218 |
# File 'lib/minjs/ecma262/literal.rb', line 216 def left_hand_side_exp? true end |
#to_ecma262_boolean ⇒ Boolean
Returns results of ToBoolean()
Returns true or false if trivial, otherwise nil.
235 236 237 |
# File 'lib/minjs/ecma262/literal.rb', line 235 def to_ecma262_boolean false end |
#to_ecma262_number ⇒ Numeric
Returns results of ToNumber()
Returns number if value is trivial, otherwise nil.
259 260 261 |
# File 'lib/minjs/ecma262/literal.rb', line 259 def to_ecma262_number 0 end |
#to_ecma262_string ⇒ Numeric
Returns results of ToString()
Returns string if value is trivial, otherwise nil.
247 248 249 |
# File 'lib/minjs/ecma262/literal.rb', line 247 def to_ecma262_string "null" end |
#to_js(options = {}) ⇒ Object
Returns a ECMAScript string containg the representation of element.
211 212 213 |
# File 'lib/minjs/ecma262/literal.rb', line 211 def to_js( = {}) "null" end |
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
200 201 202 |
# File 'lib/minjs/ecma262/literal.rb', line 200 def traverse(parent, &block) yield parent, self end |