view src/luan/interp/ReturnStmt.java @ 21:c93d8c781853

add functions git-svn-id: https://luan-java.googlecode.com/svn/trunk@22 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Tue, 04 Dec 2012 09:16:03 +0000
parents
children 1e37f22a34c8
line wrap: on
line source

package luan.interp;

import luan.LuaState;
import luan.LuaException;


final class ReturnStmt implements Stmt {
	private final Expressions expressions;
	boolean throwReturnException = true;

	ReturnStmt(Expressions expressions) {
		this.expressions = expressions;
	}

	@Override public void eval(LuaState lua) throws LuaException {
		lua.returnValues = expressions.eval(lua);
		if( throwReturnException )
			throw new ReturnException();
	}
}