#TUNING by cg
authorClaus Gittinger <cg@exept.de>
Mon, 25 Apr 2016 16:19:00 +0200
changeset 19649 cb8cf22fbb97
parent 19648 74ab0702d0a7
child 19650 84b875892f4a
child 19660 d48041817c55
#TUNING by cg class: Behavior changed: #readFrom:onError:
Behavior.st
--- a/Behavior.st	Mon Apr 25 16:18:26 2016 +0200
+++ b/Behavior.st	Mon Apr 25 16:19:00 2016 +0200
@@ -1424,7 +1424,6 @@
 ! !
 
 
-
 !Behavior methodsFor:'RefactoringBrowser'!
 
 realClass
@@ -2958,19 +2957,22 @@
      and return it (i.e. the stream should contain some representation of
      the object which was created using #storeOn:).
      The read object must be a kind of myself.
-     If its not, the value of exceptionBlock is returned.
+     If it's not, the value of exceptionBlock is returned.
      To get any object, use 'Object readFrom:...',
      To get any number, use 'Number readFrom:...' and so on.
      This is the reverse operation to 'storeOn:'.
 
      WARNING: storeOn: does not handle circular references and multiple
-	      references to the same object.
-	      Use #storeBinary:/readBinaryFrom: for this."
+              references to the same object.
+              Use #storeBinary:/readBinaryFrom: for this."
 
     ^ [
-	|newObject|
-	newObject := self evaluatorClass evaluateFrom:aStream ifFail:exceptionBlock.
-	(newObject isKindOf:self) ifTrue:[newObject] ifFalse:[exceptionBlock value].
+        |newObject|
+        
+        newObject := self evaluatorClass evaluateFrom:aStream ifFail:exceptionBlock.
+        ((newObject class == self) or:[newObject isKindOf:self]) 
+            ifTrue:[newObject] 
+            ifFalse:[exceptionBlock value].
     ] on:Error do:exceptionBlock.
 
     "
@@ -2978,7 +2980,7 @@
      s := WriteStream on:String new.
      #(1 2 3 4) storeOn:s.
      Transcript showCR:(
-	Array readFrom:(ReadStream on:s contents) onError:'not an Array'
+        Array readFrom:(ReadStream on:s contents) onError:'not an Array'
      )
     "
     "
@@ -2986,7 +2988,7 @@
      s := WriteStream on:String new.
      #[1 2 3 4] storeOn:s.
      Transcript showCR:(
-	 Array readFrom:(ReadStream on:s contents) onError:'not an Array'
+         Array readFrom:(ReadStream on:s contents) onError:'not an Array'
      )
     "
     "