private bool AreParametersEqual(ParameterSymbol parameter, ParameterSymbol other)
 {
     Debug.Assert(parameter.Ordinal == other.Ordinal);
     return(StringOrdinalComparer.Equals(parameter.Name, other.Name) &&
            (parameter.RefKind == other.RefKind) &&
            _comparer.Equals(parameter.Type, other.Type));
 }
Beispiel #2
0
 private bool ArePropertiesEqual(PropertySymbol property, PropertySymbol other)
 {
     Debug.Assert(StringOrdinalComparer.Equals(property.MetadataName, other.MetadataName));
     return(_comparer.Equals(property.Type, other.Type) &&
            property.RefKind.Equals(other.RefKind) &&
            property.Parameters.SequenceEqual(other.Parameters, AreParametersEqual));
 }
Beispiel #3
0
    /************
    ** strsift **
    *************
    ** Pass this function:
    **      1) A pointer to an array of offset pointers
    **      2) A pointer to a string array
    **      3) The number of elements in the string array
    **      4) Offset within which to sort.
    ** Sift the array within the bounds of those offsets (thus
    ** building a heap).
    */
    private static void strsift(string[] array,
                                int i,
                                int j)
    {
        int    k;
        string temp;

        while ((i + i) <= j)
        {
            k = i + i;
            if (k < j)
            {
                //array[k].CompareTo(array[k+1]);
                if (StringOrdinalComparer.Compare(array[k], array[k + 1]) < 0)
                {
                    ++k;
                }
            }

            //if(array[i]<array[k])
            if (StringOrdinalComparer.Compare(array[i], array[k]) < 0)
            {
                temp     = array[k];
                array[k] = array[i];
                array[i] = temp;
                i        = k;
            }
            else
            {
                i = j + 1;
            }
        }
        return;
    }
Beispiel #4
0
 private bool AreNamedTypesEqual(NamedTypeSymbol type, NamedTypeSymbol other)
 {
     Debug.Assert(StringOrdinalComparer.Equals(type.Name, other.Name));
     // TODO: Test with overloads (from PE base class?) that have modifiers.
     Debug.Assert(!type.HasTypeArgumentsCustomModifiers);
     Debug.Assert(!other.HasTypeArgumentsCustomModifiers);
     return(type.TypeArgumentsNoUseSiteDiagnostics.SequenceEqual(other.TypeArgumentsNoUseSiteDiagnostics, AreTypesEqual));
 }
            private bool AreFieldsEqual(FieldSymbol field, FieldSymbol other)
            {
#if XSHARP
                Debug.Assert(s_nameComparer.Equals(field.Name, other.Name));
#else
                Debug.Assert(StringOrdinalComparer.Equals(field.Name, other.Name));
#endif
                return(_comparer.Equals(field.Type, other.Type));
            }
            private bool AreEventsEqual(EventSymbol @event, EventSymbol other)
            {
#if XSHARP
                Debug.Assert(s_nameComparer.Equals(@event.Name, other.Name));
#else
                Debug.Assert(StringOrdinalComparer.Equals(@event.Name, other.Name));
#endif
                return(_comparer.Equals(@event.Type, other.Type));
            }
Beispiel #7
0
            private bool AreNamedTypesEqual(NamedTypeSymbol type, NamedTypeSymbol other)
            {
                Debug.Assert(StringOrdinalComparer.Equals(type.MetadataName, other.MetadataName));

                // TODO: Test with overloads (from PE base class?) that have modifiers.
                Debug.Assert(type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.All(t => t.CustomModifiers.IsEmpty));
                Debug.Assert(other.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.All(t => t.CustomModifiers.IsEmpty));

                return(type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.SequenceEqual(other.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics, AreTypesEqual));
            }
            private bool AreParametersEqual(ParameterSymbol parameter, ParameterSymbol other)
            {
                Debug.Assert(parameter.Ordinal == other.Ordinal);
#if XSHARP
                return(s_nameComparer.Equals(parameter.MetadataName, other.MetadataName) &&
#else
                return StringOrdinalComparer.Equals(parameter.MetadataName, other.MetadataName) &&
#endif
                       (parameter.RefKind == other.RefKind) &&
                       _comparer.Equals(parameter.Type, other.Type));
            }
 private static bool AreTypeParametersEqual(TypeParameterSymbol type, TypeParameterSymbol other)
 {
     Debug.Assert(type.Ordinal == other.Ordinal);
     Debug.Assert(StringOrdinalComparer.Equals(type.Name, other.Name));
     // Comparing constraints is unnecessary: two methods cannot differ by
     // constraints alone and changing the signature of a method is a rude
     // edit. Furthermore, comparing constraint types might lead to a cycle.
     Debug.Assert(type.HasConstructorConstraint == other.HasConstructorConstraint);
     Debug.Assert(type.HasValueTypeConstraint == other.HasValueTypeConstraint);
     Debug.Assert(type.HasReferenceTypeConstraint == other.HasReferenceTypeConstraint);
     Debug.Assert(type.ConstraintTypesNoUseSiteDiagnostics.Length == other.ConstraintTypesNoUseSiteDiagnostics.Length);
     return(true);
 }
            private bool AreNamedTypesEqual(NamedTypeSymbol type, NamedTypeSymbol other)
            {
                Debug.Assert(StringOrdinalComparer.Equals(type.Name, other.Name));
                // TODO: Test with overloads (from PE base class?) that have modifiers.
                Debug.Assert(!type.HasTypeArgumentsCustomModifiers);
                Debug.Assert(!other.HasTypeArgumentsCustomModifiers);

                // Tuple types should be unwrapped to their underlying type before getting here (see MatchSymbols.VisitNamedType)
                Debug.Assert(!type.IsTupleType);
                Debug.Assert(!other.IsTupleType);

                return(type.TypeArgumentsNoUseSiteDiagnostics.SequenceEqual(other.TypeArgumentsNoUseSiteDiagnostics, AreTypesEqual));
            }
            private bool AreMethodsEqual(MethodSymbol method, MethodSymbol other)
            {
                Debug.Assert(StringOrdinalComparer.Equals(method.Name, other.Name));

                Debug.Assert(method.IsDefinition);
                Debug.Assert(other.IsDefinition);

                method = SubstituteTypeParameters(method);
                other  = SubstituteTypeParameters(other);

                return(_comparer.Equals(method.ReturnType, other.ReturnType) &&
                       method.Parameters.SequenceEqual(other.Parameters, AreParametersEqual) &&
                       method.TypeParameters.SequenceEqual(other.TypeParameters, AreTypesEqual));
            }
