comparison src/luan/impl/IfStmt.java @ 166:4eaee12f6c65

move luan/interp to impl git-svn-id: https://luan-java.googlecode.com/svn/trunk@167 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Sun, 22 Jun 2014 04:17:38 +0000
parents src/luan/interp/IfStmt.java@c9100f29fae0
children
comparison
equal deleted inserted replaced
165:94bbc4cbc106 166:4eaee12f6c65
1 package luan.impl;
2
3 import luan.Luan;
4 import luan.LuanException;
5 import luan.LuanSource;
6
7
8 final class IfStmt extends CodeImpl implements Stmt {
9 private final Expr cnd;
10 final Stmt thenStmt;
11 final Stmt elseStmt;
12
13 IfStmt(LuanSource.Element se,Expr cnd,Stmt thenStmt,Stmt elseStmt) {
14 super(se);
15 this.cnd = cnd;
16 this.thenStmt = thenStmt;
17 this.elseStmt = elseStmt;
18 }
19
20 @Override public void eval(LuanStateImpl luan) throws LuanException {
21 if( luan.bit(se).checkBoolean( cnd.eval(luan) ) ) {
22 thenStmt.eval(luan);
23 } else {
24 elseStmt.eval(luan);
25 }
26 }
27 }