class TypeProf::Core::ActualArguments - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::ActualArguments

### Attributes

block[R]
keywords[R]
positionals[R]
splat_flags[R]

### Public Class Methods

new(positionals, splat_flags, keywords, block) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/method.rb, line 27
    def initialize(positionals, splat_flags, keywords, block)
      @positionals = positionals
      @splat_flags = splat_flags
      @keywords = keywords
      @block = block
    end

### Public Instance Methods

get_keyword_arg(genv, changes, name) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/method.rb, line 66
    def get_keyword_arg(genv, changes, name)
      vtx = Vertex.new(self)
      @keywords.each_type do |ty|
        case ty
        when Type::Hash
          changes.add_edge(genv, ty.get_value(name), vtx)
        when Type::Instance
          if ty.mod == genv.mod_hash
            changes.add_edge(genv, ty.args[1], vtx)
          end
        else
          # what to do?
        end
      end
      vtx
    end

get_rest_args(genv, start_rest, end_rest) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/method.rb, line 44
    def get_rest_args(genv, start_rest, end_rest)
      vtxs = []

      start_rest.upto(end_rest - 1) do |i|
        a_arg = @positionals[i]
        if @splat_flags[i]
          a_arg.each_type do |ty|
            ty = ty.base_type(genv)
            if ty.is_a?(Type::Instance) && ty.mod == genv.mod_ary && ty.args[0]
              vtxs << ty.args[0].new_vertex(genv, self)
            else
              "???"
            end
          end
        else
          vtxs << a_arg
        end
      end

      vtxs.uniq
    end

new_vertexes(genv, node) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/method.rb, line 36
    def new_vertexes(genv, node)
      positionals = @positionals.map {|arg| arg.new_vertex(genv, node) }
      splat_flags = @splat_flags
      keywords = @keywords ? @keywords.new_vertex(genv, node) : nil
      block = @block ? @block.new_vertex(genv, node) : nil
      ActualArguments.new(positionals, splat_flags, keywords, block)
    end