comparison core/src/luan/impl/IfStmt.java @ 460:b48cfa14ba60

improve stack trace
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 06 May 2015 14:32:29 -0600
parents 2456ef7ada02
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 IfStmt extends CodeImpl implements Stmt { 8 final class IfStmt extends CodeImpl implements Stmt {
9 private final Expr cnd; 9 private final Expr cnd;
10 final Stmt thenStmt; 10 final Stmt thenStmt;
11 final Stmt elseStmt; 11 final Stmt elseStmt;
12 12
13 IfStmt(LuanSource.Element se,Expr cnd,Stmt thenStmt,Stmt elseStmt) { 13 IfStmt(LuanElement el,Expr cnd,Stmt thenStmt,Stmt elseStmt) {
14 super(se); 14 super(el);
15 this.cnd = cnd; 15 this.cnd = cnd;
16 this.thenStmt = thenStmt; 16 this.thenStmt = thenStmt;
17 this.elseStmt = elseStmt; 17 this.elseStmt = elseStmt;
18 } 18 }
19 19
20 @Override public void eval(LuanStateImpl luan) throws LuanException { 20 @Override public void eval(LuanStateImpl luan) throws LuanException {
21 if( luan.bit(cnd.se()).checkBoolean( cnd.eval(luan) ) ) { 21 if( luan.bit(cnd.el()).checkBoolean( cnd.eval(luan) ) ) {
22 thenStmt.eval(luan); 22 thenStmt.eval(luan);
23 } else { 23 } else {
24 elseStmt.eval(luan); 24 elseStmt.eval(luan);
25 } 25 }
26 } 26 }