class TypeProf::Core::AST::IncludeMetaNode

Attributes

args[R]

Public Class Methods

new(raw_node, lenv) click to toggle source
Calls superclass method TypeProf::Core::AST::Node::new
# File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 4
def initialize(raw_node, lenv)
  super(raw_node, lenv)
  # TODO: error for splat
  @args = raw_node.arguments.arguments.map do |raw_arg|
    next if raw_arg.is_a?(Prism::SplatNode)
    AST.create_node(raw_arg, lenv)
  end.compact
  # TODO: error for non-LIT
  # TODO: fine-grained hover
end

Public Instance Methods

define0(genv) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 19
def define0(genv)
  mod = genv.resolve_cpath(@lenv.cref.cpath)
  @args.each do |arg|
    arg.define(genv)
    if arg.static_ret
      arg.static_ret.followers << mod
      mod.add_include_def(genv, arg)
    end
  end
end
install0(genv) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 41
def install0(genv)
  @args.each {|arg| arg.install(genv) }
  Source.new
end
subnodes(= { args: }) click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 17
  def subnodes = { args: }

  def define0(genv)
    mod = genv.resolve_cpath(@lenv.cref.cpath)
    @args.each do |arg|
      arg.define(genv)
      if arg.static_ret
        arg.static_ret.followers << mod
        mod.add_include_def(genv, arg)
      end
    end
  end

  def undefine0(genv)
    mod = genv.resolve_cpath(@lenv.cref.cpath)
    @args.each do |arg|
      if arg.static_ret
        mod.remove_include_def(genv, arg)
      end
      arg.undefine(genv)
    end
    super(genv)
  end

  def install0(genv)
    @args.each {|arg| arg.install(genv) }
    Source.new
  end
end
undefine0(genv) click to toggle source
Calls superclass method TypeProf::Core::AST::Node#undefine0
# File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 30
def undefine0(genv)
  mod = genv.resolve_cpath(@lenv.cref.cpath)
  @args.each do |arg|
    if arg.static_ret
      mod.remove_include_def(genv, arg)
    end
    arg.undefine(genv)
  end
  super(genv)
end