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

Method getMethod

src/main/java/matcher/srcprocess/TypeResolver.java:94–127  ·  view source on GitHub ↗
(T methodDecl)

Source from the content-addressed store, hash-verified

92 }
93
94 public <T extends CallableDeclaration<T> & NodeWithParameters<T>> MethodInstance getMethod(T methodDecl) {
95 ClassInstance cls = getCls(methodDecl);
96 if (cls == null) return null;
97
98 StringBuilder sb = new StringBuilder();
99 sb.append('(');
100
101 if (methodDecl instanceof ConstructorDeclaration && cls.isEnum()) { // implicit extra String name + int ordinal for enum constructors
102 sb.append("Ljava/lang/String;I");
103 }
104
105 for (Parameter p : methodDecl.getParameters()) {
106 sb.append(toDesc(p.getType(), rootCls));
107 }
108
109 sb.append(')');
110
111 if (methodDecl instanceof NodeWithType) {
112 sb.append(toDesc(((NodeWithType<?, ?>) methodDecl).getType(), rootCls));
113 } else {
114 sb.append('V');
115 }
116
117 String desc = sb.toString();
118 String name;
119
120 if (methodDecl instanceof ConstructorDeclaration) {
121 name = "<init>";
122 } else {
123 name = methodDecl.getName().getIdentifier();
124 }
125
126 return cls.getMethod(name, desc, nameType);
127 }
128
129 public FieldInstance getField(VariableDeclarator var) {
130 ClassInstance cls = getCls(var);

Callers 3

visitMethod · 0.45
visitMethod · 0.45
readMethod · 0.45

Calls 8

getClsMethod · 0.95
isEnumMethod · 0.95
toDescMethod · 0.95
getMethodMethod · 0.95
getNameMethod · 0.65
getTypeMethod · 0.45
toStringMethod · 0.45
getIdentifierMethod · 0.45

Tested by

no test coverage detected