Mercurial Hosting > luan
view core/src/luan/impl/IfStmt.java @ 369:85bf9f0379aa
template statements no longer depend on 'Io' being defined
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 17 Apr 2015 06:25:38 -0600 |
parents | 2456ef7ada02 |
children | b48cfa14ba60 |
line wrap: on
line source
package luan.impl; import luan.Luan; import luan.LuanException; import luan.LuanSource; final class IfStmt extends CodeImpl implements Stmt { private final Expr cnd; final Stmt thenStmt; final Stmt elseStmt; IfStmt(LuanSource.Element se,Expr cnd,Stmt thenStmt,Stmt elseStmt) { super(se); this.cnd = cnd; this.thenStmt = thenStmt; this.elseStmt = elseStmt; } @Override public void eval(LuanStateImpl luan) throws LuanException { if( luan.bit(cnd.se()).checkBoolean( cnd.eval(luan) ) ) { thenStmt.eval(luan); } else { elseStmt.eval(luan); } } }