Mercurial Hosting > luan
comparison src/luan/impl/Closure.java @ 782:655280eab1e2
start limited cloning
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 30 Aug 2016 01:29:33 -0600 |
parents | fbbdd369a13a |
children | 6a7c6879158d |
comparison
equal
deleted
inserted
replaced
781:fbbdd369a13a | 782:655280eab1e2 |
---|---|
16 public Closure(int nUpValues,LuanJava java) throws LuanException { | 16 public Closure(int nUpValues,LuanJava java) throws LuanException { |
17 this.upValues = new Pointer[nUpValues]; | 17 this.upValues = new Pointer[nUpValues]; |
18 this.java = java; | 18 this.java = java; |
19 } | 19 } |
20 | 20 |
21 @Override public Closure shallowClone() { | 21 @Override public Closure shallowClone(LuanCloner cloner) { |
22 try { | 22 try { |
23 return (Closure)clone(); | 23 return (Closure)clone(); |
24 } catch(CloneNotSupportedException e) { | 24 } catch(CloneNotSupportedException e) { |
25 throw new RuntimeException(e); | 25 throw new RuntimeException(e); |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 @Override public void deepenClone(LuanCloneable dc,LuanCloner cloner) { | 29 @Override public void deepenClone(LuanCloneable dc,LuanCloner cloner) { |
30 Closure clone = (Closure)dc; | 30 Closure clone = (Closure)dc; |
31 clone.upValues = (Pointer[])cloner.deepClone(upValues); | 31 clone.upValues = (Pointer[])cloner.clone(upValues); |
32 clone.java = (LuanJava)cloner.deepClone(java); | 32 clone.java = (LuanJava)cloner.clone(java); |
33 } | 33 } |
34 | 34 |
35 @Override public final Object call(LuanState luan,Object[] args) throws LuanException { | 35 @Override public final Object call(LuanState luan,Object[] args) throws LuanException { |
36 LuanJava old = luan.java; | 36 LuanJava old = luan.java; |
37 luan.java = java; | 37 luan.java = java; |