Class: Minjs::ECMA262::StTryCatch
- Defined in:
- lib/minjs/ecma262/statement.rb
Instance Attribute Summary collapse
-
#arg ⇒ Object
readonly
Returns the value of attribute arg.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#exe_context ⇒ Object
Returns the value of attribute exe_context.
-
#var_env ⇒ Object
readonly
Returns the value of attribute var_env.
Attributes inherited from Base
Instance Method Summary collapse
-
#deep_dup ⇒ Object
duplicate object.
- #enter(outer_exe_context) ⇒ Object
-
#initialize(var_env, arg, block) ⇒ StTryCatch
constructor
A new instance of StTryCatch.
-
#replace(from, to) ⇒ Object
Replaces children object.
- #to_js(options = {}) ⇒ Object
-
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
Methods inherited from Statement
#empty?, #priority, #to_exp?, #to_return?
Methods inherited from Base
#==, #add_remove_paren, #concat
Constructor Details
#initialize(var_env, arg, block) ⇒ StTryCatch
Returns a new instance of StTryCatch.
1390 1391 1392 1393 1394 |
# File 'lib/minjs/ecma262/statement.rb', line 1390 def initialize(var_env, arg, block) @var_env = var_env @arg = arg @block = block end |
Instance Attribute Details
#arg ⇒ Object (readonly)
Returns the value of attribute arg.
1386 1387 1388 |
# File 'lib/minjs/ecma262/statement.rb', line 1386 def arg @arg end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
1387 1388 1389 |
# File 'lib/minjs/ecma262/statement.rb', line 1387 def block @block end |
#exe_context ⇒ Object
Returns the value of attribute exe_context.
1388 1389 1390 |
# File 'lib/minjs/ecma262/statement.rb', line 1388 def exe_context @exe_context end |
#var_env ⇒ Object (readonly)
Returns the value of attribute var_env.
1385 1386 1387 |
# File 'lib/minjs/ecma262/statement.rb', line 1385 def var_env @var_env end |
Instance Method Details
#deep_dup ⇒ Object
duplicate object
1402 1403 1404 1405 1406 |
# 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) ⇒ Object
1425 1426 1427 1428 1429 1430 1431 1432 1433 |
# 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) ⇒ Object
Replaces children object.
1417 1418 1419 1420 1421 1422 1423 |
# 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 = {}) ⇒ Object
1396 1397 1398 |
# File 'lib/minjs/ecma262/statement.rb', line 1396 def to_js( = {}) concat(, :catch, "(", @arg, ")", @block) end |
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
1409 1410 1411 1412 1413 |
# File 'lib/minjs/ecma262/statement.rb', line 1409 def traverse(parent, &block) @arg.traverse(self, &block) @block.traverse(self, &block) yield parent, self end |