class TypeProf::Core::StaticRead - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::StaticRead

### Attributes

followers[R]
name[R]

### Public Class Methods

new(name) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/static_read.rb, line 3
    def initialize(name)
      @name = name
      @followers = Set[]
      @source_modules = Set[]
    end

### Public Instance Methods

destroy(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/static_read.rb, line 26
    def destroy(genv)
      @source_modules.each do |mod|
        mod.static_reads[@name].delete(self) || raise
      end
      @source_modules.clear
    end

propagate(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/static_read.rb, line 11
    def propagate(genv)
      @followers.each do |follower|
        case follower
        when ModuleEntity
          genv.add_static_eval_queue(:parent_modules_changed, follower)
        when ScopedStaticRead
          follower.on_cbase_updated(genv)
        when Box, IsAFilter
          genv.add_run(follower)
        else
          raise follower.inspect
        end
      end
    end

resolve(genv, cref, break_object) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/static_read.rb, line 33
    def resolve(genv, cref, break_object)
      destroy(genv)

      first = true
      while cref
        scope = cref.cpath
        mod = genv.resolve_cpath(scope)
        genv.each_superclass(mod, false) do |mod, _singleton|
          break if mod == genv.mod_object && break_object

          unless @source_modules.include?(mod)
            @source_modules << mod
            (mod.static_reads[@name] ||= Set[]) << self
          end

          return if check_module(genv, mod)

          break unless first
        end
        first = false
        cref = cref.outer
      end
      resolution_failed(genv)
    end