Class: Mirah::AST::Break

Inherits:
Node
  • Object
show all
Defined in:
lib/mirah/ast/flow.rb,
lib/mirah/compiler/flow.rb

Direct Known Subclasses

Next, Redo

Instance Attribute Summary

Attributes inherited from Node

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

Instance Method Summary collapse

Methods inherited from Node

#<<, ===, #[], #[]=, #_dump, _load, #_set_parent, child, child_name, #child_nodes, #each, #empty?, #expr?, #inferred_type!, #initialize, #initialize_copy, #insert, #inspect, #inspect_children, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #string_value, #temp, #to_s, #top_level?, #validate_child, #validate_children

Constructor Details

This class inherits a constructor from Mirah::AST::Node

Instance Method Details

#compile(compiler, expression) ⇒ Object



56
57
58
59
60
61
# File 'lib/mirah/compiler/flow.rb', line 56

def compile(compiler, expression)
  compiler.line(line_number)
  compiler.break(self)
rescue Exception => ex
  raise Mirah::InternalCompilerError.wrap(ex, self)
end

#infer(typer, expression) ⇒ Object



206
207
208
209
210
211
212
# File 'lib/mirah/ast/flow.rb', line 206

def infer(typer, expression)
  unless resolved?
    resolved!
    @inferred_type = typer.null_type
  end
  @inferred_type
end