mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 07:54:11 -08:00
Allow to submit method during dependency check
This commit is contained in:
parent
db364f2adc
commit
f3a4d3737b
|
@ -166,9 +166,20 @@ public class DependencyChecker implements DependencyInfo {
|
|||
|
||||
public void submitMethod(MethodReference methodRef, Program program) {
|
||||
if (!completing) {
|
||||
throw new IllegalStateException("Can't submit class during check phase");
|
||||
}
|
||||
ClassHolder cls = classSource.get(methodRef.getClassName());
|
||||
|
||||
if (cls == null) {
|
||||
throw new IllegalArgumentException("Class not found: " + methodRef.getClassName());
|
||||
}
|
||||
if (cls.getMethod(methodRef.getDescriptor()) != null) {
|
||||
throw new IllegalArgumentException("Method already exists: " + methodRef.getClassName());
|
||||
}
|
||||
MethodHolder method = new MethodHolder(methodRef.getDescriptor());
|
||||
method.getModifiers().add(ElementModifier.STATIC);
|
||||
method.setProgram(ProgramUtils.copy(program));
|
||||
new UnreachableBasicBlockEliminator().optimize(program);
|
||||
cls.addMethod(method);
|
||||
} else {
|
||||
MethodDependency dep = getMethod(methodRef);
|
||||
if (dep == null) {
|
||||
throw new IllegalArgumentException("Method was not reached: " + methodRef);
|
||||
|
@ -195,6 +206,7 @@ public class DependencyChecker implements DependencyInfo {
|
|||
|
||||
processQueue();
|
||||
}
|
||||
}
|
||||
|
||||
public void addDependencyListener(DependencyListener listener) {
|
||||
listeners.add(listener);
|
||||
|
|
Loading…
Reference in New Issue
Block a user