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,12 +116,20 @@ 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) {
|
||||||
for (int i = 0; i < method.getReference().parameterCount(); ++i) {
|
switch (method.getReference().getName()) {
|
||||||
method.getVariable(i).addConsumer(new DependencyConsumer() {
|
case "invoke":
|
||||||
@Override public void consume(DependencyAgentType type) {
|
case "instantiate":
|
||||||
achieveFunctorMethods(agent, type.getName(), method);
|
for (int i = 0; i < method.getReference().parameterCount(); ++i) {
|
||||||
|
method.getVariable(i).addConsumer(new DependencyConsumer() {
|
||||||
|
@Override public void consume(DependencyAgentType type) {
|
||||||
|
achieveFunctorMethods(agent, type.getName(), method);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
break;
|
||||||
|
case "unwrapString":
|
||||||
|
method.getResult().propagate(agent.getType("java.lang.String"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user