// 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);
        }
Exemplo n.º 2
0
        internal bool TryGetReferenceToPublicLocation(LocationReference publicReference,
                                                      bool useLocationReferenceValue, out LocationReference equivalentReference)
        {
            Fx.Assert(!useLocationReferenceValue || this.ActivityMetadata.CurrentActivity.UseOldFastPath, "useLocationReferenceValue should only be used for back-compat");

            if (_metadata.Environment.IsVisible(publicReference))
            {
                if (!_withoutArgument)
                {
                    CreateLocationArgument(publicReference, useLocationReferenceValue);
                }
                equivalentReference = new InlinedLocationReference(publicReference, _metadata.CurrentActivity);
                return(true);
            }

            equivalentReference = null;
            return(false);
        }