Search in sources :

Example 1 with SSATransformer

use of com.googlecode.dex2jar.ir.ts.SSATransformer in project dex2jar by pxb1988.

the class AggTransformerTest method test05.

@Test
public void test05() {
    String sbType = "Ljava/lang/StringBuilder;";
    String sType = "Ljava/lang/String;";
    Local b = addLocal("b");
    Local ex = addLocal("ex");
    Local c = addLocal("c");
    Local d = addLocal("d");
    Local e = addLocal("e");
    Local cst = addLocal("cst");
    addStmt(nAssign(b, nString("123")));
    addStmt(nAssign(c, Exprs.nInvokeNew(new Value[0], new String[0], sbType)));
    addStmt(nAssign(d, c));
    addStmt(nAssign(cst, nString("p1")));
    addStmt(nAssign(c, Exprs.nInvokeVirtual(new Value[] { d, cst }, sbType, "append", new String[] { sType }, sbType)));
    addStmt(nAssign(e, c));
    addStmt(nAssign(cst, nString("p2")));
    addStmt(nAssign(c, Exprs.nInvokeVirtual(new Value[] { e, cst }, sbType, "append", new String[] { sType }, sbType)));
    addStmt(nAssign(c, Exprs.nInvokeVirtual(new Value[] { c }, sbType, "toString", new String[0], sType)));
    addStmt(nReturn(c));
    new SSATransformer().transform(method);
    transform();
    Assert.assertTrue(stmts.getSize() == 1);
    Assert.assertTrue(locals.size() == 0);
}
Also used : SSATransformer(com.googlecode.dex2jar.ir.ts.SSATransformer) Local(com.googlecode.dex2jar.ir.expr.Local) Test(org.junit.Test)

Aggregations

Local (com.googlecode.dex2jar.ir.expr.Local)1 SSATransformer (com.googlecode.dex2jar.ir.ts.SSATransformer)1 Test (org.junit.Test)1