Search in sources :

Example 1 with SmaliRegisterReference

use of org.jf.smalidea.psi.impl.SmaliRegisterReference in project smali by JesusFreke.

the class SmaliRegisterTest method testRegisterReference.

public void testRegisterReference() {
    String text = ".class public Lmy/pkg/blah; .super Ljava/lang/Object;\n" + ".method blah()V\n" + "    .registers 123\n" + "    const <ref>v10, 123\n" + "    return-void\n" + ".end method";
    SmaliFile file = (SmaliFile) myFixture.addFileToProject("my/pkg/blah.smali", text.replace("<ref>", ""));
    PsiElement leafElement = file.findElementAt(text.indexOf("<ref>"));
    Assert.assertNotNull(leafElement);
    SmaliRegisterReference registerReference = (SmaliRegisterReference) leafElement.getParent();
    Assert.assertNotNull(registerReference);
    Assert.assertEquals(10, registerReference.getRegisterNumber());
// TODO: test parameter register
}
Also used : SmaliFile(org.jf.smalidea.psi.impl.SmaliFile) SmaliRegisterReference(org.jf.smalidea.psi.impl.SmaliRegisterReference) PsiElement(com.intellij.psi.PsiElement)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 SmaliFile (org.jf.smalidea.psi.impl.SmaliFile)1 SmaliRegisterReference (org.jf.smalidea.psi.impl.SmaliRegisterReference)1