Class: Duby::AST::Ensure

Inherits:
Node
  • Object
show all
Defined in:
lib/duby/ast/flow.rb,
lib/duby/compiler.rb,
lib/duby/jvm/source_generator/precompile.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #inferred_type, #newline, #parent, #position

Instance Method Summary collapse

Methods inherited from Node

#<<, ===, #[], #_set_parent, child, child_name, #each, #empty?, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s

Constructor Details

#initialize(parent, position, &block) ⇒ Ensure

Returns a new instance of Ensure.



341
342
343
# File 'lib/duby/ast/flow.rb', line 341

def initialize(parent, position, &block)
  super(parent, position, &block)
end

Instance Attribute Details

#stateObject

Used by the some compilers.



339
340
341
# File 'lib/duby/ast/flow.rb', line 339

def state
  @state
end

Instance Method Details

#compile(compiler, expression) ⇒ Object



313
314
315
316
# File 'lib/duby/compiler.rb', line 313

def compile(compiler, expression)
  compiler.line(line_number)
  compiler.ensure(self, expression)
end

#expr?(compiler) ⇒ Boolean

Returns:



170
171
172
# File 'lib/duby/jvm/source_generator/precompile.rb', line 170

def expr?(compiler)
  false
end

#infer(typer) ⇒ Object



345
346
347
348
349
350
# File 'lib/duby/ast/flow.rb', line 345

def infer(typer)
  resolve_if(typer) do
    typer.infer(clause)
    typer.infer(body)
  end
end