Skip to content
Snippets Groups Projects
Commit e5046873 authored by Ali Sinan Köksal's avatar Ali Sinan Köksal
Browse files

reorganize call transformation a little.

parent 0e8102a6
No related branches found
No related tags found
No related merge requests found
......@@ -32,19 +32,20 @@ trait CallTransformation
println("Here is the extracted FunDef:")
println(fd)
/*
typer.typed(atOwner(currentOwner) {
code
})
*/
super.transform(tree)
/*
val solver = new FairZ3Solver(new DefaultReporter)
solver.setProgram(prog)
println(solver.decide(fd.body.get, false))
*/
val codeGen = new CodeGenerator(unit, currentOwner)
fd.body match {
case None => println("Could not extract choose predicate: " + funBody); super.transform(tree)
case Some(b) =>
val (readProgram, progSym) = codeGen.generateProgramRead(filename)
val solverInvocation = codeGen.generateSolverInvocation(b, progSym)
val code = Block(readProgram :: Nil, solverInvocation)
typer.typed(atOwner(currentOwner) {
code
})
}
}
case _ => super.transform(tree)
......
......@@ -40,7 +40,7 @@ trait CodeGeneration {
(readStatement, progSymbol)
}
def generateSolverInvocation(formula: Expr) : Tree = {
def generateSolverInvocation(formula: Expr, progSymbol: Symbol) : Tree = {
val solverSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "solver")).setInfo(fairZ3SolverClass.tpe)
val solverDeclaration =
ValDef(
......@@ -63,7 +63,7 @@ trait CodeGeneration {
Ident(solverSymbol),
setProgramFunction
),
List(/* read program into a var and plug its symbol here */)
List(Ident(progSymbol))
)
val invocation =
......@@ -72,7 +72,7 @@ trait CodeGeneration {
Ident(solverSymbol),
decideWithModelFunction
),
List(/* convert pred into scala AST and plug it here */)
List(/* convert pred into scala AST of funcheck expression and plug it here */)
)
Block(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment