Mercurial Hosting > luan
comparison src/luan/interp/IfStmt.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 | 2446c1755d9b |
children | 64ecb7a3aad7 |
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 | 5 |
7 | 6 |
8 final class IfStmt implements Stmt { | 7 final class IfStmt implements Stmt { |
9 private final Expr cnd; | 8 private final Expr cnd; |
14 this.cnd = cnd; | 13 this.cnd = cnd; |
15 this.thenStmt = thenStmt; | 14 this.thenStmt = thenStmt; |
16 this.elseStmt = elseStmt; | 15 this.elseStmt = elseStmt; |
17 } | 16 } |
18 | 17 |
19 @Override public void eval(LuaState lua) throws LuaException { | 18 @Override public void eval(LuaStateImpl lua) throws LuaException { |
20 if( Lua.toBoolean( cnd.eval(lua) ) ) { | 19 if( Lua.toBoolean( cnd.eval(lua) ) ) { |
21 thenStmt.eval(lua); | 20 thenStmt.eval(lua); |
22 } else { | 21 } else { |
23 elseStmt.eval(lua); | 22 elseStmt.eval(lua); |
24 } | 23 } |