comparison core/src/luan/impl/ReturnStmt.java @ 576:4723d22062ce

remove LuanBit
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 13 Jul 2015 20:38:26 -0600
parents b48cfa14ba60
children abc3198c86dd
comparison
equal deleted inserted replaced
575:7c3ad6db8ac3 576:4723d22062ce
25 25
26 @Override public void eval(LuanStateImpl luan) throws LuanException { 26 @Override public void eval(LuanStateImpl luan) throws LuanException {
27 luan.returnValues = expressions.eval(luan); 27 luan.returnValues = expressions.eval(luan);
28 if( tailFnExpr != null ) { 28 if( tailFnExpr != null ) {
29 LuanElement elTail = tailFnExpr.el(); 29 LuanElement elTail = tailFnExpr.el();
30 LuanFunction tailFn = luan.bit(elTail).checkFunction( tailFnExpr.eval(luan) ); 30 luan.push(elTail,elTail.text());
31 if( tailFn instanceof Closure ) { 31 try {
32 luan.tailFn = (Closure)tailFn; 32 LuanFunction tailFn = luan.checkFunction( tailFnExpr.eval(luan) );
33 } else { 33 if( tailFn instanceof Closure ) {
34 luan.returnValues = luan.bit(elTail).call(tailFn,elTail.text(),Luan.array(luan.returnValues)); 34 luan.tailFn = (Closure)tailFn;
35 } else {
36 luan.returnValues = tailFn.call(luan,Luan.array(luan.returnValues));
37 }
38 } finally {
39 luan.pop();
35 } 40 }
36 } 41 }
37 if( throwReturnException ) 42 if( throwReturnException )
38 throw new ReturnException(); 43 throw new ReturnException();
39 } 44 }