The Inbox: Kernel-ct.1302.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Kernel-ct.1302.mcz

commits-2
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ct.1302.mcz

==================== Summary ====================

Name: Kernel-ct.1302
Author: ct
Time: 19 February 2020, 12:34:30.375795 pm
UUID: 74a9f8fe-1a71-7243-897f-15e8d472f2ec
Ancestors: Kernel-eem.1296

Fixes and refines Object >> readCarefullyFrom:

- repair syntax error handling
- deduplicate #readFrom: and #readCarefullyFrom: by introducing #basicReadFrom:
- add multilingual support

=============== Diff against Kernel-eem.1296 ===============

Item was added:
+ ----- Method: Object class>>basicReadFrom: (in category 'instance creation') -----
+ basicReadFrom: textStringOrStream
+ "Create an object based on the contents of textStringOrStream."
+
+ | object |
+ (Compiler couldEvaluate: textStringOrStream)
+ ifFalse: [^ self error: 'expected String, Stream, or Text' translated].
+ object := self environment beCurrentDuring: [
+ Compiler evaluate: textStringOrStream environment: self environment].
+ (object isKindOf: self) ifFalse: [self error: ('{1} expected' translated format: {self name})].
+ ^object!

Item was changed:
  ----- Method: Object class>>readCarefullyFrom: (in category 'instance creation') -----
  readCarefullyFrom: textStringOrStream
  "Create an object based on the contents of textStringOrStream.  Return an error instead of putting up a SyntaxError window."
 
+ ^ [self basicReadFrom: textStringOrStream]
+ on: SyntaxErrorNotification
+ do: [:ex | self error: ex]!
- | object |
- (Compiler couldEvaluate: textStringOrStream)
- ifFalse: [^ self error: 'expected String, Stream, or Text'].
- object := Compiler evaluate: textStringOrStream for: nil
- notifying: #error: "signal we want errors".
- (object isKindOf: self) ifFalse: [self error: self name, ' expected'].
- ^object!

Item was changed:
  ----- Method: Object class>>readFrom: (in category 'instance creation') -----
  readFrom: textStringOrStream
  "Create an object based on the contents of textStringOrStream."
 
+ ^ self basicReadFrom: textStringOrStream!
- | object |
- (Compiler couldEvaluate: textStringOrStream)
- ifFalse: [^ self error: 'expected String, Stream, or Text'].
- object := self environment beCurrentDuring: [Compiler evaluate: textStringOrStream environment: self environment].
- (object isKindOf: self) ifFalse: [self error: self name, ' expected'].
- ^object!