comparison src/luan/impl/Closure.java @ 1159:3ef883468fd0

remove Http.per_session_pages fix clone closure bug replace Thread.global with Thread.global_callable()
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 05 Feb 2018 12:37:59 -0700
parents ba4daf107e07
children
comparison
equal deleted inserted replaced
1158:267fdf5e9fbd 1159:3ef883468fd0
8 import luan.LuanCloneable; 8 import luan.LuanCloneable;
9 import luan.LuanJavaOk; 9 import luan.LuanJavaOk;
10 10
11 11
12 public abstract class Closure extends LuanFunction implements LuanCloneable, Cloneable { 12 public abstract class Closure extends LuanFunction implements LuanCloneable, Cloneable {
13 public Pointer[] upValues; 13 protected Pointer[] upValues;
14 public LuanJavaOk javaOk; 14 protected LuanJavaOk javaOk;
15 private LuanCloner cloner; 15 private LuanCloner cloner;
16 16
17 public Closure(int nUpValues,LuanJavaOk javaOk) throws LuanException { 17 public Closure(int nUpValues,LuanJavaOk javaOk) throws LuanException {
18 this.upValues = new Pointer[nUpValues]; 18 this.upValues = new Pointer[nUpValues];
19 this.javaOk = javaOk; 19 this.javaOk = javaOk;
20 } 20 }
21 21
22 @Override public Closure shallowClone() { 22 @Override public Closure shallowClone() {
23 check();
23 try { 24 try {
24 return (Closure)clone(); 25 return (Closure)clone();
25 } catch(CloneNotSupportedException e) { 26 } catch(CloneNotSupportedException e) {
26 throw new RuntimeException(e); 27 throw new RuntimeException(e);
27 } 28 }
28 } 29 }
29 30
30 @Override public void deepenClone(LuanCloneable dc,LuanCloner cloner) { 31 @Override public void deepenClone(LuanCloneable dc,LuanCloner cloner) {
31 check();
32 Closure clone = (Closure)dc; 32 Closure clone = (Closure)dc;
33 switch( cloner.type ) { 33 switch( cloner.type ) {
34 case COMPLETE: 34 case COMPLETE:
35 clone.upValues = (Pointer[])cloner.clone(upValues); 35 clone.upValues = (Pointer[])cloner.clone(upValues);
36 clone.javaOk = (LuanJavaOk)cloner.clone(javaOk); 36 clone.javaOk = (LuanJavaOk)cloner.clone(javaOk);