Example #1
0
            public sealed override bool Equals(object _other)
            {
                if ((object)this == _other)
                {
                    return(true);
                }

                ExpandedVarargsMethodSymbol other = _other as ExpandedVarargsMethodSymbol;

                if ((object)other == null)
                {
                    return(false);
                }
                if (this.underlyingMethod != other.underlyingMethod || this.extraParameters.Count != other.extraParameters.Count)
                {
                    return(false);
                }

                int count = this.extraParameters.Count;

                for (int i = 0; i < count; ++i)
                {
                    var thisParameter  = this.extraParameters[i];
                    var otherParameter = other.extraParameters[i];
                    if (thisParameter.RefKind != otherParameter.RefKind || thisParameter.Type != otherParameter.Type)
                    {
                        return(false);
                    }
                }

                return(true);
            }
Example #2
0
        internal MethodSymbol GetExpandedSymbol(BoundArgListOperator argList)
        {
            if (expandedSymbols == null)
            {
                Interlocked.CompareExchange(ref expandedSymbols, new ConcurrentHashSet <ExpandedVarargsMethodSymbol>(), null);
            }

            ExpandedVarargsMethodSymbol newX = new ExpandedVarargsMethodSymbol(this, argList);

            // There are races here where we could end up with two outstanding copies of "the same"
            // expanded symbol; we really don't care. The worst that will happen is we emit a duplicate
            // entry in the method ref table.
            foreach (ExpandedVarargsMethodSymbol x in expandedSymbols)
            {
                if (x == newX)
                {
                    return(x);
                }
            }
            expandedSymbols.Add(newX);
            return(newX);
        }
        internal MethodSymbol GetExpandedSymbol(BoundArgListOperator argList)
        {
            if (expandedSymbols == null)
            {
                Interlocked.CompareExchange(ref expandedSymbols, new ConcurrentHashSet<ExpandedVarargsMethodSymbol>(), null);
            }

            ExpandedVarargsMethodSymbol newX = new ExpandedVarargsMethodSymbol(this, argList);

            // There are races here where we could end up with two outstanding copies of "the same"
            // expanded symbol; we really don't care. The worst that will happen is we emit a duplicate
            // entry in the method ref table.
            foreach(ExpandedVarargsMethodSymbol x in expandedSymbols)
            {
                if (x == newX)
                {
                    return x;
                }
            }
            expandedSymbols.Add(newX);
            return newX;
        }