comparison src/luan/interp/RepeatStmt.java @ 151:c9100f29fae0

conditions must be type boolean git-svn-id: https://luan-java.googlecode.com/svn/trunk@152 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 16 Jun 2014 10:37:06 +0000
parents 8ede219cd111
children
comparison
equal deleted inserted replaced
150:f35c50027985 151:c9100f29fae0
1 package luan.interp; 1 package luan.interp;
2 2
3 import luan.Luan; 3 import luan.Luan;
4 import luan.LuanException; 4 import luan.LuanException;
5 import luan.LuanSource;
5 6
6 7
7 final class RepeatStmt implements Stmt { 8 final class RepeatStmt extends CodeImpl implements Stmt {
8 private final Stmt doStmt; 9 private final Stmt doStmt;
9 private final Expr cnd; 10 private final Expr cnd;
10 11
11 RepeatStmt(Stmt doStmt,Expr cnd) { 12 RepeatStmt(LuanSource.Element se,Stmt doStmt,Expr cnd) {
13 super(se);
12 this.doStmt = doStmt; 14 this.doStmt = doStmt;
13 this.cnd = cnd; 15 this.cnd = cnd;
14 } 16 }
15 17
16 @Override public void eval(LuanStateImpl luan) throws LuanException { 18 @Override public void eval(LuanStateImpl luan) throws LuanException {
17 try { 19 try {
18 do { 20 do {
19 doStmt.eval(luan); 21 doStmt.eval(luan);
20 } while( !Luan.toBoolean( cnd.eval(luan) ) ); 22 } while( !luan.bit(se).checkBoolean( cnd.eval(luan) ) );
21 } catch(BreakException e) {} 23 } catch(BreakException e) {}
22 } 24 }
23 } 25 }