Search in sources :

Example 31 with Local

use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.

the class TypeTransformerTest method testGithubIssue28.

@Test
public void testGithubIssue28() {
    initMethod(true, "V");
    Local b = addLocal("b");
    addStmt(nAssign(b, nNewMutiArray("D", 2, new Value[] { nInt(2), nInt(3) })));
    addStmt(nAssign(nArray(nArray(b, nInt(5), TypeClass.OBJECT.name), nInt(1), TypeClass.JD.name), nLong(0)));
    addStmt(nReturnVoid());
    transform();
    Assert.assertEquals("", b.valueType, "[[D");
}
Also used : Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Example 32 with Local

use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.

the class TypeTransformerTest method test2byte.

@Test
public void test2byte() {
    initMethod(true, "V");
    Local b = addLocal("b");
    addStmt(nAssign(b, nStaticField("La;", "z", "B")));
    addStmt(nVoidInvoke(nInvokeStatic(new Value[] { b }, "La;", "y", new String[] { "I" }, "V")));
    addStmt(nAssign(nStaticField("La;", "z", "B"), b));
    addStmt(nReturnVoid());
    transform();
// FIXME fix type detect
// Assert.assertEquals("", "I", b.valueType);
}
Also used : Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Example 33 with Local

use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.

the class TypeTransformerTest method test3Z.

@Test
public void test3Z() {
    initMethod(true, "V");
    Local b = addLocal("b");
    addStmt(nAssign(b, nInt(1)));
    LabelStmt L0 = newLabel();
    addStmt(nIf(nEq(b, nInt(0), TypeClass.ZIFL.name), L0));
    addStmt(L0);
    addStmt(nReturnVoid());
    transform();
// FIXME local should type to Z but I works as well
// Assert.assertEquals("", "Z", b.valueType);
}
Also used : LabelStmt(com.googlecode.dex2jar.ir.stmt.LabelStmt) Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Example 34 with Local

use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.

the class TypeTransformerTest method testDefaultZI.

@Test
public void testDefaultZI() {
    initMethod(true, "V");
    Local b = addLocal("b");
    Local c = addLocal("c");
    addStmt(nAssign(b, nInt(5)));
    addStmt(nAssign(c, nOr(b, nInt(6), TypeClass.ZI.name)));
    addStmt(nReturnVoid());
    transform();
    Assert.assertEquals("I", c.valueType);
}
Also used : Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Example 35 with Local

use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.

the class TypeTransformerTest method testGithubIssue28x.

@Test
public void testGithubIssue28x() {
    initMethod(true, "V");
    Local b = addLocal("b");
    addStmt(nAssign(b, nInt(0)));
    addStmt(nAssign(nArray(nArray(b, nInt(5), TypeClass.OBJECT.name), nInt(1), TypeClass.JD.name), nLong(0)));
    addStmt(nReturnVoid());
    transform();
// this case is ok to fail as the NPE transformer cover this
// Assert.assertEquals("", "[[D", b.valueType);
}
Also used : Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Aggregations

Local (com.googlecode.dex2jar.ir.expr.Local)86 Test (org.junit.Test)44 LabelStmt (com.googlecode.dex2jar.ir.stmt.LabelStmt)28 Stmt (com.googlecode.dex2jar.ir.stmt.Stmt)23 Value (com.googlecode.dex2jar.ir.expr.Value)19 AssignStmt (com.googlecode.dex2jar.ir.stmt.AssignStmt)15 ArrayList (java.util.ArrayList)8 IrMethod (com.googlecode.dex2jar.ir.IrMethod)6 Exprs.nLocal (com.googlecode.dex2jar.ir.expr.Exprs.nLocal)6 UnopStmt (com.googlecode.dex2jar.ir.stmt.UnopStmt)6 JumpStmt (com.googlecode.dex2jar.ir.stmt.JumpStmt)5 ConstTransformer (com.googlecode.dex2jar.ir.ts.ConstTransformer)5 Exprs.nString (com.googlecode.dex2jar.ir.expr.Exprs.nString)4 StmtList (com.googlecode.dex2jar.ir.stmt.StmtList)4 Trap (com.googlecode.dex2jar.ir.Trap)3 Exprs.nArrayValue (com.googlecode.dex2jar.ir.expr.Exprs.nArrayValue)3 AnalyzeValue (com.googlecode.dex2jar.ir.ts.an.AnalyzeValue)3 List (java.util.List)3 DexLabel (com.googlecode.d2j.DexLabel)2 Op (com.googlecode.d2j.reader.Op)2