Mercurial Hosting > luan
comparison src/luan/LuanClosure.java @ 1400:221eedb0f54e
fix inner class gc bug
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 13 Sep 2019 05:05:51 -0600 |
parents | 643cf1c37723 |
children | e1a13e707bf3 |
comparison
equal
deleted
inserted
replaced
1399:38a1c1b4279a | 1400:221eedb0f54e |
---|---|
6 public abstract class LuanClosure extends LuanFunction { | 6 public abstract class LuanClosure extends LuanFunction { |
7 public Pointer[] upValues; | 7 public Pointer[] upValues; |
8 public boolean javaOk; | 8 public boolean javaOk; |
9 public final String sourceName; | 9 public final String sourceName; |
10 | 10 |
11 public LuanClosure(Luan luan,int nUpValues,boolean javaOk,String sourceName) throws LuanException { | 11 public LuanClosure(Luan luan,Pointer[] upValues,boolean javaOk,String sourceName) throws LuanException { |
12 super(luan); | 12 super(luan); |
13 this.upValues = new Pointer[nUpValues]; | 13 this.upValues = upValues; |
14 this.javaOk = javaOk; | 14 this.javaOk = javaOk; |
15 this.sourceName = sourceName; | 15 this.sourceName = sourceName; |
16 } | 16 } |
17 | 17 |
18 @Override protected void completeClone(LuanFunction dc,LuanCloner cloner) { | 18 @Override protected void completeClone(LuanFunction dc,LuanCloner cloner) { |
19 LuanClosure clone = (LuanClosure)dc; | 19 LuanClosure clone = (LuanClosure)dc; |
20 clone.upValues = (Pointer[])cloner.clone(upValues); | 20 clone.upValues = (Pointer[])cloner.clone(upValues); |
21 super.completeClone(dc,cloner); | 21 super.completeClone(dc,cloner); |
22 } | 22 } |
23 | 23 |
24 @Override public final Object call(Object[] args) throws LuanException { | 24 @Override public final Object call(Object... args) throws LuanException { |
25 Luan luan = luan(); | 25 Luan luan = luan(); |
26 luan.push(this); | 26 luan.push(this); |
27 try { | 27 try { |
28 return doCall(luan,args); | 28 return doCall(luan,args); |
29 } catch(StackOverflowError e) { | 29 } catch(StackOverflowError e) { |