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

Some renaming.

parent 8e6b985d
No related branches found
No related tags found
No related merge requests found
...@@ -32,16 +32,16 @@ trait CallTransformation ...@@ -32,16 +32,16 @@ trait CallTransformation
println("Here is the extracted FunDef:") println("Here is the extracted FunDef:")
println(fd) println(fd)
val codeGen = new CodeGenerator(unit, currentOwner) val codeGen = new CodeGenerator(unit, currentOwner)
fd.body match { fd.body match {
case None => println("Could not extract choose predicate: " + funBody); super.transform(tree) case None => println("Could not extract choose predicate: " + funBody); super.transform(tree)
case Some(b) => case Some(b) =>
val exprFilename = writeExpr(b) val exprFilename = writeExpr(b)
val (programGet, progSym) = codeGen.generateProgramGet(programFilename) val (programGet, progSym) = codeGen.getProgram(programFilename)
val (exprGet, exprSym) = codeGen.generateExprGet(exprFilename) val (exprGet, exprSym) = codeGen.getExpr(exprFilename)
val solverInvocation = codeGen.generateSolverInvocation(b, progSym, exprSym) val solverInvocation = codeGen.invokeSolver(b, progSym, exprSym)
val code = Block(programGet :: exprGet :: Nil, solverInvocation) val code = Block(programGet :: exprGet :: Nil, solverInvocation)
typer.typed(atOwner(currentOwner) { typer.typed(atOwner(currentOwner) {
......
...@@ -28,7 +28,7 @@ trait CodeGeneration { ...@@ -28,7 +28,7 @@ trait CodeGeneration {
class CodeGenerator(unit : CompilationUnit, owner : Symbol) { class CodeGenerator(unit : CompilationUnit, owner : Symbol) {
def generateProgramGet(filename : String) : (Tree, Symbol) = { def getProgram(filename : String) : (Tree, Symbol) = {
val progSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "prog")).setInfo(programClass.tpe) val progSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "prog")).setInfo(programClass.tpe)
val getStatement = val getStatement =
ValDef( ValDef(
...@@ -47,7 +47,7 @@ trait CodeGeneration { ...@@ -47,7 +47,7 @@ trait CodeGeneration {
(getStatement, progSymbol) (getStatement, progSymbol)
} }
def generateExprGet(filename : String) : (Tree, Symbol) = { def getExpr(filename : String) : (Tree, Symbol) = {
val exprSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "expr")).setInfo(exprClass.tpe) val exprSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "expr")).setInfo(exprClass.tpe)
val getStatement = val getStatement =
ValDef( ValDef(
...@@ -66,7 +66,7 @@ trait CodeGeneration { ...@@ -66,7 +66,7 @@ trait CodeGeneration {
(getStatement, exprSymbol) (getStatement, exprSymbol)
} }
def generateSolverInvocation(formula : Expr, progSymbol : Symbol, exprSymbol : Symbol) : Tree = { def invokeSolver(formula : Expr, progSymbol : Symbol, exprSymbol : Symbol) : Tree = {
val solverSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "solver")).setInfo(fairZ3SolverClass.tpe) val solverSymbol = owner.newValue(NoPosition, unit.fresh.newName(NoPosition, "solver")).setInfo(fairZ3SolverClass.tpe)
val solverDeclaration = val solverDeclaration =
ValDef( ValDef(
...@@ -102,9 +102,9 @@ trait CodeGeneration { ...@@ -102,9 +102,9 @@ trait CodeGeneration {
) )
Block( Block(
solverDeclaration :: setProgram :: invocation :: Nil, solverDeclaration :: setProgram :: invocation :: Nil,
Literal(Constant(0)) Literal(Constant(0))
) )
} }
} }
} }
...@@ -72,6 +72,4 @@ trait Serialization { ...@@ -72,6 +72,4 @@ trait Serialization {
} }
} }
object Serialization extends Serialization { object Serialization extends Serialization
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment