public override object Evaluate(Environment env) { object result = 0; bool flag = true; while (flag) { try { GuardValue guard = ((GuardNode)this[0]).Test(env); flag = guard.GuardExpression; if (flag) { result = guard.GuardBody; } } catch (JumpSignal signal) { switch (signal.SignalType) { case JumpSignal.BreakSignal: return(result); case JumpSignal.ContinueSignal: break; default: throw; } } } return(result); }
public override object Evaluate(Environment env) { object result = 0; foreach (IAstNode node in this) { GuardNode guard = (GuardNode)node; GuardValue guardResult = guard.Test(env); if (guardResult.GuardExpression) { result = guardResult.GuardBody; if (((AstLeaf)((BlockNode)guard.Body).Ending).Token.Text == ".") { break; } } } return(result); }
public override object Evaluate(Environment env) { Environment inner = new Environment(env); object expression = Expression.Evaluate(inner), result = 0; foreach (IAstNode node in Guards) { GuardNode guard = (GuardNode)node; GuardValue guardResult = (guard).Test(env, expression); if (guardResult.GuardExpression) { result = guardResult.GuardBody; if (((AstLeaf)((BlockNode)guard.Body).Ending).Token.Text == ".") { break; } } } return(result); }