public bool Resolve(MethodStateMachine methodSM)
        {
            //Create an execution model for calling method
            var cmExec = _methodStateMachineFactory.Create(methodSM.State.CallMethod);

            cmExec.Caller = methodSM;
            if (cmExec == null)
            {
                throw new Exception("Method not found");
            }

            //Fill calling method's arguments if any
            if (cmExec.MethodDesc.TakesArguments)
            {
                cmExec.SetMethodArguments(methodSM.Context.EvalStack);
            }

            //Add calling method to the call stack
            _callStack.Push(cmExec);

            //Reset the flow
            methodSM.State.ExecutionInterruption = ExecutionInterruption.None;
            methodSM.State.CallMethod            = null;

            return(false);
        }
Beispiel #2
0
 public void Start()
 {
     try
     {
         MethodDesc entryPoint = _compiledModel.Methods.Values.Where(d => d.IsEntryPoint).SingleOrDefault();
         if (entryPoint == null)
         {
             throw new InvalidOperationException("Entry point not found");
         }
         MethodStateMachine entryPointExecModel = _methodStateMachineFactory.Create(entryPoint);
         _callStack.Push(entryPointExecModel);
         ProcessCallStack();
     }
     catch (Exception ex)
     {
         throw;
     }
 }