class Bpl::AST::VariableDeclaration

Public Instance Methods

abstract() { |{ description: "abstracting variable", weight: is_a?(Program ? 10e6 : count, elems: [self] + to_a, action: proc do each do |stmt| abss = abstractions fail "No abstraction for statement #{stmt}"| ... } click to toggle source
# File lib/bpl/passes/transformation/abstraction.rb, line 15
def abstract
  stmts = Set.new
  bindings.each do |b|
    next if b.parent.is_a?(ModifiesClause)
    next if b.parent.is_a?(HavocStatement)
    stmts << b.each_ancestor.find {|a| a.is_a?(Statement)}
  end

  yield({
    description: "abstracting variable",
    weight: parent.is_a?(Program) ? 10e6 : bindings.count,
    elems: [self] + stmts.to_a,
    action: Proc.new do
      stmts.each do |stmt|
        abss = stmt.abstractions
        fail "No abstraction for statement #{stmt}" if abss.count == 0
        abss.first[:action].call
      end
    end
  })
end
show() click to toggle source
# File lib/bpl/ast/declaration.rb, line 72
def show; "#{yield :var} #{super};" end
signature() click to toggle source
# File lib/bpl/ast/declaration.rb, line 71
def signature; "var #{@names * ", "}: #{@type}" end