[squeak-dev] The Trunk: Tools-fbs.486.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jul 15 22:01:59 UTC 2013

Frank Shearar uploaded a new version of Tools to project The Trunk:

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

Name: Tools-fbs.486
Author: fbs
Time: 15 July 2013, 11:01:05.791 pm
UUID: 9e272ffa-9ada-eb47-a82d-22699ec6eccf
Ancestors: Tools-fbs.485

#methodDiffFor:class:selector:prettyDiffs: has only one sender, so move the method where if wants to go and deprecate the old copy.

=============== Diff against Tools-fbs.485 ===============

Item was changed:
  ----- Method: ChangeList>>contentsDiffedFromCurrent (in category 'viewing access') -----
  	"Answer the contents diffed forward from current (in-memory) method version"
  	| aChange aClass |
  	listIndex = 0
  		ifTrue: [^ ''].
  	aChange := changeList at: listIndex.
  	 (aChange type == #method
  	 and: [(aClass := aChange methodClass) notNil
  	 and: [aClass includesSelector: aChange methodSelector]]) ifTrue:
+ 		[^self
- 		[^Utilities
  			methodDiffFor: aChange text
  			class: aClass
  			selector: aChange methodSelector
  			prettyDiffs: self showingPrettyDiffs].
  	aChange type == #doIt ifTrue:
  		[| tokens |
  		 tokens := Scanner new scanTokens: aChange string.
  		 ((tokens select:
  				[:substr| #(subclass: variableByteSubclass: variableWordSubclass:
  							instanceVariableNames: classVariableNames: ) includes: substr])
  					asSet size >= 3
  		  and: [(aClass := Smalltalk at: tokens third ifAbsent: []) notNil
  		  and: [aClass isBehavior]]) ifTrue:
  			[^ClassDiffBuilder buildDisplayPatchFrom: aClass definition to: aChange string].
  		(tokens size = 4
  		 and: [tokens second == #class
  		 and: [tokens third == #instanceVariableNames:
  		 and: [(aClass := Smalltalk at: tokens first ifAbsent: []) notNil
  		 and: [aClass isBehavior]]]]) ifTrue:
  			[^ClassDiffBuilder buildDisplayPatchFrom: aClass class definition to: aChange string]].
  	(aChange type == #classComment
  	and: [(aClass := aChange commentClass) notNil]) ifTrue:
  		[^ClassDiffBuilder buildDisplayPatchFrom: aClass comment asString to: aChange string].
  	^(changeList at: listIndex) text!

Item was added:
+ ----- Method: ChangeList>>methodDiffFor:class:selector:prettyDiffs: (in category 'viewing access') -----
+ methodDiffFor: aString class: aClass selector: aSelector prettyDiffs: prettyDiffBoolean
+ 	"Return a string comprising a source-code diff between an existing method and the source-code in aString.  DO prettyDiff if prettyDiffBoolean is true."
+ 	^ (aClass notNil and: [aClass includesSelector: aSelector])
+ 		ifTrue:
+ 			[TextDiffBuilder
+ 				buildDisplayPatchFrom: (aClass sourceCodeAt: aSelector)
+ 				to: aString
+ 				inClass: aClass
+ 				prettyDiffs: prettyDiffBoolean]
+ 		ifFalse:
+ 			[aString copy]!

More information about the Squeak-dev mailing list