Mercurial Hosting > luan
view src/luan/LuanClosure.java @ 1341:a015a0b5c388
add Html.decode(), Lucene.count_tokens(), lucene boosts, Sql.database.set()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 19 Feb 2019 08:14:40 -0700 |
parents | e0cf0d108a77 |
children | 643cf1c37723 |
line wrap: on
line source
package luan; import luan.impl.Pointer; public abstract class LuanClosure extends LuanFunction { public Pointer[] upValues; public boolean javaOk; public final String sourceName; public LuanClosure(Luan luan,int nUpValues,boolean javaOk,String sourceName) throws LuanException { super(luan); this.upValues = new Pointer[nUpValues]; this.javaOk = javaOk; this.sourceName = sourceName; } @Override protected void completeClone(LuanFunction dc,LuanCloner cloner) { LuanClosure clone = (LuanClosure)dc; clone.upValues = (Pointer[])cloner.clone(upValues); super.completeClone(dc,cloner); } @Override public final Object call(Object[] args) throws LuanException { Luan luan = luan(); luan.push(this); try { return doCall(luan,args); } catch(StackOverflowError e) { throw new LuanException( "stack overflow" ); } finally { luan.pop(); } } @Override public String toString() { return super.toString()+"="+sourceName; } public abstract Object doCall(Luan luan,Object[] args) throws LuanException; }