comparison core/src/luan/impl/WhileStmt.java @ 645:859c0dedc8b6

remove LuanSource
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 29 Mar 2016 18:09:51 -0600
parents 4723d22062ce
children 8e8c30b72e9b
comparison
equal deleted inserted replaced
644:ba1e318377c5 645:859c0dedc8b6
1 package luan.impl; 1 package luan.impl;
2 2
3 import luan.Luan; 3 import luan.Luan;
4 import luan.LuanException; 4 import luan.LuanException;
5 import luan.LuanElement;
6 5
7 6
8 final class WhileStmt extends CodeImpl implements Stmt { 7 final class WhileStmt extends CodeImpl implements Stmt {
9 private final Expr cnd; 8 private final Expr cnd;
10 private final Stmt doStmt; 9 private final Stmt doStmt;
11 10
12 WhileStmt(LuanElement el,Expr cnd,Stmt doStmt) { 11 WhileStmt(Expr cnd,Stmt doStmt) {
13 super(el);
14 this.cnd = cnd; 12 this.cnd = cnd;
15 this.doStmt = doStmt; 13 this.doStmt = doStmt;
16 } 14 }
17 15
18 @Override public void eval(LuanStateImpl luan) throws LuanException { 16 @Override public void eval(LuanStateImpl luan) throws LuanException {
19 try { 17 try {
20 while( luan.checkBoolean( cnd.eval(luan), el ) ) { 18 while( luan.checkBoolean( cnd.eval(luan) ) ) {
21 doStmt.eval(luan); 19 doStmt.eval(luan);
22 } 20 }
23 } catch(BreakException e) {} 21 } catch(BreakException e) {}
24 } 22 }
25 } 23 }