Mercurial Hosting > luan
comparison core/src/luan/impl/WhileStmt.java @ 460:b48cfa14ba60
improve stack trace
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 06 May 2015 14:32:29 -0600 |
parents | 3dcb0f9bee82 |
children | 4723d22062ce |
comparison
equal
deleted
inserted
replaced
459:30544d1a9cbf | 460:b48cfa14ba60 |
---|---|
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.LuanSource; | 5 import luan.LuanElement; |
6 | 6 |
7 | 7 |
8 final class WhileStmt extends CodeImpl implements Stmt { | 8 final class WhileStmt extends CodeImpl implements Stmt { |
9 private final Expr cnd; | 9 private final Expr cnd; |
10 private final Stmt doStmt; | 10 private final Stmt doStmt; |
11 | 11 |
12 WhileStmt(LuanSource.Element se,Expr cnd,Stmt doStmt) { | 12 WhileStmt(LuanElement el,Expr cnd,Stmt doStmt) { |
13 super(se); | 13 super(el); |
14 this.cnd = cnd; | 14 this.cnd = cnd; |
15 this.doStmt = doStmt; | 15 this.doStmt = doStmt; |
16 } | 16 } |
17 | 17 |
18 @Override public void eval(LuanStateImpl luan) throws LuanException { | 18 @Override public void eval(LuanStateImpl luan) throws LuanException { |
19 try { | 19 try { |
20 while( luan.bit(se).checkBoolean( cnd.eval(luan) ) ) { | 20 while( luan.bit(el).checkBoolean( cnd.eval(luan) ) ) { |
21 doStmt.eval(luan); | 21 doStmt.eval(luan); |
22 } | 22 } |
23 } catch(BreakException e) {} | 23 } catch(BreakException e) {} |
24 } | 24 } |
25 } | 25 } |