[squeak-dev] The Trunk: Tools-tpr.818.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jun 5 23:52:39 UTC 2018


tim Rowledge uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-tpr.818.mcz

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

Name: Tools-tpr.818
Author: tpr
Time: 5 June 2018, 4:52:21.020441 pm
UUID: 62fb39e0-5fe8-4598-abb5-be5a0a754547
Ancestors: Tools-eem.817

Clean up a rather odd looking clause in these methods; it was checking to see if a certain class exists in the image but then
a) naming the parameter in the #ifNil:ifNotNil: with the class name
b) then referring to the class by name within the block.
It seems a bit weird that the compiler would accept that without complaining about mis-use of a global as a block temp and so on, but evidently it worled.
The code generates exactly the same bytecodes. I think it looks a lot less confusing with a 'proper' temp variable name though.

=============== Diff against Tools-eem.817 ===============

Item was changed:
  ----- Method: Browser>>messageHelpFor: (in category 'message list') -----
  messageHelpFor: aSelector 
  	"Show the first n lines of the sources code of the message behind aSelector."
  	
  	| source formatted iconHelp |
  	Preferences balloonHelpInMessageLists ifFalse: [^ nil].
  
  	source := self selectedClassOrMetaClass sourceCodeAt: aSelector ifAbsent: [^ nil].
  	source lineCount > 5 ifTrue: [
  		| sourceLines |
  		sourceLines := (source asString lines copyFrom: 1 to: 5) asOrderedCollection.
  		sourceLines add: ' [...]'.
  		source := sourceLines joinSeparatedBy: Character cr].
  
  	
  	formatted := (Smalltalk classNamed: #SHTextStylerST80)
  		ifNil: [ source asText ]
+ 		ifNotNil: [ :textStylerClass |
+ 			textStylerClass new
- 		ifNotNil: [ :SHTextStylerST80 |
- 			SHTextStylerST80 new
  				classOrMetaClass: self selectedClassOrMetaClass;
  				styledTextFor: source asText ].
  	iconHelp := (self messageIconHelpFor: aSelector) ifNotEmpty: [:t | 
  		t , Character cr, Character cr].
  	^ iconHelp asText
  		append: formatted;
  		yourself!

Item was removed:
- ----- Method: Context>>inspectorClass (in category '*Tools-Inspector') -----
- inspectorClass
- 	"Answer the class of the inspector to be used on the receiver.  Called by inspect; 
- 	use basicInspect to get a normal (less useful) type of inspector."
- 
- 	^ ContextInspector!

Item was changed:
  ----- Method: Debugger>>messageHelpAt: (in category 'context stack (message list)') -----
  messageHelpAt: anIndex
  	"Show the first n lines of the sources code of the selected message."
  	
  	| method source formatted lineCount |
  	Preferences balloonHelpInMessageLists ifFalse: [^ nil].
  	contextStack size < anIndex ifTrue: [^ nil].
  	
  	method := (contextStack at: anIndex) method.
  	
  	source := method getSource.
  	formatted := (Smalltalk classNamed: #SHTextStylerST80)
  		ifNil: [ source asText ]
+ 		ifNotNil: [ :textStylerClass |
+ 			textStylerClass new
- 		ifNotNil: [ :SHTextStylerST80 |
- 			SHTextStylerST80 new
  				classOrMetaClass: method methodClass;
  				styledTextFor: source asText ].
  	
  	lineCount := 0.
  	source doWithIndex: [:char :index |
  		char = Character cr ifTrue: [lineCount := lineCount + 1].
  		lineCount > 10 ifTrue: [
  			formatted := formatted copyFrom: 1 to: index-1.
  			formatted append: ' [...]'.
  			^ formatted]].
  
  	^ formatted!

Item was changed:
  ----- Method: MessageSet>>messageHelpAt: (in category 'message list') -----
  messageHelpAt: anIndex
  	"Show the first n lines of the sources code of the selected message."
  	
  	| reference source formatted lineCount |
  	Preferences balloonHelpInMessageLists ifFalse: [^ nil].
  	self messageList size < anIndex ifTrue: [^ nil].
  	
  	reference := self messageList at: anIndex.
  	reference isValid ifFalse: [^ nil].
  	
  	source := reference compiledMethod getSource.
  	formatted := (Smalltalk classNamed: #SHTextStylerST80)
  		ifNil: [ source asText ]
+ 		ifNotNil: [ :textStylerClass |
+ 			textStylerClass new
- 		ifNotNil: [ :SHTextStylerST80 |
- 			SHTextStylerST80 new
  				classOrMetaClass: reference actualClass;
  				styledTextFor: source asText ].
  	
  	lineCount := 0.
  	source doWithIndex: [:char :index |
  		char = Character cr ifTrue: [lineCount := lineCount + 1].
  		lineCount > 10 ifTrue: [
  			formatted := formatted copyFrom: 1 to: index-1.
  			formatted append: ' [...]'.
  			^ formatted]].
  
  	^ formatted!

Item was changed:
  ----- Method: TimeProfileBrowser>>messageHelpAt: (in category 'message list') -----
  messageHelpAt: anIndex
  	"Show the first n lines of the sources code of the selected message."
  	
  	| reference source formatted lineCount |
  	Preferences balloonHelpInMessageLists ifFalse: [^ nil].
  	self messageList size < anIndex ifTrue: [^ nil].
  	
  	reference := (self methodReferences at: anIndex) ifNil: [ ^nil ].
  	reference isValid ifFalse: [ ^nil ].
  	
  	source := reference compiledMethod getSource.
  	formatted := (Smalltalk classNamed: #SHTextStylerST80)
  		ifNil: [ source asText ]
+ 		ifNotNil: [ :textStylerClass |
+ 			textStylerClass new
- 		ifNotNil: [ :SHTextStylerST80 |
- 			SHTextStylerST80 new
  				classOrMetaClass: reference actualClass;
  				styledTextFor: source asText ].
  	
  	lineCount := 0.
  	source doWithIndex: [:char :index |
  		char = Character cr ifTrue: [lineCount := lineCount + 1].
  		lineCount > 10 ifTrue: [
  			formatted := formatted copyFrom: 1 to: index-1.
  			formatted append: ' [...]'.
  			^ formatted]].
  
  	^ formatted!



More information about the Squeak-dev mailing list