コード例 #1
0
 internal bool TryGetInlinedLocationReference(LocationReference sourceReference, out LocationReference inlinedReference)
 {
     this.ThrowIfDisposed();
     if (this.Environment.IsVisible(sourceReference))
     {
         this.CreateArgument(sourceReference);
         inlinedReference = new InlinedLocationReference(sourceReference, this.activity);
         return(true);
     }
     inlinedReference = null;
     return(false);
 }
        // In 4.0 the expression type for publicly inspectable auto-generated arguments was
        // LocationReferenceValue<T>, whether the argument was actually used as an L-Value or R-Value.
        // We keep that for back-compat (useLocationReferenceValue == true), and only use the new
        // EnvironmentLocationValue/Reference classes for new activities.
        internal bool TryGetAccessToPublicLocation(LocationReference publicLocation,
                                                   ArgumentDirection accessDirection, bool useLocationReferenceValue, out LocationReference equivalentLocation)
        {
            Fx.Assert(!useLocationReferenceValue || this.ActivityMetadata.CurrentActivity.UseOldFastPath, "useLocationReferenceValue should only be used for back-compat");

            if (this.metadata.Environment.IsVisible(publicLocation))
            {
                if (!this.withoutArgument)
                {
                    CreateArgument(publicLocation, accessDirection, useLocationReferenceValue);
                }
                equivalentLocation = new InlinedLocationReference(publicLocation, this.metadata.CurrentActivity, accessDirection);
                return(true);
            }

            equivalentLocation = null;
            return(false);
        }
        // In 4.0 the expression type for publicly inspectable auto-generated arguments was 
        // LocationReferenceValue<T>, whether the argument was actually used as an L-Value or R-Value.
        // We keep that for back-compat (useLocationReferenceValue == true), and only use the new
        // EnvironmentLocationValue/Reference classes for new activities.
        internal bool TryGetAccessToPublicLocation(LocationReference publicLocation,
            ArgumentDirection accessDirection, bool useLocationReferenceValue, out LocationReference equivalentLocation)
        {
            Fx.Assert(!useLocationReferenceValue || this.ActivityMetadata.CurrentActivity.UseOldFastPath, "useLocationReferenceValue should only be used for back-compat");

            if (this.metadata.Environment.IsVisible(publicLocation))
            {
                if (!this.withoutArgument)
                {
                    CreateArgument(publicLocation, accessDirection, useLocationReferenceValue);
                }                
                equivalentLocation = new InlinedLocationReference(publicLocation, this.metadata.CurrentActivity, accessDirection);
                return true;
            }

            equivalentLocation = null;
            return false;
        }