Class: Yoda::Typing::Tree::VariableAssignment

Inherits:
Base
  • Object
show all
Defined in:
lib/yoda/typing/tree/variable_assignment.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #tracer

Instance Method Summary collapse

Methods inherited from Base

#build_child, #generator, #infer_child, #initialize, #inspect, #pretty_print, #type

Constructor Details

This class inherits a constructor from Yoda::Typing::Tree::Base

Instance Method Details

#body_type ⇒ Types::Type

Returns:



15
16
17
18
19
# File 'lib/yoda/typing/tree/variable_assignment.rb', line 15

def body_type
  @body_type ||= begin
    infer_child(node.content)
  end
end

#infer_type ⇒ Store::Types::Base

Returns:

  • (Store::Types::Base)


9
10
11
12
# File 'lib/yoda/typing/tree/variable_assignment.rb', line 9

def infer_type
  context.type_binding.bind(node.assignee.name, body_type)
  body_type
end

#node ⇒ AST::AssignmentNode

Returns:



# File 'lib/yoda/typing/tree/variable_assignment.rb', line 5