mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Add fix for dependency issue when invoking callback from native JS
This commit is contained in:
parent
c0dc8f25d3
commit
50686c882d
|
@ -117,6 +117,7 @@ public final class JS {
|
||||||
public static native double unwrapDouble(JSObject obj);
|
public static native double unwrapDouble(JSObject obj);
|
||||||
|
|
||||||
@GeneratedBy(JSNativeGenerator.class)
|
@GeneratedBy(JSNativeGenerator.class)
|
||||||
|
@PluggableDependency(JSNativeGenerator.class)
|
||||||
public static native String unwrapString(JSObject obj);
|
public static native String unwrapString(JSObject obj);
|
||||||
|
|
||||||
@InjectedBy(JSNativeGenerator.class)
|
@InjectedBy(JSNativeGenerator.class)
|
||||||
|
|
|
@ -116,6 +116,9 @@ public class JSNativeGenerator implements Generator, Injector, DependencyPlugin
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void methodAchieved(final DependencyAgent agent, final MethodDependency method) {
|
public void methodAchieved(final DependencyAgent agent, final MethodDependency method) {
|
||||||
|
switch (method.getReference().getName()) {
|
||||||
|
case "invoke":
|
||||||
|
case "instantiate":
|
||||||
for (int i = 0; i < method.getReference().parameterCount(); ++i) {
|
for (int i = 0; i < method.getReference().parameterCount(); ++i) {
|
||||||
method.getVariable(i).addConsumer(new DependencyConsumer() {
|
method.getVariable(i).addConsumer(new DependencyConsumer() {
|
||||||
@Override public void consume(DependencyAgentType type) {
|
@Override public void consume(DependencyAgentType type) {
|
||||||
|
@ -123,6 +126,11 @@ public class JSNativeGenerator implements Generator, Injector, DependencyPlugin
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "unwrapString":
|
||||||
|
method.getResult().propagate(agent.getType("java.lang.String"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void achieveFunctorMethods(DependencyAgent agent, String type, MethodDependency caller) {
|
private void achieveFunctorMethods(DependencyAgent agent, String type, MethodDependency caller) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user