Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /main/trunk/interpreter/classes/IntegerClass.cpp [r8285] .. [r8286] Maximize Restore

  Switch to side-by-side view

--- a/main/trunk/interpreter/classes/IntegerClass.cpp
+++ b/main/trunk/interpreter/classes/IntegerClass.cpp
@@ -711,6 +711,10 @@
 /*            value processing.                                               */
 /******************************************************************************/
 {
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
     return this->strictComp(other) == 0 ? TheTrueObject : TheFalseObject;
 }
 
@@ -721,8 +725,12 @@
 /* Function:  Strict inequality operation                                     */
 /******************************************************************************/
 {
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheTrueObject;
+    }
                                        /* return strict compare result      */
-  return (this->strictComp(other) != 0) ? TheTrueObject : TheFalseObject;
+    return (this->strictComp(other) != 0) ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::equal(
@@ -731,7 +739,11 @@
 /* Function:  non-strict "=" operator                                         */
 /******************************************************************************/
 {
-  return this->comp(other) == 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->comp(other) == 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::notEqual(
@@ -740,7 +752,11 @@
 /* Function:  non-strict "\=" operator                                        */
 /******************************************************************************/
 {
-  return this->comp(other) != 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheTrueObject;
+    }
+    return this->comp(other) != 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::isGreaterThan(
@@ -749,7 +765,11 @@
 /* Function:  non-strict ">" operator                                         */
 /******************************************************************************/
 {
-  return this->comp(other) > 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->comp(other) > 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::isLessThan(
@@ -758,7 +778,11 @@
 /* Function:  non-strict "<" operator                                         */
 /******************************************************************************/
 {
-  return this->comp(other) < 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->comp(other) < 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::isGreaterOrEqual(
@@ -767,7 +791,11 @@
 /* Function:  non-strict ">=" operator                                        */
 /******************************************************************************/
 {
-  return this->comp(other) >= 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->comp(other) >= 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::isLessOrEqual(
@@ -776,7 +804,11 @@
 /* Function:  non-strict "<=" operator                                        */
 /******************************************************************************/
 {
-  return this->comp(other) <= 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->comp(other) <= 0 ? TheTrueObject : TheFalseObject;
 }
 
 
@@ -786,7 +818,11 @@
 /* Function:  strict ">>" operator                                            */
 /******************************************************************************/
 {
-  return this->strictComp(other) > 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->strictComp(other) > 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::strictLessThan(
@@ -795,7 +831,11 @@
 /* Function:  strict "<<" operator                                            */
 /******************************************************************************/
 {
-  return this->strictComp(other) < 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->strictComp(other) < 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::strictGreaterOrEqual(
@@ -804,7 +844,11 @@
 /* Function:  strict ">>=" operator                                           */
 /******************************************************************************/
 {
-  return this->strictComp(other) >= 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->strictComp(other) >= 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxInteger *RexxInteger::strictLessOrEqual(
@@ -813,7 +857,11 @@
 /* Function:  strict "<<=" operator                                           */
 /******************************************************************************/
 {
-  return this->strictComp(other) <= 0 ? TheTrueObject : TheFalseObject;
+    if (other == TheNilObject)           // all conditionals return .false when compared to .nil
+    {
+        return TheFalseObject;
+    }
+    return this->strictComp(other) <= 0 ? TheTrueObject : TheFalseObject;
 }
 
 RexxObject *RexxInteger::notOp()