Class: Yoda::Typing::LexicalScope

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/typing/lexical_scope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, ancestor_paths) ⇒ LexicalScope

Returns a new instance of LexicalScope.

Parameters:



12
13
14
15
# File 'lib/yoda/typing/lexical_scope.rb', line 12

def initialize(namespace, ancestor_paths)
  @namespace = namespace
  @ancestor_paths = ancestor_paths
end

Instance Attribute Details

#ancestor_pathsArray<Path> (readonly)

Returns:

  • (Array<Path>)


8
9
10
# File 'lib/yoda/typing/lexical_scope.rb', line 8

def ancestor_paths
  @ancestor_paths
end

#namespaceStore::Objects::Base (readonly)



5
6
7
# File 'lib/yoda/typing/lexical_scope.rb', line 5

def namespace
  @namespace
end

Instance Method Details

#find_constant(registry, constant_name) ⇒ Store::Objects::Base?

Parameters:

Returns:



20
21
22
23
# File 'lib/yoda/typing/lexical_scope.rb', line 20

def find_constant(registry, constant_name)
  scoped_path = Model::ScopedPath.new(ancestor_paths, constant_name)
  Store::Query::FindConstant.new(registry).find(scoped_path)
end