Class: Minjs::ECMA262::ExpLogicalOr
- Inherits:
-
Expression
- Object
- Base
- Expression
- Minjs::ECMA262::ExpLogicalOr
- Includes:
- BinaryOperation
- Defined in:
- lib/minjs/ecma262/expression.rb
Overview
Class of the Bitwise Logical Or operator expression element.
Instance Attribute Summary
Attributes included from BinaryOperation
Attributes inherited from Base
Instance Method Summary collapse
-
#ecma262_typeof ⇒ Symbol
return results of ‘typeof’ operator.
-
#initialize(val, val2) ⇒ ExpLogicalOr
constructor
A new instance of ExpLogicalOr.
-
#priority ⇒ Fixnum
Expression priority.
-
#sym ⇒ Object
symbol of expression.
-
#to_ecma262_boolean ⇒ Boolean
Returns results of ToBoolean().
Methods included from BinaryOperation
#==, #add_paren, #deep_dup, #remove_paren, #replace, #to_js, #traverse
Methods inherited from Expression
#left_hand_side_exp?, #reduce, #side_effect?
Methods inherited from Base
#==, #add_remove_paren, #concat, #deep_dup, #replace, #to_js, #traverse
Constructor Details
#initialize(val, val2) ⇒ ExpLogicalOr
Returns a new instance of ExpLogicalOr.
1841 1842 1843 1844 |
# File 'lib/minjs/ecma262/expression.rb', line 1841 def initialize(val, val2) @val = val @val2 = val2 end |
Instance Method Details
#ecma262_typeof ⇒ Symbol
return results of ‘typeof’ operator.
1877 1878 1879 1880 1881 1882 1883 1884 |
# File 'lib/minjs/ecma262/expression.rb', line 1877 def ecma262_typeof if @val.respond_to? :ecma262_typeof and @val2.respond_to? :ecma262_typeof if @val.ecma262_typeof == @val2.ecma262_typeof return @val.ecma262_typeof end end nil end |
#priority ⇒ Fixnum
Returns expression priority.
1852 1853 1854 |
# File 'lib/minjs/ecma262/expression.rb', line 1852 def priority PRIORITY_LOGICAL_OR end |
#sym ⇒ Object
symbol of expression
1847 1848 1849 |
# File 'lib/minjs/ecma262/expression.rb', line 1847 def sym "||" end |
#to_ecma262_boolean ⇒ Boolean
Returns results of ToBoolean()
Returns true or false if trivial, otherwise nil.
1864 1865 1866 1867 1868 1869 1870 1871 1872 |
# File 'lib/minjs/ecma262/expression.rb', line 1864 def to_ecma262_boolean return nil if !(@val.respond_to? :to_ecma262_boolean) return nil if @val.to_ecma262_boolean == nil return true if @val.to_ecma262_boolean == true return nil if !(@val2.respond_to? :to_ecma262_boolean) return nil if @val2.to_ecma262_boolean == nil return true if @val2.to_ecma262_boolean == true false end |