Mercurial Hosting > luan
view core/src/luan/impl/IfStmt.java @ 647:8e8c30b72e9b
move methods from LuanState to Luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2016 20:39:14 -0600 |
parents | 859c0dedc8b6 |
children |
line wrap: on
line source
package luan.impl; import luan.Luan; import luan.LuanException; final class IfStmt extends CodeImpl implements Stmt { private final Expr cnd; final Stmt thenStmt; final Stmt elseStmt; IfStmt(Expr cnd,Stmt thenStmt,Stmt elseStmt) { this.cnd = cnd; this.thenStmt = thenStmt; this.elseStmt = elseStmt; } @Override public void eval(LuanStateImpl luan) throws LuanException { if( Luan.checkBoolean( cnd.eval(luan) ) ) { thenStmt.eval(luan); } else { elseStmt.eval(luan); } } }