class TypeProf::Core::AST::StatementsNode::MultiWriteNode::MatchWriteNode::DefinedNode::SplatNode - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::AST::StatementsNode::MultiWriteNode::MatchWriteNode::DefinedNode::SplatNode

### Attributes

expr[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/misc.rb, line 168
    def initialize(raw_node, lenv)
      super(raw_node, lenv)
      @expr = AST.create_node(raw_node.expression, lenv)
    end

### Public Instance Methods

install0(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/misc.rb, line 179
    def install0(genv)
      vtx = @expr.install(genv)

      a_args = ActualArguments.new([], [], nil, nil)
      vtx = @changes.add_method_call_box(genv, vtx, :to_a, a_args, false).ret

      @changes.add_splat_box(genv, vtx).ret
    end

mid_code_range(= nil) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/misc.rb, line 177
      def mid_code_range = nil

      def install0(genv)
        vtx = @expr.install(genv)

        a_args = ActualArguments.new([], [], nil, nil)
        vtx = @changes.add_method_call_box(genv, vtx, :to_a, a_args, false).ret

        @changes.add_splat_box(genv, vtx).ret
      end
    end

subnodes(= { expr: }) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/misc.rb, line 175
      def subnodes = { expr: }

      def mid_code_range = nil

      def install0(genv)
        vtx = @expr.install(genv)

        a_args = ActualArguments.new([], [], nil, nil)
        vtx = @changes.add_method_call_box(genv, vtx, :to_a, a_args, false).ret

        @changes.add_splat_box(genv, vtx).ret
      end
    end

    class ForNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        # XXX: tentative implementation
        # raw_node.index
        @expr = AST.create_node(raw_node.collection, lenv)
        @body = raw_node.statements ? AST.create_node(raw_node.statements, lenv) : DummyNilNode.new(TypeProf::CodeRange.new(code_range.last, code_range.last), lenv)
      end

      attr_reader :expr, :body

      def subnodes = { expr:, body: }

      def install0(genv)
        @expr.install(genv)
        @body.install(genv)
        Source.new(genv.nil_type)
      end
    end

    class FlipFlopNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        @e1 = AST.create_node(raw_node.left, lenv)
        @e2 = AST.create_node(raw_node.right, lenv)
      end

      attr_reader :e1, :e2

      def subnodes = { e1:, e2: }

      def install0(genv)
        @e1.install(genv)
        @e2.install(genv)
        Source.new(genv.true_type, genv.false_type)
      end
    end

    class MatchRequiredNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        @value = AST.create_node(raw_node.value, lenv)
        @pat = AST.create_pattern_node(raw_node.pattern, lenv)
      end

      attr_reader :value, :pat

      def subnodes = { value:, pat: }

      def install0(genv)
        @value.install(genv)
        @pat.install(genv)
        Source.new(genv.nil_type)
      end
    end

    class MatchPreidcateNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        @value = AST.create_node(raw_node.value, lenv)
        @pat = AST.create_pattern_node(raw_node.pattern, lenv)
      end

      attr_reader :value, :pat

      def subnodes = { value:, pat: }

      def install0(genv)
        @value.install(genv)
        @pat.install(genv)
        Source.new(genv.true_type, genv.false_type)
      end