Skip to content

Commit

Permalink
refactor(spgroup#31): rename method to isSameVariable()
Browse files Browse the repository at this point in the history
  • Loading branch information
barbosamaatheus committed Dec 22, 2020
1 parent 1aaca69 commit d75103f
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public class InterproceduralOverrideAssignment extends SceneTransformer implemen
private PointsToAnalysis pta;
private AbstractMergeConflictDefinition definition;

// TODO dataflowabstraction provavelmente deve ser subustituido por algo que faça mais sentido na analise inter procedural
// TODO Adicionar tratamento de if, loops... (ForwardFlowAnalysis)
// TODO Add treatment of if, loops ... (ForwardFlowAnalysis)
private FlowSet<DataFlowAbstraction> res;
private Body body;

Expand Down Expand Up @@ -161,9 +160,9 @@ private void gen(Statement stmt) {

private void kill(Unit unit) {
for (DataFlowAbstraction dataFlowAbstraction : res) {
// TODO extrair metodo res.removeAll(unit.getDefBoxes())
// TODO extract method res.removeAll (unit.getDefBoxes ())
for (ValueBox valueBox : unit.getDefBoxes()) {
if (compareItens(valueBox, dataFlowAbstraction)) {
if (isSameVariable(valueBox, dataFlowAbstraction)) {
res.remove(dataFlowAbstraction);
}
}
Expand Down Expand Up @@ -204,7 +203,7 @@ private void detectConflict(Unit u, Statement.Type changeTag, SootMethod sm) {
private void checkConflicts(Unit unit, List<DataFlowAbstraction> potentialConflictingAssignments, Statement.Type changeTag, SootMethod sm) {
for (DataFlowAbstraction dataFlowAbstraction : potentialConflictingAssignments) {
for (ValueBox valueBox : unit.getDefBoxes()) {
if (compareItens(valueBox, dataFlowAbstraction)) {
if (isSameVariable(valueBox, dataFlowAbstraction)) {
Conflict c = new Conflict(getStatementAssociatedWithUnit(sm, unit, changeTag), dataFlowAbstraction.getStmt());
conflicts.add(c);
System.out.println(c);
Expand All @@ -213,9 +212,8 @@ private void checkConflicts(Unit unit, List<DataFlowAbstraction> potentialConfli
}
}

// TODO improve method name
// TODO need to treat other cases (Arrays...)
private boolean compareItens(ValueBox valueBox, DataFlowAbstraction dataFlowAbstraction) {
private boolean isSameVariable(ValueBox valueBox, DataFlowAbstraction dataFlowAbstraction) {
// TODO check why equivTo(Object o) doesn't work
if (valueBox.getValue() instanceof InstanceFieldRef && dataFlowAbstraction.getFieldRef() != null) {
return valueBox.getValue().equivHashCode() == dataFlowAbstraction.getFieldRef().equivHashCode();
Expand Down

0 comments on commit d75103f

Please sign in to comment.