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

commits at source.squeak.org commits at source.squeak.org
Fri May 8 18:48:31 UTC 2020


Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ct.1640.mcz

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

Name: Morphic-ct.1640
Author: ct
Time: 22 March 2020, 12:09:37.99656 am
UUID: bf7487fc-35a0-9641-9e60-1d3056d35384
Ancestors: Morphic-eem.1638

Reverts Morphic-ct.1606, which attempted to solve an issue around interactive parser selections on the wrong way and introduced a new regression.

To reproduce this new regression, in an interactive environment (no automatic variable declarations! u could use an empty browser, for example), try to printIt:
	x:=6*7
Answer the UnknownVariable dialog with "declare method temp".
Expected output:
	| x |
	x:=6*7 42
Actual output:
	| x |
	 42x:=6*7

Let me explain:

In Morphic-ct.1606, we reverted any selection change that occured during the interactive compilation. While this is fine for warnings that can be accepted only, by that change we neglected the fact that certain parser notifications actually modify the source and thus need to permanently adjust the selection. This is what we depend on for a correct functionality of #declareTemp:at: and others. See also #correct:from:to:.
Instead, the actual bug occurs in the parser, where #queryUndefined forgets to reset the selection after the UndefinedVariable warning has been skipped. Other error correction tools know how to do this correctly, for example #correctVariable:interval:. This bug will be fixed in straightly the next commit. Sorry for the trouble! Load together with Compiler-ct.423 only.

=============== Diff against Morphic-eem.1638 ===============

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 |
- 
- 	| 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 := [
  		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.
- 	
  	(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