mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -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);
|
||||
|
||||
@GeneratedBy(JSNativeGenerator.class)
|
||||
@PluggableDependency(JSNativeGenerator.class)
|
||||
public static native String unwrapString(JSObject obj);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
|
|
|
@ -116,12 +116,20 @@ public class JSNativeGenerator implements Generator, Injector, DependencyPlugin
|
|||
|
||||
@Override
|
||||
public void methodAchieved(final DependencyAgent agent, final MethodDependency 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);
|
||||
switch (method.getReference().getName()) {
|
||||
case "invoke":
|
||||
case "instantiate":
|
||||
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