Exemplo n.º 1
0
        protected override Completion ExecuteImpl(ExecutionEnvironment enviroment)
        {
            if (Test == null)
            {
                return(Completion.Exception(Properties.Language.TestNullException, this));
            }
            var t = Test.Execute(enviroment);

            if (t.ReturnValue is bool)
            {
                if ((bool)t.ReturnValue)
                {
                    if (Consequent == null)
                    {
                        return(Completion.Exception(Properties.Language.NullException, this));
                    }
                    return(Consequent.Execute(enviroment));
                }
                else
                {
                    if (Alternate == null)
                    {
                        return(Completion.Exception(Properties.Language.NullException, this));
                    }
                    return(Alternate.Execute(enviroment));
                }
            }
            else
            {
                return(Completion.Exception(Properties.Language.NotBoolean, Test));
            }
        }
Exemplo n.º 2
0
        public Completion Execute(ExecutionEnvironment enviroment)
        {
            if (Test == null)
            {
                return(Completion.Exception("Test can not be null", this));
            }
            var t = Test.Execute(enviroment);

            if (t.ReturnValue is bool)
            {
                if ((bool)t.ReturnValue)
                {
                    if (Consequent == null)
                    {
                        return(Completion.Exception("Consequent can not be null", this));
                    }
                    return(Consequent.Execute(enviroment));
                }
                else
                {
                    if (Alternate == null)
                    {
                        return(Completion.Exception("Alternate can not be null", this));
                    }
                    return(Alternate.Execute(enviroment));
                }
            }
            else
            {
                return(new Completion("Test return not boolean value", CompletionType.Exception, this));
            }
        }
Exemplo n.º 3
0
        public Completion Execute(ExecutionEnvironment enviroment)
        {
            if (Test == null)
            {
                return(Completion.Void);
            }
            var t = Test.Execute(enviroment);

            if (t.ReturnValue is bool)
            {
                if ((bool)t.ReturnValue)
                {
                    if (Consequent == null)
                    {
                        return(Completion.Void);
                    }
                    ExecutionEnvironment current = new ExecutionEnvironment(enviroment);
                    return(Consequent.Execute(current));
                }
                else
                {
                    if (Alternate == null)
                    {
                        return(Completion.Void);
                    }
                    ExecutionEnvironment current = new ExecutionEnvironment(enviroment);
                    return(Alternate.Execute(current));
                }
            }
            else
            {
                return(new Completion("Test return not boolean value", CompletionType.Exception));
            }
        }