Example #1
0
            /// <summary>
            /// Implementation valid for AccessorCallFrame.
            /// The AccessorMemberFrame substitutes it.
            /// </summary>
            protected override PExpr DoVisit()
            {
                if (IsPendingOrSignal(ref _left, Expr.Left))
                {
                    return(ReentrantPendingOrSignal(_left));
                }
                // A visit of the left may have set a result farther in the accessor chain:
                // if Result is set, we leave.
                if (Result != null)
                {
                    return(new PExpr(Result));
                }

                Debug.Assert(_left.Result != null, "We are not pending...");
                var left = _left.Result;

                Debug.Assert(!_result.IsResolved);
                if ((_result = left.Visit(this)).IsPendingOrSignal)
                {
                    return(ReentrantPendingOrSignal(_result));
                }
                return(ReentrantSetResult(_result.Result));
            }
Example #2
0
 public PExpr PendingOrSignal(PExpr sub)
 {
     Debug.Assert(sub.IsPendingOrSignal);
     return(sub.IsResolved ? SetResult(sub.Result) : new PExpr(this, sub.PendingStatus));
 }
 internal PExpr VisitAndClean()
 {
     PExpr r = DoVisit();
     Debug.Assert( r.Result == _result || (r.Result == null && r.Deferred != null) );
     if( _result != null )
     {
         r = new PExpr( _result );
         DoDispose();
     }
     return r;
 }
 public PExpr PendingOrSignal( PExpr sub )
 {
     Debug.Assert( sub.IsPendingOrSignal );
     return sub.IsResolved ? SetResult( sub.Result ) : new PExpr( this, sub.DeferredStatus );
 }
 public bool IsPendingOrSignal( ref PExpr current, Expr e )
 {
     if( current.IsResolved ) return false;
     if( current.IsUnknown ) current = _visitor.VisitExpr( e );
     else current = _visitor.StepOver( current.Frame, StepOverKind.InternalStepOver );
     return current.IsPendingOrSignal;
 }
 /// <summary>
 /// Updates the status based on the current <see cref="PExpr"/>.
 /// </summary>
 /// <param name="r">The current <see cref="PExpr"/>.</param>
 protected internal virtual void UpdateStatus( PExpr r )
 {
     _error = (_result = r.Result) as RuntimeError;
     _status = ScriptEngineStatus.None;
     if( r.AsErrorResult != null ) _status |= ScriptEngineStatus.IsError;
     if( r.IsPending )
     {
         Debug.Assert( r.DeferredStatus != PExpr.DeferredKind.None );
         switch( r.DeferredStatus )
         {
             case PExpr.DeferredKind.Timeout: _status |= ScriptEngineStatus.Timeout; break;
             case PExpr.DeferredKind.Breakpoint: _status |= ScriptEngineStatus.Breakpoint; break;
             case PExpr.DeferredKind.AsyncCall: _status |= ScriptEngineStatus.AsyncCall; break;
             case PExpr.DeferredKind.FirstChanceError: _status |= ScriptEngineStatus.FirstChanceError; break;
             default: Debug.Fail( "UpdateStatus" ); break;
         }
     }
     else _status |= ScriptEngineStatus.IsFinished;
 }