Skip to content

Commit

Permalink
refactor(spgroup#31): rename type to changeTag
Browse files Browse the repository at this point in the history
  • Loading branch information
barbosamaatheus committed Dec 22, 2020
1 parent b98d8fa commit 70e4ca1
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ protected void internalTransform(String s, Map<String, String> map) {
methods.forEach(m -> traverse(m, traversedMethods, Statement.Type.IN_BETWEEN));
}

// TODO rename type to changeTag
private void traverse(SootMethod sm, List<SootMethod> traversed, Statement.Type type) {
// TODO Verificar o que é isPhantom()
private void traverse(SootMethod sm, List<SootMethod> traversed, Statement.Type changeTag) {

if (visitedMethods.contains(sm) || sm.isPhantom()) {
return;
}
Expand All @@ -79,36 +78,36 @@ private void traverse(SootMethod sm, List<SootMethod> traversed, Statement.Type

body.getUnits().forEach(unit -> {

detectConflict(res, unit, type, sm);
detectConflict(res, unit, changeTag, sm);
// TODO isInLeftStatementFLow ... isInRightStatementFLow
if ((isLeftStatement(unit) || isRightStatement(unit)) ||
(type.equals(Statement.Type.SOURCE) || type.equals(Statement.Type.SINK))) {
(changeTag.equals(Statement.Type.SOURCE) || changeTag.equals(Statement.Type.SINK))) {
// TODO mover if e else para metodos diferentes
if (unit instanceof AssignStmt) {
// TODO Verificar AssignStmt contem objetos, arrays ou outros tipos?
AssignStmt assignStmt = (AssignStmt) unit;

// TODO Verificar caso: x = foo() + foo()
if (assignStmt.containsInvokeExpr()) {
traverse(assignStmt.getInvokeExpr().getMethod(), traversed, type);
traverse(assignStmt.getInvokeExpr().getMethod(), traversed, changeTag);
}

// TODO renomear Statement. (UnitWithExtraInformations)
Statement stmt = getStatementAssociatedWithUnit(sm, unit, type);
Statement stmt = getStatementAssociatedWithUnit(sm, unit, changeTag);
gen(stmt);

// TODO Verificar tratamento em caso de for
} else if (unit instanceof InvokeStmt) {
InvokeStmt invokeStmt = (InvokeStmt) unit;
Statement stmt = getStatementAssociatedWithUnit(sm, unit, type);
// TODO trocar stmt.getType() por type
Statement stmt = getStatementAssociatedWithUnit(sm, unit, changeTag);
// TODO trocar stmt.getType() por changeTag
traverse(invokeStmt.getInvokeExpr().getMethod(), traversed, stmt.getType());
}
} else {
// TODO parametrizar
if (unit instanceof AssignStmt) {
AssignStmt assignStmt = (AssignStmt) unit;
Statement stmt = getStatementAssociatedWithUnit(sm, unit, type);
Statement stmt = getStatementAssociatedWithUnit(sm, unit, changeTag);

if (assignStmt.containsInvokeExpr()) {
traverse(assignStmt.getInvokeExpr().getMethod(), traversed, stmt.getType());
Expand All @@ -118,7 +117,7 @@ private void traverse(SootMethod sm, List<SootMethod> traversed, Statement.Type

} else if (unit instanceof InvokeStmt) {
InvokeStmt invokeStmt = (InvokeStmt) unit;
Statement stmt = getStatementAssociatedWithUnit(sm, unit, type);
Statement stmt = getStatementAssociatedWithUnit(sm, unit, changeTag);
traverse(invokeStmt.getInvokeExpr().getMethod(), traversed, stmt.getType());
}
}
Expand Down

0 comments on commit 70e4ca1

Please sign in to comment.