class TypeProf::Core::AST::BranchNode::LoopNode::BreakNode::NextNode::CaseNode::CaseMatchNode
Attributes
clauses[R]
else_clause[R]
patterns[R]
pivot[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 266 def initialize(raw_node, lenv) super(raw_node, lenv) @pivot = AST.create_node(raw_node.predicate, lenv) @patterns = [] @clauses = [] raw_node.conditions.each do |raw_cond| raise if raw_cond.type != :in_node @patterns << AST.create_pattern_node(raw_cond.pattern, lenv) @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) : nil end
Public Instance Methods
install0(genv)
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/control.rb, line 283 def install0(genv) ret = Vertex.new(self) @pivot&.install(genv) @patterns.zip(@clauses) do |pattern, clause| pattern.install(genv) @changes.add_edge(genv, clause.install(genv), ret) end @changes.add_edge(genv, @else_clause.install(genv), ret) if @else_clause ret end
subnodes(= { pivot:, patterns:, clauses:, else_clause: })
click to toggle source
# File typeprof-0.30.1/lib/typeprof/core/ast/control.rb, line 281 def subnodes = { pivot:, patterns:, clauses:, else_clause: } def install0(genv) ret = Vertex.new(self) @pivot&.install(genv) @patterns.zip(@clauses) do |pattern, clause| pattern.install(genv) @changes.add_edge(genv, clause.install(genv), ret) end @changes.add_edge(genv, @else_clause.install(genv), ret) if @else_clause ret end end