Module: Yoda::Typing::Contexts::ContextDerivation

Included in:
BaseContext
Defined in:
lib/yoda/typing/contexts/context_derivation.rb

Instance Method Summary collapse

Instance Method Details

#constant_refTypes::Type

This method is abstract.

Returns:



19
20
21
# File 'lib/yoda/typing/contexts/context_derivation.rb', line 19

def constant_ref
  fail NotImplementedError
end

#derive_block_context(binds:, receiver_type: nil) ⇒ Object

Parameters:



47
48
49
50
51
52
53
54
55
# File 'lib/yoda/typing/contexts/context_derivation.rb', line 47

def derive_block_context(binds:, receiver_type: nil)
  BlockContext.new(
    parent: self,
    environment: environment,
    receiver: receiver_type || receiver,
    constant_ref: constant_ref,
    binds: binds,
  )
end

#derive_class_context(class_type:) ⇒ Object

Parameters:



24
25
26
27
28
29
30
31
# File 'lib/yoda/typing/contexts/context_derivation.rb', line 24

def derive_class_context(class_type:)
  NamespaceContext.new(
    parent: self,
    environment: environment,
    receiver: class_type,
    constant_ref: class_type,
  )
end

#derive_method_context(receiver_type:, binds:) ⇒ Object

Parameters:



35
36
37
38
39
40
41
42
43
# File 'lib/yoda/typing/contexts/context_derivation.rb', line 35

def derive_method_context(receiver_type:, binds:)
  MethodContext.new(
    parent: self,
    environment: environment,
    receiver: receiver_type,
    constant_ref: constant_ref,
    binds: binds,
  )
end

#environmentModel::Environment

This method is abstract.

Returns:



7
8
9
# File 'lib/yoda/typing/contexts/context_derivation.rb', line 7

def environment
  fail NotImplementedError
end

#receiverTypes::Type

This method is abstract.

Returns:



13
14
15
# File 'lib/yoda/typing/contexts/context_derivation.rb', line 13

def receiver
  fail NotImplementedError
end