Search in sources :

Example 6 with UnopStmt

use of com.googlecode.dex2jar.ir.stmt.UnopStmt in project dex2jar by pxb1988.

the class ConstTransformerTest method test03.

@Test
public void test03() {
    // test local loop
    IrMethod jm = new IrMethod();
    Local a = nLocal("a");
    Local b = nLocal("b");
    Local p = nLocal("p");
    jm.locals.add(a);
    jm.locals.add(b);
    jm.locals.add(p);
    jm.stmts.add(nAssign(a, nString("a String")));
    jm.stmts.add(nAssign(b, nString("b String")));
    jm.stmts.add(nAssign(p, Exprs.nPhi(a, b)));
    UnopStmt retStmt = nReturn(p);
    jm.stmts.add(retStmt);
    new ConstTransformer().transform(jm);
    Assert.assertTrue(jm.locals.size() == 3);
    Assert.assertTrue(jm.stmts.getSize() == 4);
    Assert.assertEquals(p, retStmt.op.trim());
}
Also used : ConstTransformer(com.googlecode.dex2jar.ir.ts.ConstTransformer) Exprs.nLocal(com.googlecode.dex2jar.ir.expr.Exprs.nLocal) Local(com.googlecode.dex2jar.ir.expr.Local) IrMethod(com.googlecode.dex2jar.ir.IrMethod) UnopStmt(com.googlecode.dex2jar.ir.stmt.UnopStmt) Test(org.junit.Test)

Aggregations

Local (com.googlecode.dex2jar.ir.expr.Local)6 UnopStmt (com.googlecode.dex2jar.ir.stmt.UnopStmt)6 Test (org.junit.Test)6 IrMethod (com.googlecode.dex2jar.ir.IrMethod)5 Exprs.nLocal (com.googlecode.dex2jar.ir.expr.Exprs.nLocal)5 ConstTransformer (com.googlecode.dex2jar.ir.ts.ConstTransformer)5 Exprs.nString (com.googlecode.dex2jar.ir.expr.Exprs.nString)1 AssignStmt (com.googlecode.dex2jar.ir.stmt.AssignStmt)1