[squeak-dev] The Trunk: ST80-ct.277.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Feb 12 15:35:27 UTC 2022

Christoph Thiede uploaded a new version of ST80 to project The Trunk:

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

Name: ST80-ct.277
Author: ct
Time: 12 February 2022, 4:35:24.626701 pm
UUID: deaa99ff-7f5c-9b49-89c6-04515f054832
Ancestors: ST80-mt.276

Adds missing support for evaluation hooks that are already present in Morphic. Complements Morphic-ct.1893.

This includes:
- #environment
- #evaluateExpression:[requestor:]
- #expressionEvaluated:result:

=============== Diff against ST80-mt.276 ===============

Item was changed:
  ----- Method: ParagraphEditor>>evaluateSelectionAndDo: (in category 'do-its') -----
  evaluateSelectionAndDo: aBlock
  	"Treat the current selection as an expression; evaluate it and invoke aBlock with the result."
  	| result rcvr ctxt |
  	self lineSelectAndEmptyCheck: [^ nil].
+ 	(model respondsTo: #evaluateExpression:requestor:) ifTrue: [
+ 		^ aBlock value: (model perform: #evaluateExpression:requestor: with: self selection with: self)].
+ 	(model respondsTo: #evaluateExpression:) ifTrue: [
+ 		^ aBlock value: (model perform: #evaluateExpression: with: self selection)].
  	(model respondsTo: #doItReceiver) 
  		ifTrue: [ rcvr := model doItReceiver.
  				ctxt := model doItContext]
  		ifFalse: [rcvr := ctxt := nil].
  	result := [
  		rcvr class evaluatorClass new 
  			evaluate: self selectionAsStream
  			in: ctxt
  			to: rcvr
+ 			environment: (model environment ifNil: [Smalltalk globals])
  			notifying: self
+ 			ifFail: [self flash. ^ nil]
- 			ifFail: [self flash. ^nil]
  			logged: true.
  		on: OutOfScopeNotification 
  		do: [ :ex | ex resume: true].
+ 	(model respondsTo: #expressionEvaluated:result:) ifTrue: [
+ 		model perform: #expressionEvaluated:result: with: self selection with: result].
  	^aBlock value: result!

More information about the Squeak-dev mailing list