Class: Minjs::ECMA262::ExpStrictEq

Inherits:
Expression show all
Includes:
BinaryOperation
Defined in:
lib/minjs/ecma262/expression.rb

Overview

Class of the Strict Equals operator expression element.

See Also:

Instance Attribute Summary

Attributes included from BinaryOperation

#val, #val2

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods included from BinaryOperation

#==, #add_paren, #deep_dup, #remove_paren, #replace, #to_js, #traverse

Methods inherited from Expression

#left_hand_side_exp?, #side_effect?

Methods inherited from Base

#==, #add_remove_paren, #concat, #deep_dup, #replace, #to_js, #traverse

Constructor Details

#initialize(val, val2) ⇒ ExpStrictEq

Returns a new instance of ExpStrictEq.



1634
1635
1636
1637
# File 'lib/minjs/ecma262/expression.rb', line 1634

def initialize(val, val2)
  @val = val
  @val2 = val2
end

Instance Method Details

#ecma262_typeofSymbol

return results of ‘typeof’ operator.

Returns:

  • (Symbol)

    :boolean



1661
1662
1663
# File 'lib/minjs/ecma262/expression.rb', line 1661

def ecma262_typeof
  :boolean
end

#priorityFixnum

Returns expression priority.

Returns:

  • (Fixnum)

    expression priority



1645
1646
1647
# File 'lib/minjs/ecma262/expression.rb', line 1645

def priority
  PRIORITY_EQUALITY
end

#reduce(parent) ⇒ Object

reduce expression if available

Parameters:

  • parent (Base)

    parent element



1651
1652
1653
1654
1655
1656
# File 'lib/minjs/ecma262/expression.rb', line 1651

def reduce(parent)
  if @val.respond_to?(:ecma262_typeof) and @val2.respond_to?(:ecma262_typeof) and
     (t = @val.ecma262_typeof) == @val2.ecma262_typeof and !t.nil?
    parent.replace(self, ExpEq.new(@val, @val2))
  end
end

#symObject

symbol of expression



1640
1641
1642
# File 'lib/minjs/ecma262/expression.rb', line 1640

def sym
  "==="
end