subscriptBoundsError when accessing bad bits
authorClaus Gittinger <cg@exept.de>
Wed, 04 Aug 1999 16:10:55 +0200
changeset 4523 28d9633c9cb4
parent 4522 29a6625dc7b1
child 4524 6f3e5251ea5e
subscriptBoundsError when accessing bad bits (was: error)
SmallInt.st
SmallInteger.st
--- a/SmallInt.st	Wed Aug 04 16:10:22 1999 +0200
+++ b/SmallInt.st	Wed Aug 04 16:10:55 1999 +0200
@@ -83,7 +83,9 @@
     "return a bitmask for the index's bit (index starts at 1)"
 
     (index between:1 and:SmallInteger maxBits) ifFalse:[
-	^ self error:'index out of bounds'
+        ^ SubscriptOutOfBoundsSignal 
+                raiseRequestWith:index
+                errorString:'index out of bounds'
     ].
     ^ 1 bitShift:(index - 1)
 ! !
@@ -752,13 +754,15 @@
 bitAt:index
     "return the value of the index's bit (index starts at 1).
      Notice: the result of bitAt: on negative receivers is not 
-	     defined in the language standard (since the implementation
-	     is free to choose any internal representation for integers)"
+             defined in the language standard (since the implementation
+             is free to choose any internal representation for integers)"
 
     |mask|
 
     (index between:1 and:SmallInteger maxBits) ifFalse:[
-	^ self error:'index out of bounds'
+        ^ SubscriptOutOfBoundsSignal 
+                raiseRequestWith:index
+                errorString:'index out of bounds'
     ].
     mask := 1 bitShift:(index - 1).
     ((self bitAnd:mask) == 0) ifTrue:[^ 0].
@@ -2897,5 +2901,5 @@
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.115 1999-07-26 09:11:55 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.116 1999-08-04 14:10:55 cg Exp $'
 ! !
--- a/SmallInteger.st	Wed Aug 04 16:10:22 1999 +0200
+++ b/SmallInteger.st	Wed Aug 04 16:10:55 1999 +0200
@@ -83,7 +83,9 @@
     "return a bitmask for the index's bit (index starts at 1)"
 
     (index between:1 and:SmallInteger maxBits) ifFalse:[
-	^ self error:'index out of bounds'
+        ^ SubscriptOutOfBoundsSignal 
+                raiseRequestWith:index
+                errorString:'index out of bounds'
     ].
     ^ 1 bitShift:(index - 1)
 ! !
@@ -752,13 +754,15 @@
 bitAt:index
     "return the value of the index's bit (index starts at 1).
      Notice: the result of bitAt: on negative receivers is not 
-	     defined in the language standard (since the implementation
-	     is free to choose any internal representation for integers)"
+             defined in the language standard (since the implementation
+             is free to choose any internal representation for integers)"
 
     |mask|
 
     (index between:1 and:SmallInteger maxBits) ifFalse:[
-	^ self error:'index out of bounds'
+        ^ SubscriptOutOfBoundsSignal 
+                raiseRequestWith:index
+                errorString:'index out of bounds'
     ].
     mask := 1 bitShift:(index - 1).
     ((self bitAnd:mask) == 0) ifTrue:[^ 0].
@@ -2897,5 +2901,5 @@
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.115 1999-07-26 09:11:55 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.116 1999-08-04 14:10:55 cg Exp $'
 ! !