Mercurial Hosting > luan
view src/luan/LuanClosure.java @ 1724:32c6b085bb83
test custom nginx
author | Vadim Filimonov <fffilimonov@yandex.ru> |
---|---|
date | Thu, 11 Aug 2022 12:18:33 +0200 |
parents | c922446f53aa |
children |
line wrap: on
line source
package luan; import luan.impl.Pointer; public abstract class LuanClosure extends LuanFunction implements LuanMutable { public Pointer[] upValues; public boolean javaOk; public final String sourceName; private boolean immutable = false; public LuanClosure(Pointer[] upValues,boolean javaOk,String sourceName) throws LuanException { this.upValues = upValues; this.javaOk = javaOk; this.sourceName = sourceName; } @Override public final boolean isImmutable() { return immutable; } @Override public final void makeImmutable() { if(immutable) return; immutable = true; LuanMutable.makeImmutable(upValues); } @Override public final Object call(Luan luan,Object... args) throws LuanException { luan.push(this); try { return doCall(luan,args); } catch(StackOverflowError e) { throw new LuanException( "stack overflow", e ); } finally { luan.pop(); } } @Override public final String toString() { return super.toString()+"="+sourceName; } public abstract Object doCall(Luan luan,Object[] args) throws LuanException; }