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

Method getCls

src/main/java/matcher/srcprocess/TypeResolver.java:64–92  ·  view source on GitHub ↗
(Node node)

Source from the content-addressed store, hash-verified

62 }
63
64 public ClassInstance getCls(Node node) {
65 StringBuilder sb = new StringBuilder();
66
67 if (pkg != null) {
68 sb.append(pkg);
69 sb.append('/');
70 }
71
72 int pkgEnd = sb.length();
73
74 do {
75 if (node instanceof ClassOrInterfaceDeclaration || node instanceof EnumDeclaration) {
76 TypeDeclaration<?> typeDecl = (TypeDeclaration<?>) node;
77
78 String namePart = typeDecl.getName().getIdentifier();
79
80 if (sb.length() > pkgEnd) {
81 sb.insert(pkgEnd, '$');
82 sb.insert(pkgEnd, namePart);
83 } else {
84 sb.append(namePart);
85 }
86 }
87 } while ((node = node.getParentNode().orElse(null)) != null);
88
89 ClassInstance cls = getClsByName(sb.toString());
90
91 return cls;
92 }
93
94 public <T extends CallableDeclaration<T> & NodeWithParameters<T>> MethodInstance getMethod(T methodDecl) {
95 ClassInstance cls = getCls(methodDecl);

Callers 3

getMethodMethod · 0.95
getFieldMethod · 0.95
visitClsMethod · 0.45

Calls 4

getClsByNameMethod · 0.95
getNameMethod · 0.65
getIdentifierMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected