Module: Holistic::Ruby::TypeInference::Solve

Extended by:
Solve
Included in:
Solve
Defined in:
lib/holistic/ruby/type_inference/solve.rb

Instance Method Summary collapse

Instance Method Details

#call(application:, reference:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/holistic/ruby/type_inference/solve.rb', line 7

def call(application:, reference:)
  referenced_scope =
    solve_scope_reference(application:, reference:) ||
    solve_method_call(application:, reference:)

  if referenced_scope
    reference.relation(:referenced_scope).add!(referenced_scope)

    # NOTE: should this be an event that is handled by stdlib? I guess inheritance support with dedicated syntax
    # is part of the language core, so it makes sense being here. Let me think about this for a bit.
    reference.find_clue(Clue::ReferenceToSuperclass)&.then do |reference_to_superclass_clue|
      referenced_scope.relation(:descendants).add!(reference_to_superclass_clue.subclass_scope)
    end
  end
end