Class: Minjs::ECMA262::ExpPositive

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

Overview

Class of the Positive operator expression element.

See Also:

Instance Attribute Summary

Attributes included from UnaryOperation

#val

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods included from UnaryOperation

#==, #add_paren, #deep_dup, #remove_paren, #replace, #side_effect?, #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) ⇒ ExpPositive

Returns a new instance of ExpPositive.



973
974
975
# File 'lib/minjs/ecma262/expression.rb', line 973

def initialize(val)
  @val = val
end

Instance Method Details

#ecma262_typeofSymbol

return results of ‘typeof’ operator.

Returns:

  • (Symbol)

    :number



998
999
1000
# File 'lib/minjs/ecma262/expression.rb', line 998

def ecma262_typeof
  :number
end

#priorityFixnum

Returns expression priority.

Returns:

  • (Fixnum)

    expression priority



983
984
985
# File 'lib/minjs/ecma262/expression.rb', line 983

def priority
  PRIORITY_UNARY
end

#reduce(parent) ⇒ Object

reduce expression if available

Parameters:

  • parent (Base)

    parent element



989
990
991
992
993
# File 'lib/minjs/ecma262/expression.rb', line 989

def reduce(parent)
  if @val.kind_of? ECMA262Numeric
    parent.replace(self, @val)
  end
end

#symObject

symbol of expression



978
979
980
# File 'lib/minjs/ecma262/expression.rb', line 978

def sym
  "+"
end