ImmutableArray.st
changeset 12492 d63fd473f6e7
parent 12470 f666ff3600cf
child 12538 e6bf8c42e1d4
--- a/ImmutableArray.st	Thu Nov 05 18:37:53 2009 +0100
+++ b/ImmutableArray.st	Thu Nov 05 18:37:55 2009 +0100
@@ -75,23 +75,23 @@
 
 !ImmutableArray methodsFor:'accessing'!
 
-at:index put:value
+at:index put:value 
     "Trigger an error if an immutable array is stored into.
      The store will be performed (for compatibility reasons) if you continue
      in the debugger."
-
-    self notifyStoreError.
+    
+    self noModificationError.
     ^ super at:index put:value
 
     "Modified: / 3.8.1998 / 14:45:23 / cg"
 !
 
-basicAt:index put:value
+basicAt:index put:value 
     "Trigger an error if an immutable array is stored into.
      The store will be performed (for compatibility reasons) if you continue
      in the debugger."
-
-    self notifyStoreError.
+    
+    self noModificationError.
     ^ super basicAt:index put:value
 
     "Modified: / 3.8.1998 / 14:45:30 / cg"
@@ -153,25 +153,30 @@
     "Modified: 24.6.1996 / 15:36:28 / stefan"
 !
 
-notifyStoreError
+noModificationError
     "a store is attempted - for our convenience, find the method that
      contains me, for a nicer error message"
 
-    |creator msg|
+    |creator msg context|
 
     creator := self creator.
-    msg := 'store into/change of literal'.
     creator notNil ifTrue:[
-        msg := msg , ' (' , creator whoString , ')'
+        msg := ' (' , creator whoString , ')'
     ].
-    "
+    context := thisContext sender.
+     "
      this error is reported on an attempt to store into a literal
      array. The literal was created in creator.
      If you press continue in the debugger, the store will be performed.
      If you don't want this, press abort and check your code.
      Storing into literals is VERY VERY bad coding style.
     "
-    self error:msg mayProceed:true
+    NoModificationError 
+        raiseRequestWith:self
+        errorString:msg
+        in:context.
+
+    "Created: / 3.8.1998 / 14:47:45 / cg"
 ! !
 
 !ImmutableArray methodsFor:'private'!
@@ -195,28 +200,28 @@
 
 !ImmutableArray methodsFor:'specials'!
 
-become:anotherObject
+become:anotherObject 
     "trigger an error if I should become something else
      (this would be an even more tricky manipulation)"
-
-    self notifyStoreError.
+    
+    self noModificationError.
     ^ super become:anotherObject
 !
 
 becomeNil
     "trigger an error if I should become nil
      (this would be an even more tricky manipulation)"
-
-    self notifyStoreError.
+    
+    self noModificationError.
     ^ super becomeNil
 ! !
 
 !ImmutableArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.26 2009-11-05 14:42:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.27 2009-11-05 17:37:55 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.26 2009-11-05 14:42:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.27 2009-11-05 17:37:55 stefan Exp $'
 ! !