mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fixes issue with JSFunctor-annotated classes
This commit is contained in:
parent
67bc76f89a
commit
8055edd547
|
@ -282,7 +282,7 @@ class JavascriptNativeProcessor {
|
|||
}
|
||||
String name = type.getMethods().iterator().next().getName();
|
||||
Variable functor = program.createVariable();
|
||||
Variable nameVar = addString(name);
|
||||
Variable nameVar = addStringWrap(addString(name));
|
||||
InvokeInstruction insn = new InvokeInstruction();
|
||||
insn.setMethod(new MethodReference(JS.class.getName(), new MethodDescriptor("function",
|
||||
ValueType.object(JSObject.class.getName()), ValueType.object(JSObject.class.getName()),
|
||||
|
@ -290,6 +290,7 @@ class JavascriptNativeProcessor {
|
|||
insn.setReceiver(functor);
|
||||
insn.getArguments().add(var);
|
||||
insn.getArguments().add(nameVar);
|
||||
replacement.add(insn);
|
||||
return functor;
|
||||
}
|
||||
|
||||
|
|
|
@ -190,5 +190,6 @@ public final class JS {
|
|||
public static native void set(JSObject instance, JSObject index, JSObject obj);
|
||||
|
||||
@InjectedBy(JSNativeGenerator.class)
|
||||
@PluggableDependency(JSNativeGenerator.class)
|
||||
public static native JSObject function(JSObject instance, JSObject property);
|
||||
}
|
||||
|
|
|
@ -132,10 +132,10 @@ public class JSNativeGenerator implements Generator, Injector, DependencyPlugin
|
|||
SourceWriter writer = context.getWriter();
|
||||
writer.append("(function()").ws().append("{").indent().softNewLine();
|
||||
writer.append("return ");
|
||||
context.writeExpr(context.getArgument(1));
|
||||
renderProperty(context.getArgument(2), context);
|
||||
context.writeExpr(context.getArgument(0));
|
||||
renderProperty(context.getArgument(1), context);
|
||||
writer.append(".apply(");
|
||||
context.writeExpr(context.getArgument(1));
|
||||
context.writeExpr(context.getArgument(0));
|
||||
writer.append(",").ws().append("arguments);").softNewLine();
|
||||
writer.outdent().append("})");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user