Exemplo n.º 1
0
        /// <summary>
        /// If this is an extension method that can be applied to a receiver of the given type,
        /// returns a reduced extension method symbol thus formed. Otherwise, returns null.
        /// </summary>
        public MethodSymbol ReduceExtensionMethod(TypeSymbol receiverType)
        {
            if ((object)receiverType == null)
            {
                throw new ArgumentNullException(nameof(receiverType));
            }

            if (!this.IsExtensionMethod || this.MethodKind == MethodKind.ReducedExtension)
            {
                return(null);
            }

            return(ReducedExtensionMethodSymbol.Create(this, receiverType));
        }
Exemplo n.º 2
0
        /// <summary>
        /// If this is an extension method that can be applied to a receiver of the given type,
        /// returns a reduced extension method symbol thus formed. Otherwise, returns null.
        /// </summary>
        public MethodSymbol ReduceExtensionMethod(TypeSymbol receiverType)
        {
            if ((object)receiverType == null)
            {
                throw new ArgumentNullException(nameof(receiverType));
            }

            if (!this.IsExtensionMethod || this.MethodKind == MethodKind.ReducedExtension)
            {
                return(null);
            }

            // To give optimal diagnostics, we should really pass the "current" compilation.
            // However, this is never used in batch scenarios, so it doesn't matter
            // (modulo future changes to the API).
            return(ReducedExtensionMethodSymbol.Create(this, receiverType, compilation: null));
        }
Exemplo n.º 3
0
 /// <summary>
 /// If this is an extension method, returns a reduced extension method
 /// symbol representing the method. Otherwise, returns null.
 /// </summary>
 public MethodSymbol ReduceExtensionMethod()
 {
     return((this.IsExtensionMethod && this.MethodKind != MethodKind.ReducedExtension) ? ReducedExtensionMethodSymbol.Create(this) : null);
 }