class TypeProf::Core::EscapeBox::HashSplatBox::MAsgnBox - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::EscapeBox::HashSplatBox::MAsgnBox

### Attributes

lefts[R]
node[R]
rest_elem[R]
rights[R]
value[R]

### Public Class Methods

new(node, genv, value, lefts, rest_elem, rights) click to toggle source
Calls superclass method `TypeProf::Core::Box::new`

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 958
    def initialize(node, genv, value, lefts, rest_elem, rights)
      super(node)
      @value = value
      @lefts = lefts
      @rest_elem = rest_elem
      @rights = rights
      @value.add_edge(genv, self)
    end

### Public Instance Methods

destroy(genv) click to toggle source
Calls superclass method `TypeProf::Core::Box#destroy`

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 969
    def destroy(genv)
      @value.remove_edge(genv, self) # TODO: Is this really needed?
      super(genv)
    end

ret(= @rhs) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 974
      def ret = @rhs

      def run0(genv, changes)
        edges = []
        @value.each_type do |ty|
          # TODO: call to_ary?
          case ty
          when Type::Array
            edges.concat(ty.splat_assign(genv, @lefts, @rest_elem, @rights))
          else
            if @lefts.size >= 1
              edges << [Source.new(ty), @lefts[0]]
            elsif @rights.size >= 1
              edges << [Source.new(ty), @rights[0]]
            else
              edges << [Source.new(ty), @rest_elem]
            end
          end
        end
        edges.each do |src, dst|
          changes.add_edge(genv, src, dst)
        end
      end
    end

run0(genv, changes) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 976
    def run0(genv, changes)
      edges = []
      @value.each_type do |ty|
        # TODO: call to_ary?
        case ty
        when Type::Array
          edges.concat(ty.splat_assign(genv, @lefts, @rest_elem, @rights))
        else
          if @lefts.size >= 1
            edges << [Source.new(ty), @lefts[0]]
          elsif @rights.size >= 1
            edges << [Source.new(ty), @rights[0]]
          else
            edges << [Source.new(ty), @rest_elem]
          end
        end
      end
      edges.each do |src, dst|
        changes.add_edge(genv, src, dst)
      end
    end