Class: RLSL::Prism::CallTypeResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/rlsl/prism/type_inference/call_type_resolver.rb

Instance Method Summary collapse

Constructor Details

#initialize(custom_functions:, call_validator:) ⇒ CallTypeResolver

Returns a new instance of CallTypeResolver.



6
7
8
9
# File 'lib/rlsl/prism/type_inference/call_type_resolver.rb', line 6

def initialize(custom_functions:, call_validator:)
  @custom_functions = custom_functions
  @call_validator = call_validator
end

Instance Method Details

#resolve(node) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/rlsl/prism/type_inference/call_type_resolver.rb', line 11

def resolve(node)
  sig = Builtins.function_signature(node.name)
  return resolve_builtin(node, sig) if sig

  custom_function = @custom_functions[node.name.to_sym]
  return resolve_custom(node, custom_function) if custom_function

  node.receiver&.type
end