Class: Mirah::AST::Implements

Inherits:
Node
  • Object
show all
Defined in:
lib/mirah/ast/class.rb

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(*args) ⇒ Object



141
142
# File 'lib/mirah/ast/class.rb', line 141

def compile(*args)
end

#infer(typer, expression) ⇒ Object



132
133
134
135
136
137
138
139
140
# File 'lib/mirah/ast/class.rb', line 132

def infer(typer, expression)
  resolve_if(typer) do
    klass = parent
    klass = klass.parent until ClassDefinition === klass
    interfaces = children.map {|i| i.type_reference(typer) }
    klass.implements(*interfaces)
    typer.no_type
  end
end