mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Adds problem with closure variables when generating JSO bridge functions
This commit is contained in:
parent
6901e1282a
commit
8286ad9289
|
@ -137,14 +137,14 @@ public class JSNativeGenerator implements Generator, Injector, DependencyPlugin
|
|||
|
||||
private void generateFunction(InjectorContext context) throws IOException {
|
||||
SourceWriter writer = context.getWriter();
|
||||
writer.append("(function()").ws().append("{").indent().softNewLine();
|
||||
writer.append("return ");
|
||||
writer.append("(function($instance, $property) { return function()").ws().append("{").indent().softNewLine();
|
||||
writer.append("return $property.apply($instance, arguments);").softNewLine();
|
||||
writer.outdent().append("};})(");
|
||||
context.writeExpr(context.getArgument(0));
|
||||
writer.append(", ");
|
||||
context.writeExpr(context.getArgument(0));
|
||||
renderProperty(context.getArgument(1), context);
|
||||
writer.append(".apply(");
|
||||
context.writeExpr(context.getArgument(0));
|
||||
writer.append(",").ws().append("arguments);").softNewLine();
|
||||
writer.outdent().append("})");
|
||||
writer.append(")");
|
||||
}
|
||||
|
||||
private void renderProperty(Expr property, InjectorContext context) throws IOException {
|
||||
|
|
Loading…
Reference in New Issue
Block a user