class Bpl::AST::Block
Public Instance Methods
abstract() { |{ description: "abstracting block", weight: count * 10, action: proc do each {|abs| call} end }| ... }
click to toggle source
# File lib/bpl/passes/transformation/abstraction.rb, line 128 def abstract abss = statements.map {|s| s.abstractions.first}.compact unless abss.empty? yield({ description: "abstracting block", weight: count * 10, action: Proc.new do abss.each {|abs| abs[:action].call} end }) end statements.each_slice(10) do |ss| abss2 = ss.map {|s| s.abstractions.first}.compact unless abss2.empty? yield({ description: "abstracting block slice", weight: ss.map(&:count).inject(:+) * 10, action: Proc.new do abss2.each {|abs| abs[:action].call} end }) end end end
copy()
click to toggle source
# File lib/bpl/ast/statement.rb, line 124 def copy Block.new(names: names.dup, statements: statements.map(&:copy)) end
id()
click to toggle source
# File lib/bpl/ast/statement.rb, line 122 def id; LabelIdentifier.new(name: name, declaration: self) end
name()
click to toggle source
# File lib/bpl/ast/statement.rb, line 121 def name; names.first end
show() { |s| ... }
click to toggle source
# File lib/bpl/ast/statement.rb, line 128 def show ( names.reject(&:empty?).map{|n| "#{n}:"} + statements.map{|s| yield s}) * "\n" end