Class: IV::Phonic::AST::TryStatement

Inherits:
Statement show all
Defined in:
lib/iv/phonic/ast.rb

Instance Method Summary collapse

Methods inherited from Statement

as

Methods inherited from Node

#begin_position, #end_position, #program, #source

Constructor Details

#initialize(parent, stmt) ⇒ TryStatement

Returns a new instance of TryStatement.



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/iv/phonic/ast.rb', line 271

def initialize parent, stmt
  super parent, stmt
  @body = Statement.as self, stmt[:body]
  if stmt[:catch_name]
    @catch_name = Identifier.new self, stmt[:catch_name]
    @catch_block = Block.new self, stmt[:catch_block]
  else
    @catch_name = nil
    @catch_block = nil
  end
  if stmt[:finally_block]
    @finally_block = Block.new self, stmt[:finally_block]
  else
    @finally_block = nil
  end
end