class Minjs::ECMA262::StTryCatch

Attributes

arg[R]
block[R]
exe_context[RW]
var_env[R]

Public Class Methods

new(var_env, arg, block) click to toggle source
# File lib/minjs/ecma262/statement.rb, line 1390
def initialize(var_env, arg, block)
  @var_env = var_env
  @arg = arg
  @block = block
end

Public Instance Methods

deep_dup() click to toggle source

duplicate object @see Base#deep_dup

# File lib/minjs/ecma262/statement.rb, line 1402
def deep_dup
  self.class.new(@var_env,
                 @arg.deep_dup,
                 @block.deep_dup)
end
enter(outer_exe_context) click to toggle source
# File lib/minjs/ecma262/statement.rb, line 1425
def enter(outer_exe_context)
  catch_env = LexEnv.new_declarative_env(outer_exe_context.lex_env)
  catch_env.record.create_mutable_binding(@arg, nil)
  catch_env.record.set_mutable_binding(@arg, :undefined, nil, nil)

  new_exe_context = ExeContext.new
  new_exe_context.lex_env = catch_env
  new_exe_context
end
replace(from, to) click to toggle source

Replaces children object. @see Base#replace

# File lib/minjs/ecma262/statement.rb, line 1417
def replace(from, to)
  if from .eql? @arg
    @arg = to
  elsif from .eql? @block
    @block = to
  end
end
to_js(options = {}) click to toggle source
# File lib/minjs/ecma262/statement.rb, line 1396
def to_js(options = {})
  concat(options, :catch, "(", @arg, ")", @block)
end
traverse(parent) { |parent, self| ... } click to toggle source

Traverses this children and itself with given block.

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