view core/src/luan/impl/FnDef.java @ 664:71f8f5075df8

compile FnDef
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 07 Apr 2016 15:11:52 -0600
parents b438a47196bc
children
line wrap: on
line source

package luan.impl;

import luan.LuanException;


public abstract class FnDef extends CodeImpl implements Expr {
	final int stackSize;
	final int numArgs;
	final boolean isVarArg;
	final UpValue.Getter[] upValueGetters;

	public FnDef(int stackSize,int numArgs,boolean isVarArg,UpValue.Getter[] upValueGetters) {
		this.stackSize = stackSize;
		this.numArgs = numArgs;
		this.isVarArg = isVarArg;
		this.upValueGetters = upValueGetters;
	}

	@Override public Object eval(LuanStateImpl luan) throws LuanException {
		return new Closure(luan,this);
	}

	public abstract Object run(LuanStateImpl luan) throws LuanException;
}