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

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Feb 13 01:17:07 UTC 2022

I wonder whether #expressionEvaluated:result: should also be sent when #evaluateExpression:[requestor:]has been specified ... But I don't have any use case for this right now. :-)

Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Samstag, 12. Februar 2022 16:35:27
An: squeak-dev at lists.squeakfoundation.org; packages at lists.squeakfoundation.org
Betreff: [squeak-dev] The Trunk: ST80-ct.277.mcz

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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220213/67b707a9/attachment-0001.html>

More information about the Squeak-dev mailing list