Add fix for dependency issue when invoking callback from native JS

This commit is contained in:
konsoletyper 2014-09-30 18:13:45 +04:00
parent c0dc8f25d3
commit 50686c882d
2 changed files with 14 additions and 5 deletions

View File

@ -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)

View File

@ -116,6 +116,9 @@ public class JSNativeGenerator implements Generator, Injector, DependencyPlugin
@Override
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) {
method.getVariable(i).addConsumer(new DependencyConsumer() {
@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) {