class TypeProf::Core::AST::SigModuleBaseNode::SigClassNode - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::AST::SigModuleBaseNode::SigClassNode

### Attributes

superclass_args[R]
superclass_cpath[R]
superclass_toplevel[R]

### Public Class Methods

new(raw_decl, lenv) click to toggle source
Calls superclass method `TypeProf::Core::AST::SigModuleBaseNode::new`

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 124
    def initialize(raw_decl, lenv)
      super(raw_decl, lenv)
      superclass = raw_decl.super_class
      if superclass
        name = superclass.name
        @superclass_cpath = name.namespace.path + [name.name]
        @superclass_toplevel = name.namespace.absolute?
        @superclass_args = superclass.args.map {|arg| AST.create_rbs_type(arg, lenv) }
      else
        @superclass_cpath = nil
        @superclass_toplevel = nil
        @superclass_args = nil
      end
    end

### Public Instance Methods

attrs() click to toggle source
Calls superclass method `TypeProf::Core::AST::SigModuleBaseNode#attrs`

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 144
    def attrs
      super.merge!({ superclass_cpath:, superclass_toplevel: })
    end

define0(genv) click to toggle source
Calls superclass method `TypeProf::Core::AST::SigModuleBaseNode#define0`

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 148
    def define0(genv)
      static_ret = super(genv)
      const_reads = []
      if @superclass_cpath
        @superclass_args.each {|arg| arg.define(genv) }
        const_read = BaseConstRead.new(genv, @superclass_cpath.first, @superclass_toplevel ? CRef::Toplevel : @lenv.cref)
        const_reads << const_read
        @superclass_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
      end
      static_ret[:superclass_cpath] = const_reads
      static_ret
    end

subnodes() click to toggle source
Calls superclass method `TypeProf::Core::AST::SigModuleBaseNode#subnodes`

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 141
    def subnodes
      super.merge!({ superclass_args: })
    end

undefine0(genv) click to toggle source
Calls superclass method `TypeProf::Core::AST::SigModuleBaseNode#undefine0`

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_decl.rb, line 166
    def undefine0(genv)
      super(genv)
      if @static_ret
        @static_ret[:superclass_cpath].each do |const_read|
          const_read.destroy(genv)
        end
      end
      if @superclass_args
        @superclass_args.each {|arg| arg.undefine(genv) }
      end
    end