Sha256: 8977b036c087b0ec11958d93978f95573746b3bcafa29a09e119770081d3b132
Contents?: true
Size: 1.24 KB
Versions: 37
Compression:
Stored size: 1.24 KB
Contents
module Steep module TypeInference class ConstantEnv attr_reader :context attr_reader :factory attr_reader :resolver def initialize(factory:, context:, resolver:) @factory = factory @context = context @resolver = resolver end def resolve(name) decompose_constant( resolver.resolve(name, context: context) ) end def toplevel(name) decompose_constant( resolver.table.toplevel[name] ) end def constants cs = resolver.constants(context) or raise cs.transform_values {|c| decompose_constant!(c) } end def resolve_child(module_name, constant_name) decompose_constant( resolver.resolve_child(module_name, constant_name) ) end def children(module_name) resolver.children(module_name).transform_values {|c| decompose_constant!(c) } end def decompose_constant!(constant) decompose_constant(constant) || raise end def decompose_constant(constant) if constant [ factory.type(constant.type), constant.name, constant.entry ] end end end end end
Version data entries
37 entries across 37 versions & 1 rubygems