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); }