[squeak-dev] The Trunk: Morphic-ct.1893.mcz

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

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

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

Name: Morphic-ct.1893
Author: ct
Time: 12 February 2022, 4:33:08.438701 pm
UUID: 7db558ba-ba08-1748-9019-1151f7528b79
Ancestors: Morphic-mt.1892

Adds optional model hook #evaluateExpression:requestor: to TextEditor, allowing models to pass the original requestor to the compiler.

=============== Diff against Morphic-mt.1892 ===============

Item was changed:
  ----- Method: TextEditor>>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: [morph 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