class TypeProf::Core::AST::BranchNode::LoopNode::BreakNode::NextNode::CaseNode - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::AST::BranchNode::LoopNode::BreakNode::NextNode::CaseNode

### Attributes

clauses[R]
else_clause[R]
pivot[R]
whens[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/control.rb, line 237
    def initialize(raw_node, lenv)
      super(raw_node, lenv)
      @pivot = raw_node.predicate ? AST.create_node(raw_node.predicate, lenv) : nil
      @whens = []
      @clauses = []
      raw_node.conditions.each do |raw_cond|
        @whens << AST.create_node(raw_cond.conditions.first, lenv) # XXX: multiple conditions
        @clauses << (raw_cond.statements ? AST.create_node(raw_cond.statements, lenv) : DummyNilNode.new(code_range, lenv)) # TODO: code_range for NilNode
      end
      @else_clause = raw_node.else_clause && raw_node.else_clause.statements ? AST.create_node(raw_node.else_clause.statements, lenv) : DummyNilNode.new(code_range, lenv) # TODO: code_range for NilNode
    end

### Public Instance Methods

install0(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/control.rb, line 253
    def install0(genv)
      ret = Vertex.new(self)
      @pivot&.install(genv)
      @whens.zip(@clauses) do |vals, clause|
        vals.install(genv)
        @changes.add_edge(genv, clause.install(genv), ret)
      end
      @changes.add_edge(genv, @else_clause.install(genv), ret)
      ret
    end

subnodes(= { pivot:, whens:, clauses:, else_clause: }) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/control.rb, line 251
      def subnodes = { pivot:, whens:, clauses:, else_clause: }

      def install0(genv)
        ret = Vertex.new(self)
        @pivot&.install(genv)
        @whens.zip(@clauses) do |vals, clause|
          vals.install(genv)
          @changes.add_edge(genv, clause.install(genv), ret)
        end
        @changes.add_edge(genv, @else_clause.install(genv), ret)
        ret
      end
    end