Mercurial Hosting > luan
view core/src/luan/impl/IfStmt.java @ 557:6268c1ce6ea8
sane queryparser update
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 21 Jun 2015 16:15:52 -0600 |
parents | b48cfa14ba60 |
children | 4723d22062ce |
line wrap: on
line source
package luan.impl; import luan.Luan; import luan.LuanException; import luan.LuanElement; final class IfStmt extends CodeImpl implements Stmt { private final Expr cnd; final Stmt thenStmt; final Stmt elseStmt; IfStmt(LuanElement el,Expr cnd,Stmt thenStmt,Stmt elseStmt) { super(el); this.cnd = cnd; this.thenStmt = thenStmt; this.elseStmt = elseStmt; } @Override public void eval(LuanStateImpl luan) throws LuanException { if( luan.bit(cnd.el()).checkBoolean( cnd.eval(luan) ) ) { thenStmt.eval(luan); } else { elseStmt.eval(luan); } } }