Fix incorrect variable declaration

This commit is contained in:
Skylot
2013-03-23 19:24:56 +04:00
parent 79114520bd
commit 478d186a95
2 changed files with 12 additions and 6 deletions
@@ -114,12 +114,6 @@ public class ProcessVariables extends AbstractVisitor {
continue;
// }
}
// suppose variables always initialized
if (u.getAssigns().size() == 1 && u.getUseRegions().size() <= 1) {
r.getParentInsn().getAttributes().add(new DeclareVariableAttr());
it.remove();
continue;
}
// check if we can declare variable at current assigns
for (IRegion assignRegion : u.getAssigns()) {
if (canDeclareInRegion(u, assignRegion)) {
@@ -131,6 +131,17 @@ public class TestTryCatch extends AbstractTest {
return obj.toString() != null;
}
public Object mObject = new Object();
public boolean mDiscovering = true;
private boolean testSynchronize3() {
boolean b = false;
synchronized (mObject) {
b = this.mDiscovering;
}
return b;
}
@Override
public boolean testRun() throws Exception {
Object obj = new Object();
@@ -147,6 +158,7 @@ public class TestTryCatch extends AbstractTest {
assertTrue(testSynchronize("str") == false);
assertTrue(testSynchronize2("str"));
assertTrue(testSynchronize3());
return true;
}