mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix issue with incremental compilation and JSBody annotation
This commit is contained in:
parent
1dd379551c
commit
68522811f2
|
@ -77,7 +77,6 @@ class JSClassProcessor {
|
||||||
private final List<Instruction> replacement = new ArrayList<>();
|
private final List<Instruction> replacement = new ArrayList<>();
|
||||||
private final JSTypeHelper typeHelper;
|
private final JSTypeHelper typeHelper;
|
||||||
private final Diagnostics diagnostics;
|
private final Diagnostics diagnostics;
|
||||||
private int methodIndexGenerator;
|
|
||||||
private final Map<MethodReference, MethodReader> overriddenMethodCache = new HashMap<>();
|
private final Map<MethodReference, MethodReader> overriddenMethodCache = new HashMap<>();
|
||||||
private JSValueMarshaller marshaller;
|
private JSValueMarshaller marshaller;
|
||||||
private IncrementalDependencyRegistration incrementalCache;
|
private IncrementalDependencyRegistration incrementalCache;
|
||||||
|
@ -576,9 +575,12 @@ class JSClassProcessor {
|
||||||
? ValueType.VOID
|
? ValueType.VOID
|
||||||
: ValueType.parse(JSObject.class);
|
: ValueType.parse(JSObject.class);
|
||||||
|
|
||||||
|
ClassReader ownerClass = classSource.get(methodToProcess.getOwnerName());
|
||||||
|
int methodIndex = indexOfMethod(ownerClass, methodToProcess);
|
||||||
|
|
||||||
// create proxy method
|
// create proxy method
|
||||||
MethodReference proxyMethod = new MethodReference(methodToProcess.getOwnerName(),
|
MethodReference proxyMethod = new MethodReference(methodToProcess.getOwnerName(),
|
||||||
methodToProcess.getName() + "$js_body$_" + methodIndexGenerator++, proxyParamTypes);
|
methodToProcess.getName() + "$js_body$_" + methodIndex, proxyParamTypes);
|
||||||
String script = bodyAnnot.getValue("script").getString();
|
String script = bodyAnnot.getValue("script").getString();
|
||||||
String[] parameterNames = paramsValue != null ? paramsValue.getList().stream()
|
String[] parameterNames = paramsValue != null ? paramsValue.getList().stream()
|
||||||
.map(AnnotationValue::getString)
|
.map(AnnotationValue::getString)
|
||||||
|
@ -617,6 +619,17 @@ class JSClassProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int indexOfMethod(ClassReader cls, MethodReader method) {
|
||||||
|
int index = 0;
|
||||||
|
for (MethodReader m : cls.getMethods()) {
|
||||||
|
if (m.getDescriptor().equals(method.getDescriptor())) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
++index;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void createJSMethods(ClassHolder cls) {
|
void createJSMethods(ClassHolder cls) {
|
||||||
for (MethodHolder method : cls.getMethods().toArray(new MethodHolder[0])) {
|
for (MethodHolder method : cls.getMethods().toArray(new MethodHolder[0])) {
|
||||||
MethodReference methodRef = method.getReference();
|
MethodReference methodRef = method.getReference();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user