Commit 478d186a authored by Skylot's avatar Skylot

Fix incorrect variable declaration

parent 79114520
...@@ -114,12 +114,6 @@ public class ProcessVariables extends AbstractVisitor { ...@@ -114,12 +114,6 @@ public class ProcessVariables extends AbstractVisitor {
continue; 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 // check if we can declare variable at current assigns
for (IRegion assignRegion : u.getAssigns()) { for (IRegion assignRegion : u.getAssigns()) {
if (canDeclareInRegion(u, assignRegion)) { if (canDeclareInRegion(u, assignRegion)) {
......
...@@ -131,6 +131,17 @@ public class TestTryCatch extends AbstractTest { ...@@ -131,6 +131,17 @@ public class TestTryCatch extends AbstractTest {
return obj.toString() != null; 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 @Override
public boolean testRun() throws Exception { public boolean testRun() throws Exception {
Object obj = new Object(); Object obj = new Object();
...@@ -147,6 +158,7 @@ public class TestTryCatch extends AbstractTest { ...@@ -147,6 +158,7 @@ public class TestTryCatch extends AbstractTest {
assertTrue(testSynchronize("str") == false); assertTrue(testSynchronize("str") == false);
assertTrue(testSynchronize2("str")); assertTrue(testSynchronize2("str"));
assertTrue(testSynchronize3());
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment