public override int Run(StackFrame frame) {
            var targetDelegate = _targetField.GetValue(_site);

            object[] args = new object[_argCount];
            
            for (int i = _argCount - 1; i >= 1; i--) {
                args[i] = frame.Pop();
            }
            args[0] = _site;

            object ret = _target.InvokeInstance(targetDelegate, args);
            if (!_isVoid) frame.Push(ret);
            return +1;
        }
Beispiel #2
0
 public object Run(StackFrame frame) {
     BoxLocals(frame);
     if (_onlyFaultHandlers) {
         bool fault = true;
         try {
             RunInstructions(_instructions, frame);
             fault = false;
             return frame.Pop();
         } finally {
             if (fault) {
                 HandleFault(frame);
             }
         }
     } else {
         while (true) {
             try {
                 RunInstructions(_instructions, frame);
                 return frame.Pop();
             } catch (Exception exc) {
                 ExceptionHelpers.AssociateDynamicStackFrames(exc);
                 if (!HandleCatch(frame, exc)) {
                     ExceptionHelpers.UpdateForRethrow(exc);
                     throw;
                 }
             }
         }
     }
 }
Beispiel #3
0
        public object Run(StackFrame frame) {
            BoxLocals(frame);
            if (_onlyFaultHandlers) {
                bool fault = true;
                try {
                    RunInstructions(_instructions, frame);
                    fault = false;
                    return frame.Pop();
                } finally {
                    if (fault) {
                        frame.FaultingInstruction = frame.InstructionIndex;
                        HandleFault(frame);
                    }
                }
            } else {
                while (true) {
                    try {
                        RunInstructions(_instructions, frame);
                        return frame.Pop();
                    } catch (Exception exc) {
                        frame.FaultingInstruction = frame.InstructionIndex;

                        if (!HandleCatch(frame, exc)) {
                            throw;
                        } else if (exc is System.Threading.ThreadAbortException) {
                            // we can't exit the catch block here or the CLR will forcibly rethrow
                            // the exception on us.
                            Run(frame);
                        }
                    }
                }
            }
        }
 public override int Run(StackFrame frame) {
     if (_isLocal) {
         frame.Push(PythonOps.GetLocal((Scope)frame.Pop(), _name));
     } else {
         frame.Push(PythonOps.GetGlobal((Scope)frame.Pop(), _name));
     }
     return +1;
 }