mirror of
https://github.com/revanced/smali.git
synced 2025-05-21 00:17:05 +02:00
Add an isStatic() helper for SmaliMethod
This commit is contained in:
parent
d733304122
commit
16dde79e58
@ -174,9 +174,8 @@ public class SmaliMethod extends SmaliStubBasedPsiElement<SmaliMethodStub>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getParameterRegisterCount() {
|
public int getParameterRegisterCount() {
|
||||||
SmaliModifierList modifierList = getModifierList();
|
|
||||||
int parameterRegisterCount = getMethodPrototype().getParameterList().getParameterRegisterCount();
|
int parameterRegisterCount = getMethodPrototype().getParameterList().getParameterRegisterCount();
|
||||||
if (!modifierList.hasModifierProperty("static")) {
|
if (!isStatic()) {
|
||||||
parameterRegisterCount++;
|
parameterRegisterCount++;
|
||||||
}
|
}
|
||||||
return parameterRegisterCount;
|
return parameterRegisterCount;
|
||||||
@ -190,6 +189,10 @@ public class SmaliMethod extends SmaliStubBasedPsiElement<SmaliMethodStub>
|
|||||||
return hasModifierProperty("constructor") && !hasModifierProperty("static");
|
return hasModifierProperty("constructor") && !hasModifierProperty("static");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isStatic() {
|
||||||
|
return hasModifierProperty("static");
|
||||||
|
}
|
||||||
|
|
||||||
@Override public boolean isVarArgs() {
|
@Override public boolean isVarArgs() {
|
||||||
return hasModifierProperty("varargs");
|
return hasModifierProperty("varargs");
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public class SmaliMethodParameter extends SmaliStubBasedPsiElement<SmaliMethodPa
|
|||||||
// TODO: it might be a good idea to cache this, or at least do it non-recursively
|
// TODO: it might be a good idea to cache this, or at least do it non-recursively
|
||||||
PsiElement prevSibling = getPrevSibling();
|
PsiElement prevSibling = getPrevSibling();
|
||||||
if (prevSibling == null) {
|
if (prevSibling == null) {
|
||||||
return getParentMethod().hasModifierProperty("static") ? 0 : 1;
|
return getParentMethod().isStatic() ? 0 : 1;
|
||||||
}
|
}
|
||||||
assert prevSibling instanceof SmaliMethodParameter;
|
assert prevSibling instanceof SmaliMethodParameter;
|
||||||
SmaliMethodParameter prevParam = (SmaliMethodParameter)prevSibling;
|
SmaliMethodParameter prevParam = (SmaliMethodParameter)prevSibling;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user