[squeak-dev] The Trunk: Morphic-mt.1608.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Fri Dec 13 09:11:07 UTC 2019


This was the bug:



Yet, I am not sure why that #ensure: block had such a strange side effect in #evaluateSelectionAndDo:. Because only the last line in the method creates and selects that print-it string.

Best,
Marcel

Best,
Marcel
Am 13.12.2019 10:02:47 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1608.mcz

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

Name: Morphic-mt.1608
Author: mt
Time: 13 December 2019, 10:02:28.682784 am
UUID: aefd108e-0a66-0041-a417-669c5b08df12
Ancestors: Morphic-mt.1607

Fixes a small glitch that I introduced in the last commit.

=============== Diff against Morphic-mt.1607 ===============

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 selectionInterval |
self lineSelectAndEmptyCheck: [^ nil].

(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].

selectionInterval := self selectionInterval.
+ result := [
- result := [[
rcvr class evaluatorClass new
evaluate: self selectionAsStream
in: ctxt
to: rcvr
environment: (model environment ifNil: [Smalltalk globals])
notifying: self
ifFail: [morph flash. ^ nil]
logged: true.
]
on: OutOfScopeNotification
+ do: [ :ex | ex resume: true].
+ "The parser might change the current selection for interactive error correction."
+ self selectInterval: selectionInterval.
- do: [ :ex | ex resume: true]
- ]
- ensure: [
- "The parser might change the current selection for interactive error correction."
- self selectInterval: selectionInterval].

(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/20191213/ce92b5f9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 3100 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191213/ce92b5f9/attachment.png>


More information about the Squeak-dev mailing list