comparison src/luan/interp/UpValue.java @ 78:7c08b611125d

better deep cloning git-svn-id: https://luan-java.googlecode.com/svn/trunk@79 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 15 Feb 2013 22:29:16 +0000
parents 4bf3d0c0b6b9
children 6db8f286fa6c
comparison
equal deleted inserted replaced
77:4bf3d0c0b6b9 78:7c08b611125d
29 @Override public void deepenClone(UpValue clone,DeepCloner cloner) { 29 @Override public void deepenClone(UpValue clone,DeepCloner cloner) {
30 clone.isClosed = isClosed; 30 clone.isClosed = isClosed;
31 if( isClosed ) { 31 if( isClosed ) {
32 clone.value = cloner.get(value); 32 clone.value = cloner.get(value);
33 } else { 33 } else {
34 clone.stack = stack.clone(); 34 clone.stack = cloner.deepClone(stack);
35 cloner.deepenClone(clone.stack);
36 clone.index = index; 35 clone.index = index;
37 } 36 }
38 } 37 }
39 38
40 Object get() { 39 Object get() {
77 NestedGetter(int index) { 76 NestedGetter(int index) {
78 this.index = index; 77 this.index = index;
79 } 78 }
80 79
81 public UpValue get(LuanStateImpl luan) { 80 public UpValue get(LuanStateImpl luan) {
82 return luan.closure().upValues[index]; 81 return luan.closure().upValues()[index];
83 } 82 }
84 } 83 }
85 84
86 static final Getter globalGetter = new Getter() { 85 static final Getter globalGetter = new Getter() {
87 public UpValue get(LuanStateImpl luan) { 86 public UpValue get(LuanStateImpl luan) {