Module: TypeProf::Core::ConstRead

Included in:
BaseConstRead, ScopedConstRead
Defined in:
lib/typeprof/core/env/static_read.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cdefObject (readonly)

Returns the value of attribute cdef.



113
114
115
# File 'lib/typeprof/core/env/static_read.rb', line 113

def cdef
  @cdef
end

#cpathObject (readonly)

Returns the value of attribute cpath.



113
114
115
# File 'lib/typeprof/core/env/static_read.rb', line 113

def cpath
  @cpath
end

Instance Method Details

#check_module(genv, mod) ⇒ Object



90
91
92
93
94
95
96
97
98
99
# File 'lib/typeprof/core/env/static_read.rb', line 90

def check_module(genv, mod)
  cdef = mod.consts[@name]
  if cdef && cdef.exist?
    inner_mod = genv.resolve_cpath(mod.cpath + [@name]) # TODO
    cpath = inner_mod.exist? ? inner_mod.cpath : nil
    update_module(genv, cpath, cdef)
    return true
  end
  return false
end

#resolution_failed(genv) ⇒ Object



101
102
103
# File 'lib/typeprof/core/env/static_read.rb', line 101

def resolution_failed(genv)
  update_module(genv, nil, nil)
end

#update_module(genv, cpath, cdef) ⇒ Object



105
106
107
108
109
110
111
# File 'lib/typeprof/core/env/static_read.rb', line 105

def update_module(genv, cpath, cdef)
  if cpath != @cpath || cdef != @cdef
    @cpath = cpath
    @cdef = cdef
    propagate(genv)
  end
end