Class: Rubex::AST::Statement::BeginBlock::Rescue
- Inherits:
-
Base
- Object
- Rubex::AST::Statement::Base
- Base
- Rubex::AST::Statement::BeginBlock::Rescue
- Defined in:
- lib/rubex/ast/statement/begin_block/rescue.rb
Instance Attribute Summary collapse
-
#error_klass ⇒ Object
readonly
Returns the value of attribute error_klass.
Attributes inherited from Rubex::AST::Statement::Base
Instance Method Summary collapse
- #analyse_statement(local_scope) ⇒ Object
- #generate_code(code, local_scope) ⇒ Object
-
#initialize(error_klass, error_obj, statements, location) ⇒ Rescue
constructor
A new instance of Rescue.
Methods inherited from Rubex::AST::Statement::Base
Constructor Details
#initialize(error_klass, error_obj, statements, location) ⇒ Rescue
Returns a new instance of Rescue.
8 9 10 11 12 |
# File 'lib/rubex/ast/statement/begin_block/rescue.rb', line 8 def initialize(error_klass, error_obj, statements, location) super(statements, location) @error_klass = error_klass @error_obj = error_obj end |
Instance Attribute Details
#error_klass ⇒ Object (readonly)
Returns the value of attribute error_klass.
6 7 8 |
# File 'lib/rubex/ast/statement/begin_block/rescue.rb', line 6 def error_klass @error_klass end |
Instance Method Details
#analyse_statement(local_scope) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubex/ast/statement/begin_block/rescue.rb', line 14 def analyse_statement(local_scope) @error_klass.analyse_types local_scope unless @error_klass.type.ruby_constant? raise "Must pass an error class to raise. Location #{@location}." end @statements.each do |stmt| stmt.analyse_statement local_scope end end |
#generate_code(code, local_scope) ⇒ Object
25 26 27 28 29 |
# File 'lib/rubex/ast/statement/begin_block/rescue.rb', line 25 def generate_code(code, local_scope) @statements.each do |stmt| stmt.generate_code code, local_scope end end |