comparison core/src/luan/impl/ReturnStmt.java @ 647:8e8c30b72e9b

move methods from LuanState to Luan
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 29 Mar 2016 20:39:14 -0600
parents 859c0dedc8b6
children f1150518c467
comparison
equal deleted inserted replaced
646:cdc70de628b5 647:8e8c30b72e9b
16 @Override public void eval(LuanStateImpl luan) throws LuanException { 16 @Override public void eval(LuanStateImpl luan) throws LuanException {
17 if( !(expressions instanceof FnCall) ) { 17 if( !(expressions instanceof FnCall) ) {
18 luan.returnValues = expressions.eval(luan); 18 luan.returnValues = expressions.eval(luan);
19 } else { // tail call 19 } else { // tail call
20 FnCall tailFnCall = (FnCall)expressions; 20 FnCall tailFnCall = (FnCall)expressions;
21 LuanFunction tailFn = luan.checkFunction( tailFnCall.fnExpr.eval(luan) ); 21 LuanFunction tailFn = Luan.checkFunction( tailFnCall.fnExpr.eval(luan) );
22 luan.returnValues = tailFnCall.args.eval(luan); 22 luan.returnValues = tailFnCall.args.eval(luan);
23 if( tailFn instanceof Closure ) { 23 if( tailFn instanceof Closure ) {
24 luan.tailFn = (Closure)tailFn; 24 luan.tailFn = (Closure)tailFn;
25 } else { 25 } else {
26 luan.returnValues = tailFn.call(luan,Luan.array(luan.returnValues)); 26 luan.returnValues = tailFn.call(luan,Luan.array(luan.returnValues));