Class: Minjs::ECMA262::ExpStrictNotEq

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

Overview

Class of the Strict Does-not-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) ⇒ ExpStrictNotEq

Returns a new instance of ExpStrictNotEq.



1670
1671
1672
1673
# File 'lib/minjs/ecma262/expression.rb', line 1670

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

Instance Method Details

#ecma262_typeofSymbol

return results of ‘typeof’ operator.

Returns:

  • (Symbol)

    :boolean



1697
1698
1699
# File 'lib/minjs/ecma262/expression.rb', line 1697

def ecma262_typeof
  :boolean
end

#priorityFixnum

Returns expression priority.

Returns:

  • (Fixnum)

    expression priority



1681
1682
1683
# File 'lib/minjs/ecma262/expression.rb', line 1681

def priority
  PRIORITY_EQUALITY
end

#reduce(parent) ⇒ Object

reduce expression if available

Parameters:

  • parent (Base)

    parent element



1687
1688
1689
1690
1691
1692
# File 'lib/minjs/ecma262/expression.rb', line 1687

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, ExpNotEq.new(@val, @val2))
  end
end

#symObject

symbol of expression



1676
1677
1678
# File 'lib/minjs/ecma262/expression.rb', line 1676

def sym
  "!=="
end