Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
[ci skip] Always add return to patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
FWDekker committed Jul 2, 2018
1 parent 153472e commit 11637ef
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import soot.Unit
import soot.Value
import soot.VoidType
import soot.jimple.ArrayRef
import soot.jimple.AssignStmt
import soot.jimple.DoubleConstant
import soot.jimple.FieldRef
import soot.jimple.FloatConstant
Expand Down Expand Up @@ -147,8 +148,16 @@ internal class ClassGenerator(className: String) {
else lastStatement.op.type
is JReturnVoidStmt -> VoidType.v()
else -> {
jimpleBody.units.add(Jimple.v().newReturnVoidStmt())
VoidType.v()
val lastAss = jimpleBody.units
.filterIsInstance<AssignStmt>()
.lastOrNull()
if (lastAss == null) {
jimpleBody.units.add(Jimple.v().newReturnVoidStmt())
VoidType.v()
} else {
jimpleBody.units.add(Jimple.v().newReturnStmt(lastAss.leftOp))
lastAss.leftOp.type
}
}
}
}
Expand Down

0 comments on commit 11637ef

Please sign in to comment.