Mercurial Hosting > luan
changeset 784:6a7c6879158d
revert shallowClone()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 30 Aug 2016 12:08:49 -0600 |
parents | 4083f5a67c63 |
children | d69d3c51c44e |
files | src/luan/LuanCloneable.java src/luan/LuanCloner.java src/luan/LuanException.java src/luan/LuanJava.java src/luan/LuanState.java src/luan/LuanTable.java src/luan/impl/Closure.java src/luan/impl/Pointer.java |
diffstat | 8 files changed, 10 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/LuanCloneable.java Tue Aug 30 12:00:38 2016 -0600 +++ b/src/luan/LuanCloneable.java Tue Aug 30 12:08:49 2016 -0600 @@ -2,6 +2,6 @@ public interface LuanCloneable { - public LuanCloneable shallowClone(LuanCloner cloner); + public LuanCloneable shallowClone(); public void deepenClone(LuanCloneable clone,LuanCloner cloner); }
--- a/src/luan/LuanCloner.java Tue Aug 30 12:00:38 2016 -0600 +++ b/src/luan/LuanCloner.java Tue Aug 30 12:08:49 2016 -0600 @@ -18,7 +18,7 @@ return null; LuanCloneable rtn = (LuanCloneable)cloned.get(obj); if( rtn == null ) { - rtn = obj.shallowClone(this); + rtn = obj.shallowClone(); cloned.put(obj,rtn); obj.deepenClone(rtn,this); }
--- a/src/luan/LuanException.java Tue Aug 30 12:00:38 2016 -0600 +++ b/src/luan/LuanException.java Tue Aug 30 12:08:49 2016 -0600 @@ -25,7 +25,7 @@ super(msg,cause); } - @Override public LuanException shallowClone(LuanCloner cloner) { + @Override public LuanException shallowClone() { return new LuanException(getMessage(),getCause(),99); }
--- a/src/luan/LuanJava.java Tue Aug 30 12:00:38 2016 -0600 +++ b/src/luan/LuanJava.java Tue Aug 30 12:08:49 2016 -0600 @@ -4,7 +4,7 @@ public final class LuanJava implements LuanCloneable { public boolean ok = false; - @Override public LuanJava shallowClone(LuanCloner cloner) { + @Override public LuanJava shallowClone() { LuanJava java = new LuanJava(); java.ok = ok; return java;
--- a/src/luan/LuanState.java Tue Aug 30 12:00:38 2016 -0600 +++ b/src/luan/LuanState.java Tue Aug 30 12:08:49 2016 -0600 @@ -25,7 +25,7 @@ private LuanState(LuanState luan) {} - @Override public LuanState shallowClone(LuanCloner cloner) { + @Override public LuanState shallowClone() { return new LuanState(this); }
--- a/src/luan/LuanTable.java Tue Aug 30 12:00:38 2016 -0600 +++ b/src/luan/LuanTable.java Tue Aug 30 12:08:49 2016 -0600 @@ -20,10 +20,6 @@ public LuanJava java; private LuanCloner cloner; - private LuanTable(LuanCloner cloner) { - this.cloner = cloner; - } - public LuanTable() {} public LuanTable(List list) { @@ -60,8 +56,8 @@ this.metatable = tbl.metatable; } - @Override public LuanTable shallowClone(LuanCloner cloner) { - return new LuanTable(cloner.deep ? null : cloner); + @Override public LuanTable shallowClone() { + return new LuanTable(); } @Override public void deepenClone(LuanCloneable dc,LuanCloner cloner) { @@ -407,7 +403,7 @@ } public LuanTable rawSubList(int from,int to) { - LuanTable tbl = new LuanTable(cloner); + LuanTable tbl = new LuanTable(); tbl.list = new ArrayList<Object>(list().subList(from-1,to-1)); return tbl; }
--- a/src/luan/impl/Closure.java Tue Aug 30 12:00:38 2016 -0600 +++ b/src/luan/impl/Closure.java Tue Aug 30 12:08:49 2016 -0600 @@ -18,7 +18,7 @@ this.java = java; } - @Override public Closure shallowClone(LuanCloner cloner) { + @Override public Closure shallowClone() { try { return (Closure)clone(); } catch(CloneNotSupportedException e) {