Search in sources :

Example 66 with Local

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

the class TypeTransformerTest method test2arrayF.

@Test
public void test2arrayF() {
    initMethod(true, "V");
    Local b = addLocal("b");
    Local c = addLocal("c");
    addStmt(nAssign(b, nNewMutiArray("F", 1, new Value[] { nInt(2) })));
    addStmt(nFillArrayData(b, nConstant(new int[] { 5, 6 })));
    addStmt(nAssign(c, nArray(b, nInt(3), TypeClass.IF.name)));
    addStmt(nReturnVoid());
    transform();
    Assert.assertEquals("", b.valueType, "[F");
}
Also used : Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Example 67 with Local

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

the class TypeTransformerTest method test00Base.

/**
     * base test
     */
@Test
public void test00Base() {
    initMethod(true, "Ljava/lang/Object;");
    Local b = addLocal("b");
    addStmt(nAssign(b, nString("123")));
    addStmt(nReturn(b));
    transform();
    Assert.assertEquals("", "L", b.valueType.substring(0, 1));
}
Also used : Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Example 68 with Local

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

the class TypeTransformerTest method test3.

// @Ignore("type b to Int is ok to this context")
@Test
public void test3() {
    initMethod(true, "V");
    Local b = addLocal("b");
    addStmt(nAssign(b, nInt(456)));
    LabelStmt L0 = newLabel();
    addStmt(nIf(nEq(b, nInt(0), TypeClass.ZIFL.name), L0));
    addStmt(L0);
    addStmt(nReturnVoid());
    transform();
    Assert.assertEquals("", "I", b.valueType);
}
Also used : LabelStmt(com.googlecode.dex2jar.ir.stmt.LabelStmt) Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Example 69 with Local

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

the class TypeTransformerTest method test1Const.

@Test
public void test1Const() {
    initMethod(true, "F");
    Local b = addLocal("b");
    AssignStmt st1 = addStmt(nAssign(b, nInt(0)));
    UnopStmt st3 = addStmt(nReturn(b));
    transform();
    Assert.assertEquals("", b.valueType, "F");
}
Also used : AssignStmt(com.googlecode.dex2jar.ir.stmt.AssignStmt) Local(com.googlecode.dex2jar.ir.expr.Local) UnopStmt(com.googlecode.dex2jar.ir.stmt.UnopStmt) Test(org.junit.Test)

Example 70 with Local

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

the class UnSSATransformerTransformerTest method test02_3branches.

@Test
public void test02_3branches() {
    initMethod(true, "I");
    Local a = addLocal("a");
    Local b = addLocal("b");
    Local c = addLocal("c");
    Local d = addLocal("d");
    Local phi = addLocal("p");
    LabelStmt L0 = newLabel();
    LabelStmt L1 = newLabel();
    addStmt(nAssign(a, nInt(2)));
    addStmt(nIf(niGt(nInt(100), nInt(0)), L1));
    addStmt(nAssign(b, nInt(3)));
    addStmt(nIf(niGt(nInt(100), nInt(0)), L0));
    addStmt(nAssign(c, nInt(4)));
    addStmt(nLock(c));
    addStmt(nGoto(L1));
    addStmt(L0);
    addStmt(nAssign(d, nInt(5)));
    addStmt(nLock(d));
    addStmt(L1);
    attachPhi(L1, nAssign(phi, nPhi(a, b)));
    addStmt(nReturn(phi));
    transform();
}
Also used : LabelStmt(com.googlecode.dex2jar.ir.stmt.LabelStmt) 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