Example #1
0
        public override void execute()
        {
            setContext();
            int context_integrity_check = Context.getStatusStackCount();

            if (((BooleanVar)_condition.evaluate()).getValue())
            {
                foreach (Instruction instr in instructions)
                {
                    instr.execute();
                }
            }
            else
            {
                foreach (Instruction instr in _else_instructions)
                {
                    instr.execute();
                }
            }

            // Smooth Context
            Context.resetUntilCountReached(context_integrity_check);
            Context.reset();
            Global.resetLocalContextScope();
        }
Example #2
0
        public override void execute()
        {
            setContext();
            int context_integrity_check = Context.getStatusStackCount();

            _start.execute();
            while (test())
            {
                in_loop = true;
                int local_context_stack_count = Global.getLocalScopeDepth();

                foreach (Instruction instr in instructions)
                {
                    try
                    {
                        instr.execute();
                    }
                    catch (System.Reflection.TargetInvocationException e)
                    {
                        if (e.InnerException == null)
                        {
                            throw;
                        }

                        if (e.InnerException is AquilaControlFlowExceptions.BreakException)
                        {
                            goto EndOfForLoopLabel;
                        }

                        if (e.InnerException is AquilaControlFlowExceptions.ContinueException)
                        {
                            break;
                        }
                    }
                    catch (AquilaControlFlowExceptions.BreakException)
                    {
                        goto EndOfForLoopLabel;
                    }
                    catch (AquilaControlFlowExceptions.ContinueException)
                    {
                        // just pass to the next for-loop iteration
                        break;
                    }
                }

                Global.resetLocalScopeUntilDepthReached(local_context_stack_count);
                // executing step independently bc of continue & break
                _step.execute();
            }
EndOfForLoopLabel:
            in_loop = false;
            // Smooth Context
            Context.resetUntilCountReached(context_integrity_check);
            Context.reset();
            Global.resetLocalContextScope();
        }