Mercurial Hosting > luan
comparison src/luan/interp/ReturnStmt.java @ 31:5cf15507d77e
separate interpreter from interface
git-svn-id: https://luan-java.googlecode.com/svn/trunk@32 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 13 Dec 2012 02:50:04 +0000 |
parents | 1e37f22a34c8 |
children | e3624b7cd603 |
comparison
equal
deleted
inserted
replaced
30:8d8f4f5caef4 | 31:5cf15507d77e |
---|---|
1 package luan.interp; | 1 package luan.interp; |
2 | 2 |
3 import luan.Lua; | 3 import luan.Lua; |
4 import luan.LuaState; | |
5 import luan.LuaException; | 4 import luan.LuaException; |
6 import luan.LuaFunction; | 5 import luan.LuaFunction; |
7 import luan.LuaClosure; | |
8 | 6 |
9 | 7 |
10 final class ReturnStmt implements Stmt { | 8 final class ReturnStmt implements Stmt { |
11 private final Expressions expressions; | 9 private final Expressions expressions; |
12 private final Expr tailFnExpr; | 10 private final Expr tailFnExpr; |
21 this.expressions = expressions; | 19 this.expressions = expressions; |
22 this.tailFnExpr = null; | 20 this.tailFnExpr = null; |
23 } | 21 } |
24 } | 22 } |
25 | 23 |
26 @Override public void eval(LuaState lua) throws LuaException { | 24 @Override public void eval(LuaStateImpl lua) throws LuaException { |
27 lua.returnValues = expressions.eval(lua); | 25 lua.returnValues = expressions.eval(lua); |
28 if( tailFnExpr != null ) { | 26 if( tailFnExpr != null ) { |
29 LuaFunction tailFn = Lua.checkFunction( tailFnExpr.eval(lua) ); | 27 LuaFunction tailFn = Lua.checkFunction( tailFnExpr.eval(lua) ); |
30 if( tailFn instanceof LuaClosure ) { | 28 if( tailFn instanceof LuaClosure ) { |
31 lua.tailFn = (LuaClosure)tailFn; | 29 lua.tailFn = (LuaClosure)tailFn; |