class TypeProf::Core::AST::BranchNode::LoopNode::BreakNode::NextNode::CaseNode::CaseMatchNode::AndNode::OrNode::ReturnNode::BeginNode - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::AST::BranchNode::LoopNode::BreakNode::NextNode::CaseNode::CaseMatchNode::AndNode::OrNode::ReturnNode::BeginNode

### Attributes

body[R]
else_clause[R]
ensure_clause[R]
rescue_clauses[R]
rescue_conds[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 354
    def initialize(raw_node, lenv)
      super(raw_node, lenv)
      @body = raw_node.statements ? AST.create_node(raw_node.statements, lenv) : DummyNilNode.new(code_range, lenv)
      @rescue_conds = []
      @rescue_clauses = []
      raw_res = raw_node.rescue_clause
      while raw_res
        raw_res.exceptions.each do |raw_cond|
          @rescue_conds << AST.create_node(raw_cond, lenv)
        end
        if raw_res.statements
          @rescue_clauses << AST.create_node(raw_res.statements, lenv)
        end
        raw_res = raw_res.subsequent
      end
      @else_clause = raw_node.else_clause&.statements ? AST.create_node(raw_node.else_clause.statements, lenv) : DummyNilNode.new(code_range, lenv)
      @ensure_clause = raw_node.ensure_clause&.statements ? AST.create_node(raw_node.ensure_clause.statements, lenv) : DummyNilNode.new(code_range, lenv)
    end

### Public Instance Methods

define0(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/control.rb, line 377
    def define0(genv)
      @body.define(genv)
      @rescue_conds.each {|cond| cond.define(genv) }
      @rescue_clauses.each {|clause| clause.define(genv) }
      @else_clause.define(genv) if @else_clause
      @ensure_clause.define(genv) if @ensure_clause
    end

install0(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/control.rb, line 393
    def install0(genv)
      ret = Vertex.new(self)
      @changes.add_edge(genv, @body.install(genv), ret)
      @rescue_conds.each {|cond| cond.install(genv) }
      @rescue_clauses.each {|clause| @changes.add_edge(genv, clause.install(genv), ret) }
      @changes.add_edge(genv, @else_clause.install(genv), ret) if @else_clause
      @ensure_clause.install(genv) if @ensure_clause
      ret
    end

subnodes(= { body:, rescue_conds:, rescue_clauses:, else_clause:, ensure_clause: }) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/control.rb, line 375
      def subnodes = { body:, rescue_conds:, rescue_clauses:, else_clause:, ensure_clause: }

      def define0(genv)
        @body.define(genv)
        @rescue_conds.each {|cond| cond.define(genv) }
        @rescue_clauses.each {|clause| clause.define(genv) }
        @else_clause.define(genv) if @else_clause
        @ensure_clause.define(genv) if @ensure_clause
      end

      def undefine0(genv)
        @body.undefine(genv)
        @rescue_conds.each {|cond| cond.undefine(genv) }
        @rescue_clauses.each {|clause| clause.undefine(genv) }
        @else_clause.undefine(genv) if @else_clause
        @ensure_clause.undefine(genv) if @ensure_clause
      end

      def install0(genv)
        ret = Vertex.new(self)
        @changes.add_edge(genv, @body.install(genv), ret)
        @rescue_conds.each {|cond| cond.install(genv) }
        @rescue_clauses.each {|clause| @changes.add_edge(genv, clause.install(genv), ret) }
        @changes.add_edge(genv, @else_clause.install(genv), ret) if @else_clause
        @ensure_clause.install(genv) if @ensure_clause
        ret
      end
    end

undefine0(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/control.rb, line 385
    def undefine0(genv)
      @body.undefine(genv)
      @rescue_conds.each {|cond| cond.undefine(genv) }
      @rescue_clauses.each {|clause| clause.undefine(genv) }
      @else_clause.undefine(genv) if @else_clause
      @ensure_clause.undefine(genv) if @ensure_clause
    end