class Minjs::ECMA262::ECMA262Object
Class of ECMA262
Array element
@see www.ecma-international.org/ecma-262 ECMA262
11.1.5
Attributes
val[R]
Public Class Methods
new(val)
click to toggle source
val is tupple [[k,v],,…]
# File lib/minjs/ecma262/literal.rb, line 1029 def initialize(val) @val = val end
Public Instance Methods
==(obj)
click to toggle source
compare object
# File lib/minjs/ecma262/literal.rb, line 1051 def ==(obj) self.class == obj.class and @val == obj.val end
deep_dup()
click to toggle source
duplicate object @see Base#deep_dup
# File lib/minjs/ecma262/literal.rb, line 1035 def deep_dup self.class.new(@val.collect{|x, y| [x.deep_dup, y ? y.deep_dup : y]}) end
left_hand_side_exp?()
click to toggle source
@return [Boolean] true if expression is kind of LeftHandSideExpression.
# File lib/minjs/ecma262/literal.rb, line 1078 def left_hand_side_exp? true end
to_ecma262_boolean()
click to toggle source
Returns results of ToBoolean()
Returns true or false if trivial, otherwise nil.
@return [Boolean]
@see www.ecma-international.org/ecma-262 ECMA262
9.2
# File lib/minjs/ecma262/literal.rb, line 1090 def to_ecma262_boolean true end
to_js(options = {})
click to toggle source
Returns a ECMAScript string containg the representation of element. @see Base#to_js
# File lib/minjs/ecma262/literal.rb, line 1057 def to_js(options = {}) concat(options, "{" + @val.collect{|x, y| if y.kind_of? StFunc and (y.getter? || y.setter?) if y.name.val == :get t = concat options, "get", x.val, "()", "{", y.statements, "}" else t = concat options, "set", x.val, "(", y.args[0], ")", "{", y.statements, "}" end else if x.kind_of? ECMA262Numeric t = concat options, x.to_ecma262_string, ":", y elsif idname?(x.val.to_s) t = concat options, x.val, ":", y else t = concat options, x, ":", y end end }.join(","), "}") end
traverse(parent) { |parent, self| ... }
click to toggle source
Traverses this children and itself with given block.
@see Base#traverse
# File lib/minjs/ecma262/literal.rb, line 1042 def traverse(parent, &block) yield parent, self @val.each do |k, v| k.traverse(parent, &block) v.traverse(parent, &block) end end