Beispiel #12
0
    /**************************
    ** DoStringSortIteration **
    ***************************
    ** This routine executes one iteration of the string
    ** sort benchmark.  It returns the number of ticks
    ** Note that this routine also builds the offset pointer
    ** array.
    */

    private static int DoStringSortIteration(string[][] arraybase, int numarrays, int arraysize)
    {
        long elapsed;            /* Elapsed ticks */
        int  i;

        /*
        ** Load up the array(s) with random numbers
        */
        LoadStringArray(arraybase, arraysize, numarrays);

        /*
        ** Start the stopwatch
        */
        elapsed = ByteMark.StartStopwatch();

        /*
        ** Execute heapsorts
        */
        for (i = 0; i < numarrays; i++)
        {
            // StrHeapSort(tempobase,tempsbase,nstrings,0L,nstrings-1);
            StrHeapSort(arraybase[i], 0, arraysize - 1);
        }

        /*
        ** Record elapsed time
        */
        elapsed = ByteMark.StopStopwatch(elapsed);

#if DEBUG
        for (i = 0; i < arraysize - 1; i++)
        {
            /*
            ** Compare strings to check for proper
            ** sort.
            */
            if (StringOrdinalComparer.Compare(arraybase[0][i + 1], arraybase[0][i]) < 0)
            {
                Console.Write("Error in StringSort!  arraybase[0][{0}]='{1}', arraybase[0][{2}]='{3}\n", i, arraybase[0][i], i + 1, arraybase[0][i + 1]);
                break;
            }
        }
#endif

        return((int)elapsed);
    }
            private Cci.IDefinition VisitDefInternal(Cci.IDefinition def)
            {
                var type = def as Cci.ITypeDefinition;

                if (type != null)
                {
                    var namespaceType = type.AsNamespaceTypeDefinition(_sourceContext);
                    if (namespaceType != null)
                    {
                        return(VisitNamespaceType(namespaceType));
                    }

                    var nestedType = type.AsNestedTypeDefinition(_sourceContext);
                    Debug.Assert(nestedType != null);

                    var otherContainer = (Cci.ITypeDefinition) this.VisitDef(nestedType.ContainingTypeDefinition);
                    if (otherContainer == null)
                    {
                        return(null);
                    }

                    return(VisitTypeMembers(otherContainer, nestedType, GetNestedTypes, (a, b) => StringOrdinalComparer.Equals(a.Name, b.Name)));
                }

                var member = def as Cci.ITypeDefinitionMember;

                if (member != null)
                {
                    var otherContainer = (Cci.ITypeDefinition) this.VisitDef(member.ContainingTypeDefinition);
                    if (otherContainer == null)
                    {
                        return(null);
                    }

                    var field = def as Cci.IFieldDefinition;
                    if (field != null)
                    {
                        return(VisitTypeMembers(otherContainer, field, GetFields, (a, b) => StringOrdinalComparer.Equals(a.Name, b.Name)));
                    }
                }

                // We are only expecting types and fields currently.
                throw ExceptionUtilities.UnexpectedValue(def);
            }
 private bool AreFieldsEqual(FieldSymbol field, FieldSymbol other)
 {
     Debug.Assert(StringOrdinalComparer.Equals(field.Name, other.Name));
     return(_comparer.Equals(field.Type, other.Type));
 }
 private bool AreEventsEqual(EventSymbol @event, EventSymbol other)
 {
     Debug.Assert(StringOrdinalComparer.Equals(@event.Name, other.Name));
     return(_comparer.Equals(@event.Type, other.Type));
 }
Beispiel #16
0
 private bool AreNamespacesEqual(NamespaceSymbol @namespace, NamespaceSymbol other)
 {
     Debug.Assert(StringOrdinalComparer.Equals(@namespace.MetadataName, other.MetadataName));
     return(true);
 }