class Minjs::ECMA262::StLabelled

Base class of ECMA262 LabelledStatement element.

@see www.ecma-international.org/ecma-262 ECMA262 12.12

Attributes

label[R]
statement[R]

Public Class Methods

new(label, statement) click to toggle source
# File lib/minjs/ecma262/statement.rb, line 1307
def initialize(label, statement)
  @label = label
  @statement = statement
end

Public Instance Methods

==(obj) click to toggle source

compare object

# File lib/minjs/ecma262/statement.rb, line 1336
def ==(obj)
  self.class == obj.class and
    @label == obj.label and
    @statement == obj.statement
end
deep_dup() click to toggle source

duplicate object @see Base#deep_dup

# File lib/minjs/ecma262/statement.rb, line 1314
def deep_dup
  self.class.new(@label.deep_dup, @statement.deep_dup)
end
replace(from, to) click to toggle source

Replaces children object. @see Base#replace

# File lib/minjs/ecma262/statement.rb, line 1320
def replace(from, to)
  if from .eql? @label
    @label = to
  elsif from .eql? @statement
    @statement = to
  end
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/statement.rb, line 1344
def to_js(options = {})
  concat options, @label, ":", @statement
end
traverse(parent) { |parent, self| ... } click to toggle source

Traverses this children and itself with given block.

# File lib/minjs/ecma262/statement.rb, line 1329
def traverse(parent, &block)
  @label.traverse(self, &block)
  @statement.traverse(self, &block)
  yield parent, self
end