Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 2893

Show
Ignore:
Timestamp:
11/19/07 16:31:46 (6 years ago)
Author:
sean
Message:

Changed opEqusls to return a bool instead of an int.

!!! THIS CHANGE MAKE BREAK OVERRIDDEN OPERATORS IN USER CODE !!!

closes #761

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/compiler/dmd/genobj.d

    r2465 r2893  
    111111     * Returns !=0 if this object does have the same contents as obj. 
    112112     */ 
    113     int opEquals(Object o) 
     113    bool opEquals(Object o) 
    114114    { 
    115115        return cast(int)(this is o); 
     
    229229    } 
    230230 
    231     int opEquals(Object o) 
     231    bool opEquals(Object o) 
    232232    { 
    233233        /* TypeInfo instances are singletons, but duplicates can exist 
     
    284284    char[] toUtf8() { return name; } 
    285285 
    286     int opEquals(Object o) 
     286    bool opEquals(Object o) 
    287287    {   TypeInfo_Typedef c; 
    288288 
     
    317317    char[] toUtf8() { return m_next.toUtf8() ~ "*"; } 
    318318 
    319     int opEquals(Object o) 
     319    bool opEquals(Object o) 
    320320    {   TypeInfo_Pointer c; 
    321321 
     
    367367    char[] toUtf8() { return value.toUtf8() ~ "[]"; } 
    368368 
    369     int opEquals(Object o) 
     369    bool opEquals(Object o) 
    370370    {   TypeInfo_Array c; 
    371371 
     
    448448    } 
    449449 
    450     int opEquals(Object o) 
     450    bool opEquals(Object o) 
    451451    {   TypeInfo_StaticArray c; 
    452452 
     
    532532    } 
    533533 
    534     int opEquals(Object o) 
     534    bool opEquals(Object o) 
    535535    {   TypeInfo_AssociativeArray c; 
    536536 
     
    562562    } 
    563563 
    564     int opEquals(Object o) 
     564    bool opEquals(Object o) 
    565565    {   TypeInfo_Function c; 
    566566 
     
    587587    } 
    588588 
    589     int opEquals(Object o) 
     589    bool opEquals(Object o) 
    590590    {   TypeInfo_Delegate c; 
    591591 
     
    611611    char[] toUtf8() { return info.name; } 
    612612 
    613     int opEquals(Object o) 
     613    bool opEquals(Object o) 
    614614    {   TypeInfo_Class c; 
    615615 
     
    674674    char[] toUtf8() { return info.name; } 
    675675 
    676     int opEquals(Object o) 
     676    bool opEquals(Object o) 
    677677    {   TypeInfo_Interface c; 
    678678 
     
    737737    char[] toUtf8() { return name; } 
    738738 
    739     int opEquals(Object o) 
     739    bool opEquals(Object o) 
    740740    {   TypeInfo_Struct s; 
    741741 
     
    843843    } 
    844844 
    845     int opEquals(Object o) 
     845    bool opEquals(Object o) 
    846846    { 
    847847        if (this is o) 
  • trunk/lib/compiler/gdc/genobj.d

    r2515 r2893  
    111111     * Returns !=0 if this object does have the same contents as obj. 
    112112     */ 
    113     int opEquals(Object o) 
     113    bool opEquals(Object o) 
    114114    { 
    115115        return cast(int)(this is o); 
     
    229229    } 
    230230 
    231     int opEquals(Object o) 
     231    bool opEquals(Object o) 
    232232    { 
    233233        /* TypeInfo instances are singletons, but duplicates can exist 
     
    284284    char[] toUtf8() { return name; } 
    285285 
    286     int opEquals(Object o) 
     286    bool opEquals(Object o) 
    287287    {   TypeInfo_Typedef c; 
    288288 
     
    317317    char[] toUtf8() { return m_next.toUtf8() ~ "*"; } 
    318318 
    319     int opEquals(Object o) 
     319    bool opEquals(Object o) 
    320320    {   TypeInfo_Pointer c; 
    321321 
     
    367367    char[] toUtf8() { return value.toUtf8() ~ "[]"; } 
    368368 
    369     int opEquals(Object o) 
     369    bool opEquals(Object o) 
    370370    {   TypeInfo_Array c; 
    371371 
     
    448448    } 
    449449 
    450     int opEquals(Object o) 
     450    bool opEquals(Object o) 
    451451    {   TypeInfo_StaticArray c; 
    452452 
     
    532532    } 
    533533 
    534     int opEquals(Object o) 
     534    bool opEquals(Object o) 
    535535    {   TypeInfo_AssociativeArray c; 
    536536 
     
    562562    } 
    563563 
    564     int opEquals(Object o) 
     564    bool opEquals(Object o) 
    565565    {   TypeInfo_Function c; 
    566566 
     
    587587    } 
    588588 
    589     int opEquals(Object o) 
     589    bool opEquals(Object o) 
    590590    {   TypeInfo_Delegate c; 
    591591 
     
    611611    char[] toUtf8() { return info.name; } 
    612612 
    613     int opEquals(Object o) 
     613    bool opEquals(Object o) 
    614614    {   TypeInfo_Class c; 
    615615 
     
    674674    char[] toUtf8() { return info.name; } 
    675675 
    676     int opEquals(Object o) 
     676    bool opEquals(Object o) 
    677677    {   TypeInfo_Interface c; 
    678678 
     
    737737    char[] toUtf8() { return name; } 
    738738 
    739     int opEquals(Object o) 
     739    bool opEquals(Object o) 
    740740    {   TypeInfo_Struct s; 
    741741 
     
    855855    } 
    856856 
    857     int opEquals(Object o) 
     857    bool opEquals(Object o) 
    858858    { 
    859859        if (this is o) 
  • trunk/object.di

    r2557 r2893  
    1111    hash_t toHash(); 
    1212    int    opCmp(Object o); 
    13     int    opEquals(Object o); 
     13    bool   opEquals(Object o); 
    1414 
    1515    version( PhobosCompatibility ) 
  • trunk/tango/core/Array.d

    r2883 r2893  
    3131        bool opCall( T p1, T p2 ) 
    3232        { 
    33             // TODO: Fix this if/when opEquals is changed to return a bool. 
    34             static if( is( T == class ) || is( T == struct ) ) 
    35                 return (p1 == p2) != 0; 
    36             else 
    37                 return p1 == p2; 
     33            return p1 == p2; 
    3834        } 
    3935    } 
  • trunk/tango/core/BitArray.d

    r2356 r2893  
    356356     * Support for operators == and != for bit arrays. 
    357357     */ 
    358     int opEquals(BitArray a2) 
     358    bool opEquals(BitArray a2) 
    359359    { 
    360360        int i; 
  • trunk/tango/core/Variant.d

    r2809 r2893  
    478478 
    479479 
    480     final int opEquals(T)( T rhs ) 
     480    final bool opEquals(T)( T rhs ) 
    481481    { 
    482482        static if( is( T == Variant ) ) 
  • trunk/tango/io/FilePath.d

    r2890 r2893  
    322322        ***********************************************************************/ 
    323323 
    324         final override int opEquals (Object o) 
     324        final override bool opEquals (Object o) 
    325325        { 
    326326                return (this is o) || (o && toUtf8 == o.toUtf8); 
     
    333333        ***********************************************************************/ 
    334334 
    335         final override int opEquals (char[] s) 
     335        final override bool opEquals (char[] s) 
    336336        { 
    337337                return toUtf8() == s; 
  • trunk/tango/text/String.d

    r2730 r2893  
    153153                int compare  (T[] text); 
    154154                int compare  (StringView other); 
    155                 int opEquals (Object other); 
     155                bool opEquals (Object other); 
    156156                int opCmp    (Object other); 
    157157 
     
    10371037        ***********************************************************************/ 
    10381038 
    1039         override int opEquals (Object o) 
     1039        override bool opEquals (Object o) 
    10401040        { 
    10411041                auto other = cast (StringViewT) o; 
     
    10501050 
    10511051        /// ditto 
    1052         final int opEquals (T[] s) 
     1052        final bool opEquals (T[] s) 
    10531053        { 
    10541054                return slice == s; 
     
    12871287        ***********************************************************************/ 
    12881288 
    1289         abstract int opEquals (Object other); 
     1289        abstract bool opEquals (Object other); 
    12901290 
    12911291        /*********************************************************************** 
     
    12951295        ***********************************************************************/ 
    12961296 
    1297         abstract int opEquals (T[] other); 
     1297        abstract bool opEquals (T[] other); 
    12981298 
    12991299        /*********************************************************************** 
  • trunk/tango/text/Text.d

    r2809 r2893  
    153153                int compare  (T[] text); 
    154154                int compare  (TextView other); 
    155                 int opEquals (Object other); 
     155                bool opEquals (Object other); 
    156156                int opCmp    (Object other); 
    157157 
     
    10311031        ***********************************************************************/ 
    10321032 
    1033         override int opEquals (Object o) 
     1033        override bool opEquals (Object o) 
    10341034        { 
    10351035                auto other = cast (TextViewT) o; 
     
    10441044 
    10451045        /// ditto 
    1046         final int opEquals (T[] s) 
     1046        final bool opEquals (T[] s) 
    10471047        { 
    10481048                return slice == s; 
     
    12811281        ***********************************************************************/ 
    12821282 
    1283         abstract int opEquals (Object other); 
     1283        abstract bool opEquals (Object other); 
    12841284 
    12851285        /*********************************************************************** 
     
    12891289        ***********************************************************************/ 
    12901290 
    1291         abstract int opEquals (T[] other); 
     1291        abstract bool opEquals (T[] other); 
    12921292 
    12931293        /*********************************************************************** 
  • trunk/tango/text/locale/Core.d

    r2878 r2893  
    406406  } 
    407407 
    408   public override int opEquals(Object obj) { 
     408  public override bool opEquals(Object obj) { 
    409409    if (obj is this) 
    410410      return true;