[squeak-dev] The Trunk: Compiler-nice.136.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 10 08:39:19 UTC 2010

Nicolas Cellier uploaded a new version of Compiler to project The Trunk:

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

Name: Compiler-nice.136
Author: nice
Time: 10 March 2010, 9:39:11.938 am
UUID: 282cba3c-3e76-064d-b111-3741aa1a3745
Ancestors: Compiler-nice.135

Multiple automatic AmbigousSelector replacement was broken dur to subtle requestorOffset magic. Attempt a correction.

I just made the replacement work, but the second occurence selection just flash , I don't know why.

I do not really understand what I programmed... This is a door open to future bugs.
The requestorOffset inst var in Parser looks like a fragile construction to me.
 I dont understand selectInvisiblyFrom:to: neither...

Not sure what happens if we mix UnsedVariable, AmbiguousSelector and other automatic corrections.

Probably more work on this subject

=============== Diff against Compiler-nice.135 ===============

Item was changed:
  ----- Method: Parser>>ambiguousSelector:inRange: (in category 'error correction') -----
  ambiguousSelector: aString inRange: anInterval
+ 	| correctedSelector userSelection offset intervalWithOffset |
- 	| correctedSelector userSelection |
  	self interactive ifFalse: [
  		"In non interactive mode, compile with backward comapatibility: $- is part of literal argument"
  		Transcript cr; store: encoder classEncoding; nextPutAll:#'>>';store: encoder selector; show: ' would send ' , token , '-'.
  		token := token asSymbol.
  	"handle the text selection"
  	userSelection := requestor selectionInterval.
+ 	intervalWithOffset := anInterval first + requestorOffset to: anInterval last + requestorOffset.
+ 	requestor selectFrom: intervalWithOffset first to: intervalWithOffset last.
- 	requestor selectFrom: anInterval first to: anInterval last.
  	requestor select.
  	"Build the menu with alternatives"
  	correctedSelector := AmbiguousSelector 
  			signalName: aString
+ 			inRange: intervalWithOffset.
- 			inRange: anInterval.
  	correctedSelector ifNil: [^self fail].
  	"Execute the selected action"
+ 	offset := self substituteWord: correctedSelector wordInterval: intervalWithOffset offset: 0.
- 	self substituteWord: correctedSelector wordInterval: anInterval offset: 0.
  	requestor deselect.
+ 	requestor selectInvisiblyFrom: userSelection first to: userSelection last + offset.
- 	requestor selectInvisiblyFrom: userSelection first to: userSelection last + 1.
  	token := (correctedSelector readStream upTo: Character space) asSymbol!

More information about the Squeak-dev mailing list