class TypeProf::Core::AST::SigModuleBaseNode::SigModuleNode

Attributes

self_type_args[R]
self_types[R]

Public Class Methods

new(raw_decl, lenv) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 65
def initialize(raw_decl, lenv)
  super(raw_decl, lenv)
  @self_types = []
  @self_type_args = []
  raw_decl.self_types.each do |self_type|
    name = self_type.name
    cpath = name.namespace.path + [self_type.name.name]
    toplevel = name.namespace.absolute?
    @self_types << [cpath, toplevel]
    @self_type_args << self_type.args.map {|arg| AST.create_rbs_type(arg, lenv) }
  end
end

Public Instance Methods

attrs() click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 83
def attrs
  super.merge!({ self_types: })
end
define0(genv) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 87
def define0(genv)
  static_ret = super(genv)
  static_ret[:self_types] = self_types = []
  @self_types.zip(@self_type_args) do |(cpath, toplevel), args|
    args.each {|arg| arg.define(genv) }
    const_read = BaseConstRead.new(genv, cpath.first, toplevel ? CRef::Toplevel : @lenv.cref)
    const_reads = [const_read]
    cpath[1..].each do |cname|
      const_read = ScopedConstRead.new(cname, const_read)
      const_reads << const_read
    end
    mod = genv.resolve_cpath(@cpath)
    const_read.followers << mod
    self_types << const_reads
  end
  static_ret
end
subnodes() click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 80
def subnodes
  super.merge!({ self_type_args: })
end
undefine0(genv) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 105
def undefine0(genv)
  super(genv)
  if @static_ret
    @static_ret[:self_types].each do |const_reads|
      const_reads.each do |const_read|
        const_read.destroy(genv)
      end
    end
  end
  @self_type_args.each do |args|
    args.each {|arg| arg.undefine(genv) }
  end
end