--- 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'
)
"
"