Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }