--- a/ClassDefinitionChange.st Thu Apr 11 14:36:03 2013 +0200
+++ b/ClassDefinitionChange.st Tue Apr 16 09:44:57 2013 +0200
@@ -51,7 +51,7 @@
!ClassDefinitionChange class methodsFor:'others'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.76 2013-03-30 01:54:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.79 2013-04-14 06:55:37 cg Exp $'
! !
@@ -351,12 +351,32 @@
!ClassDefinitionChange methodsFor:'comparing'!
+isConflict
+ "true if this change is different than what is already in the image
+ (i.e. it overwrites some existing code)"
+
+ |cls|
+
+ (cls := self changeClass) isNil ifTrue:[^ false].
+ cls superclass name ~= superClassName ifTrue:[ ^ true ].
+ cls instanceVariableString ~= instanceVariableNames ifTrue:[ ^ true ].
+ cls classVariableString ~= classVariableNames ifTrue:[ ^ true ].
+ cls class instanceVariableString ~= classInstanceVariableNames ifTrue:[ ^ true ].
+ cls sharedPoolNames ~= poolDictionaries ifTrue:[ ^ true ].
+ cls category ~= category ifTrue:[ ^ true ].
+ cls isPrivate ifTrue:[
+ cls owningClass name ~= owningClassName ifTrue:[ ^ true ].
+ ].
+ cls definitionSelector ~= self definitionSelector ifTrue:[ ^ true ].
+ ^ false
+!
+
isForSameAs:changeB
"return true, if the given change represents a change for the same
thingy as the receiver (i.e. same method, same definition etc.)."
changeB isClassDefinitionChange ifFalse:[^ false].
- ^ className = changeB className
+ ^ self className = changeB className.
!
sameAs:changeB
@@ -383,14 +403,16 @@
!ClassDefinitionChange methodsFor:'printing & storing'!
definitionString
- |ns classNameUsed superClassNameUsed selPart|
+ ^ self definitionStringInNamespace: (self nameSpaceOverride)
+!
- ns := self nameSpaceOverride.
+definitionStringInNamespace: nsOrNil
+ |classNameUsed superClassNameUsed selPart|
objectType == #variable ifTrue:[
^ String streamContents:[:stream |
- ns notNil ifTrue:[
- stream nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
+ nsOrNil notNil ifTrue:[
+ stream nextPutAll:((nsOrNil asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
] ifFalse:[
self halt:'can this happen ?'.
stream nextPutAll:'Smalltalk'
@@ -407,6 +429,7 @@
"/ local name as argument, not the full name
classNameUsed := self localClassName.
+ "/ selPart is the subclass:/variableSubclass/variableByteSubclass:/... - part
selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:')
keywords first.
@@ -414,117 +437,30 @@
stream
nextPutAll:superClassNameUsed;
nextPutAll:' ',selPart;
- nextPutAll: classNameUsed asSymbol storeString;
- cr;
- spaces:4;
- nextPutAll:'instanceVariableNames: ';
- nextPutAll:(instanceVariableNames ? '') storeString;
- cr;
- spaces:4;
- nextPutAll:'classVariableNames: ';
- nextPutAll:(classVariableNames ? '') storeString;
- cr;
- spaces:4;
- nextPutAll:'poolDictionaries: ';
- nextPutAll:(poolDictionaries ? '') storeString;
- cr.
+ nextPutLine: classNameUsed asSymbol storeString;
+ nextPutAll:' instanceVariableNames: ';
+ nextPutLine:(instanceVariableNames ? '') storeString;
+ nextPutAll:' classVariableNames: ';
+ nextPutLine:(classVariableNames ? '') storeString;
+ nextPutAll:' poolDictionaries: ';
+ nextPutLine:(poolDictionaries ? '') storeString.
private == true ifTrue:[
stream
- spaces:4;
- nextPutAll:'privateIn: ';
+ nextPutAll:' privateIn: ';
nextPutAll:(self owningClassName)
] ifFalse:[
stream
- spaces:4;
- nextPutAll:'category: ';
- nextPutAll:(category ? '') storeString
+ nextPutAll:' category: ';
+ nextPutAll:(category ? '') asString storeString
].
]
"Modified: / 13-06-2012 / 13:01:58 / cg"
!
-definitionStringInNamespace: ns
- | classNameUsed superClassNameUsed |
-
- objectType == #variable ifTrue:[
- ^ String streamContents:[:stream |
- ns notNil ifTrue:[
- stream
- nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
- ] ifFalse:[
- self halt:'can this happen ?'.
- stream
- nextPutAll:'Smalltalk'
- ].
-
- stream
- nextPutAll:' addClassVarName:';
- nextPutAll:className asString storeString
- ].
- ].
-
- superClassNameUsed := self superClassName.
- classNameUsed := self classNameWithoutNamespace.
+definitionStringWithoutNamespace
+ "cg - huh - who needs that? (the definitionString already does NOT include the classes namespace)"
- ^ String streamContents:[:stream |
- self isPrivateClassDefinitionChange ifFalse:[
- stream
- nextPutAll:(superClassNameUsed ? 'nil');
- nextPutAll:' subclass:';
- nextPutAll: classNameUsed asSymbol storeString
- ;
- cr;
- tab;
- nextPutAll:'instanceVariableNames:';
- nextPutAll:(instanceVariableNames ? '') storeString;
- cr;
- tab;
- nextPutAll:'classVariableNames:';
- nextPutAll:(classVariableNames ? '') storeString;
- cr;
- tab;
- nextPutAll:'poolDictionaries:';
- nextPutAll:(poolDictionaries ? '') storeString;
- cr;
- tab;
- nextPutAll:'category:';
- nextPutAll:(category ? '') storeString;
- cr
- ] ifTrue:[
- stream
- nextPutAll:superClassNameUsed;
- nextPutAll:' subclass:';
- nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
- ;
- cr;
- tab;
- nextPutAll:'instanceVariableNames:';
- nextPutAll:(instanceVariableNames ? '') storeString;
- cr;
- tab;
- nextPutAll:'classVariableNames:';
- nextPutAll:(classVariableNames ? '') storeString;
- cr;
- tab;
- nextPutAll:'poolDictionaries:';
- nextPutAll:(poolDictionaries ? '') storeString;
- cr;
- tab;
- nextPutAll:'privateIn:';
- nextPutAll:
- (ns isNil
- ifTrue:[owningClassName]
- ifFalse:[owningClassName copyFrom: ns size + 3]);
- cr
- ]
- ]
-
- "Modified: / 06-10-2011 / 17:02:05 / cg"
- "Created: / 20-03-2012 / 19:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-definitionStringWithoutNamespace
|ns classNameUsed superClassNameUsed|
ns := self nameSpaceOverride.
@@ -815,7 +751,7 @@
!ClassDefinitionChange class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.76 2013-03-30 01:54:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.79 2013-04-14 06:55:37 cg Exp $'
!
version_HG