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

Marcel Taeumel marcel.taeumel at hpi.de
Fri Dec 13 10:45:40 UTC 2019


>  the fail block [morph flash. ^ nil] is evaluated

Ah, that was it. Thanks.

Best,
Marcel
Am 13.12.2019 11:31:41 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:
I think I understand the bug and its fix, but I don't understand your comment about the "strange side effect":
Afaik compilation error strings are generated by the parser (see #notify:at:[in:])? So before your latest commit, the following happened:
* #notify:at:in: prints the error string
* the fail block [morph flash. ^ nil] is evaluated
* while returning, the ensure block is called to restore the previous selection
* the do block passed from #printIt is *not* called, so the selection will not be changed again.
So what side effect are you referring to? :-)

Best,
Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Freitag, 13. Dezember 2019 10:11:07
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] The Trunk: Morphic-mt.1608.mcz
 
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/06e482ad/attachment.html>


More information about the Squeak-dev mailing list