Module: Yoda::Typing::Contexts

Defined in:
lib/yoda/typing/contexts.rb,
lib/yoda/typing/contexts/base_context.rb,
lib/yoda/typing/contexts/block_context.rb,
lib/yoda/typing/contexts/method_context.rb,
lib/yoda/typing/contexts/namespace_context.rb,
lib/yoda/typing/contexts/context_derivation.rb,
lib/yoda/typing/contexts/namespace_block_context.rb

Defined Under Namespace

Modules: ContextDerivation Classes: BaseContext, BlockContext, MethodContext, NamespaceBlockContext, NamespaceContext

Class Method Summary collapse

Class Method Details

.root_scope(environment:) ⇒ NamespaceContext

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/yoda/typing/contexts.rb', line 11

def self.root_scope(environment:)
  generator = Types::Generator.new(environment: environment)

  object_type = generator.instance_type_at("::Object")
  object_class_type = generator.singleton_type_at("::Object")

  NamespaceContext.new(
    environment: environment,
    receiver: object_type,
    constant_ref: object_class_type,
  )
end