MCPcopy Create free account
hub / github.com/FabricMC/Matcher / getTypeIdx

Method getTypeIdx

src/main/java/matcher/srcprocess/HtmlPrinter.java:189–210  ·  view source on GitHub ↗
(BodyDeclaration<?> decl)

Source from the content-addressed store, hash-verified

187 }
188
189 private static int getTypeIdx(BodyDeclaration<?> decl) {
190 // order: enum-cst mth/ctor/annotation static-init/static-field inst-init/inst-field inst-type static-type
191 // note: static-init <-> fields and inst-init <-> inst-field can't be reordered with each other as their order determines execution order
192
193 if (decl.isEnumConstantDeclaration()) {
194 return 0;
195 } else if (decl.isAnnotationMemberDeclaration() || decl.isCallableDeclaration() || decl.isCompactConstructorDeclaration()) {
196 return 1;
197 } else if (decl.isFieldDeclaration()) {
198 return ((FieldDeclaration) decl).hasModifier(Keyword.STATIC) ? 2 : 3;
199 } else if (decl.isInitializerDeclaration()) {
200 return ((InitializerDeclaration) decl).isStatic() ? 2 : 3;
201 } else if (decl.isTypeDeclaration()) {
202 if (decl.isClassOrInterfaceDeclaration() && ((ClassOrInterfaceDeclaration) decl).isInterface() || ((TypeDeclaration<?>) decl).isStatic()) {
203 return 5;
204 } else {
205 return 4;
206 }
207 } else {
208 throw new RuntimeException("unknown body decl type: "+decl.getClass().getName());
209 }
210 }
211
212 @Override
213 protected void printTypeArgs(final NodeWithTypeArguments<?> nodeWithTypeArguments, final Void arg) {

Callers

nothing calls this directly

Calls 4

isStaticMethod · 0.80
isInterfaceMethod · 0.80
getClassMethod · 0.80
getNameMethod · 0.65

Tested by

no test coverage detected