Class: Duby::AST::Self

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

Instance Attribute Summary

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?, #expr?, #initialize, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s

Constructor Details

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

Instance Method Details

#compile(compiler, expression) ⇒ Object



320
321
322
323
324
325
# File 'lib/duby/compiler.rb', line 320

def compile(compiler, expression)
  if expression
    compiler.line(line_number)
    compiler.compile_self
  end
end

#infer(typer) ⇒ Object



366
367
368
# File 'lib/duby/ast.rb', line 366

def infer(typer)
  @inferred_type ||= typer.self_type
end