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

Method setup

src/main/java/matcher/srcprocess/TypeResolver.java:35–62  ·  view source on GitHub ↗
(ClassInstance rootCls, NameType nameType, CompilationUnit cu)

Source from the content-addressed store, hash-verified

33
34class TypeResolver {
35 public void setup(ClassInstance rootCls, NameType nameType, CompilationUnit cu) {
36 this.rootCls = rootCls;
37 this.env = rootCls.getEnv();
38 this.nameType = nameType;
39
40 if (cu.getPackageDeclaration().isPresent()) {
41 pkg = cu.getPackageDeclaration().get().getNameAsString().replace('.', '/');
42 wildcardImports.add(pkg.concat("/"));
43 } else {
44 pkg = null;
45 wildcardImports.add("");
46 }
47
48 wildcardImports.add("java/lang/");
49
50 for (ImportDeclaration imp : cu.getImports()) {
51 if (imp.isStatic()) continue;
52
53 if (imp.isAsterisk()) {
54 wildcardImports.add(imp.getNameAsString().replace('.', '/').concat("/"));
55 } else {
56 String name = imp.getNameAsString();
57 int pos = name.lastIndexOf('.');
58
59 if (pos != -1) imports.put(name.substring(pos + 1), name.replace('.', '/'));
60 }
61 }
62 }
63
64 public ClassInstance getCls(Node node) {
65 StringBuilder sb = new StringBuilder();

Callers 1

decorateMethod · 0.95

Calls 3

isStaticMethod · 0.80
getEnvMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected