--- a/ClassDefinitionChange.st Mon Dec 26 13:01:53 2011 +0100
+++ b/ClassDefinitionChange.st Wed Dec 28 16:35:20 2011 +0100
@@ -97,13 +97,43 @@
deltaDetail
"Returns a delta to the current state as a ChangeDelta object"
- | class mySource imageSource|
+ | class mySource imageSource myTree imageTree same |
class := self changeClass.
class isNil ifTrue:[^ ChangeDeltaInformation added ].
mySource := self source.
imageSource := class definitionWithoutPackage "definition".
- ^ (self class isSource: mySource sameSourceAs: imageSource )
+ same := (mySource = imageSource).
+ same ifFalse:[
+ same := (self class isSource: mySource sameSourceAs: imageSource ).
+ same ifFalse:[
+ "/ care for formatting (tabs, indentation etc.)
+ myTree := RBParser parseExpression:mySource.
+ imageTree := RBParser parseExpression:imageSource.
+ same := (myTree = imageTree).
+ same ifFalse:[
+ "/ some classDefinition strings contain sn
+ "/ instVarName string like 'foo bar ' instead of 'foo bar' (i.e. added a space)...
+ ((myTree receiver = imageTree receiver)
+ and:[ (myTree selector = imageTree selector)
+ and:[ ('*ubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' match: myTree selector)
+ and:[ (myTree arguments at:1) = (imageTree arguments at:1)
+
+ and:[ (2 to:5) conform:[:i |
+ ((myTree arguments at:i) isLiteral
+ and:[ (imageTree arguments at:i) isLiteral
+ and:[ (myTree arguments at:i) value asString withoutSeparators
+ = (imageTree arguments at:i) value asString withoutSeparators ]]) ]
+
+ ]]]])
+ ifTrue:[
+ same := true
+ ]
+ ].
+ ]
+ ].
+
+ ^ same
ifTrue:[ ChangeDeltaInformation identical ]
ifFalse:[ ChangeDeltaInformation different ]
@@ -537,11 +567,11 @@
!ClassDefinitionChange class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.64 2011-11-25 16:45:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.65 2011-12-28 15:35:20 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.64 2011-11-25 16:45:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.65 2011-12-28 15:35:20 cg Exp $'
!
version_SVN