class TypeProf::Core::AST::SigFuncType::SigTyAliasNode::SigTyUnionNode::SigTySingletonNode::SigTyInstanceNode::SigTyTupleNode::SigTyVarNode::SigTyOptionalNode::SigTyLiteralNode::SigTyInterfaceNode
Attributes
args[R]
cpath[R]
toplevel[R]
Public Class Methods
new(raw_decl, lenv)
click to toggle source
Calls superclass method
TypeProf::Core::AST::Node::new
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 602 def initialize(raw_decl, lenv) super(raw_decl, lenv) name = raw_decl.name @cpath = name.namespace.path + [name.name] @toplevel = name.namespace.absolute? # "::Foo" or "Foo" @args = raw_decl.args.map {|arg| AST.create_rbs_type(arg, lenv) } end
Public Instance Methods
attrs(= { cpath:, toplevel: })
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 613 def attrs = { cpath:, toplevel: } def define0(genv) @args.each {|arg| arg.define(genv) } const_reads = [] const_read = BaseConstRead.new(genv, @cpath.first, @toplevel ? CRef::Toplevel : @lenv.cref) const_reads << const_read unless @cpath.empty? @cpath[1..].each do |cname| const_read = ScopedConstRead.new(cname, const_read) const_reads << const_read end end const_reads end def undefine0(genv) @static_ret.each do |const_read| const_read.destroy(genv) end @args.each {|arg| arg.undefine(genv) } end def covariant_vertex0(genv, changes, vtx, subst) changes.add_depended_static_read(@static_ret.last) cpath = @static_ret.last.cpath return unless cpath mod = genv.resolve_cpath(cpath) args = @args.map {|arg| arg.covariant_vertex(genv, changes, subst) } changes.add_edge(genv, Source.new(Type::Instance.new(genv, mod, args)), vtx) end def contravariant_vertex0(genv, changes, vtx, subst) changes.add_depended_static_read(@static_ret.last) cpath = @static_ret.last.cpath return unless cpath mod = genv.resolve_cpath(cpath) args = @args.map {|arg| arg.contravariant_vertex(genv, changes, subst) } changes.add_edge(genv, Source.new(Type::Instance.new(genv, mod, args)), vtx) end def show s = "::#{ @cpath.join("::") }" if !@args.empty? s << "[...]" end s end end
contravariant_vertex0(genv, changes, vtx, subst)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 645 def contravariant_vertex0(genv, changes, vtx, subst) changes.add_depended_static_read(@static_ret.last) cpath = @static_ret.last.cpath return unless cpath mod = genv.resolve_cpath(cpath) args = @args.map {|arg| arg.contravariant_vertex(genv, changes, subst) } changes.add_edge(genv, Source.new(Type::Instance.new(genv, mod, args)), vtx) end
covariant_vertex0(genv, changes, vtx, subst)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 636 def covariant_vertex0(genv, changes, vtx, subst) changes.add_depended_static_read(@static_ret.last) cpath = @static_ret.last.cpath return unless cpath mod = genv.resolve_cpath(cpath) args = @args.map {|arg| arg.covariant_vertex(genv, changes, subst) } changes.add_edge(genv, Source.new(Type::Instance.new(genv, mod, args)), vtx) end
define0(genv)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 615 def define0(genv) @args.each {|arg| arg.define(genv) } const_reads = [] const_read = BaseConstRead.new(genv, @cpath.first, @toplevel ? CRef::Toplevel : @lenv.cref) const_reads << const_read unless @cpath.empty? @cpath[1..].each do |cname| const_read = ScopedConstRead.new(cname, const_read) const_reads << const_read end end const_reads end
show()
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 654 def show s = "::#{ @cpath.join("::") }" if !@args.empty? s << "[...]" end s end
subnodes(= { args: })
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 612 def subnodes = { args: } def attrs = { cpath:, toplevel: } def define0(genv) @args.each {|arg| arg.define(genv) } const_reads = [] const_read = BaseConstRead.new(genv, @cpath.first, @toplevel ? CRef::Toplevel : @lenv.cref) const_reads << const_read unless @cpath.empty? @cpath[1..].each do |cname| const_read = ScopedConstRead.new(cname, const_read) const_reads << const_read end end const_reads end def undefine0(genv) @static_ret.each do |const_read| const_read.destroy(genv) end @args.each {|arg| arg.undefine(genv) } end def covariant_vertex0(genv, changes, vtx, subst) changes.add_depended_static_read(@static_ret.last) cpath = @static_ret.last.cpath return unless cpath mod = genv.resolve_cpath(cpath) args = @args.map {|arg| arg.covariant_vertex(genv, changes, subst) } changes.add_edge(genv, Source.new(Type::Instance.new(genv, mod, args)), vtx) end def contravariant_vertex0(genv, changes, vtx, subst) changes.add_depended_static_read(@static_ret.last) cpath = @static_ret.last.cpath return unless cpath mod = genv.resolve_cpath(cpath) args = @args.map {|arg| arg.contravariant_vertex(genv, changes, subst) } changes.add_edge(genv, Source.new(Type::Instance.new(genv, mod, args)), vtx) end def show s = "::#{ @cpath.join("::") }" if !@args.empty? s << "[...]" end s end end end
undefine0(genv)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 629 def undefine0(genv) @static_ret.each do |const_read| const_read.destroy(genv) end @args.each {|arg| arg.undefine(genv) } end