"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
"{ Package: 'stx:libbasic3' }"
ClassChange subclass:#ClassDefinitionChange
instanceVariableNames:'objectType nameSpaceName package superClassName classType
indexedType otherParameters instanceVariableNames
classVariableNames classInstanceVariableNames poolDictionaries
category'
classVariableNames:''
poolDictionaries:''
category:'System-Changes'
!
!ClassDefinitionChange class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
documentation
"
instances represent class definition-changes.
They are typically held in a ChangeSet.
[author:]
Claus Gittinger
"
! !
!ClassDefinitionChange methodsFor:'accessing'!
category:something
category := something.
!
nameSpaceName
^ self cutNameSpaceOf:(nameSpaceName ? super nameSpaceName)
!
nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg
|indexedType private imports|
nameSpaceName := aNameSpaceName.
classType := aClassType.
otherParameters := Dictionary new addAll:otherParametersArg; yourself.
superClassName := otherParameters at:#superclass: ifAbsent:nil.
superClassName notNil ifTrue:[
superClassName := superClassName pathString.
].
indexedType := otherParameters at:#indexedType: ifAbsent:nil.
private := otherParameters at:#private: ifAbsent:nil.
instanceVariableNames := otherParameters at:#instanceVariableNames: ifAbsent:nil.
classInstanceVariableNames := otherParameters at:#classInstanceVariableNames: ifAbsent:nil.
imports := otherParameters at:#imports: ifAbsent:nil.
category := otherParameters at:#category: ifAbsent:nil.
!
objectType
"return the value of the instance variable 'objectType' (automatically generated)"
^ objectType
!
objectType:something
"set the value of the instance variable 'objectType' (automatically generated)"
objectType := something.
!
package:aPackageID
package := aPackageID
!
source
"return the source of the change"
|src nsName|
source isNil ifTrue:[
src := self definitionString
] ifFalse:[
src := super source
].
(nsName := self nameSpaceName) notNil ifTrue:[
^ '"{ NameSpace: ' , nsName , ' }"' ,
Character cr, Character cr ,
src
].
^ src
!
superClassName
^ self cutNameSpaceOf:superClassName
! !
!ClassDefinitionChange methodsFor:'comparing'!
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 ifTrue:[^ false].
^ true
!
sameAs:changeB
"return true, if the given change represents the same change as the receiver."
(self isForSameAs:changeB) ifFalse:[^ false].
^ self sameSourceAs:changeB
! !
!ClassDefinitionChange methodsFor:'printing & storing'!
definitionString
^ String streamContents:[:stream |
objectType == #variable ifTrue:[
stream
nextPutAll:self nameSpaceName;
nextPutAll:' addClassVarName:';
nextPutAll:self className asString storeString
] ifFalse:[
stream
nextPutAll:self superClassName;
nextPutAll:' subclass:';
nextPutAll:self className 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;
spaces:4;
nextPutAll:'category: ';
nextPutAll:(category ? '') storeString
]
]
!
printOn:aStream
aStream nextPutAll:className
!
printWithoutClassNameOn:aStream
aStream nextPutAll:('definition of ' , className)
! !
!ClassDefinitionChange methodsFor:'queries'!
definitionSelector
|parseTree|
parseTree := Parser parseExpression:self source.
parseTree isMessage ifTrue:[
^ parseTree selector
].
self error:'should not happen'.
!
isClassDefinitionChange
^ true
! !
!ClassDefinitionChange methodsFor:'special'!
installAsAutoloadedClassIfNotPrivate
|parseTree sel cat clsName catIdx|
parseTree := Parser parseExpression:self source.
parseTree isMessage ifFalse:[
self error:'should not happen: bad change source'.
].
sel := parseTree selector.
(sel endsWith:':privateIn:') ifTrue:[^ self].
catIdx := sel keywords indexOf:'category:'.
catIdx ~~ 0 ifTrue:[
cat := (parseTree args at:catIdx) evaluate.
].
clsName := self className asSymbol.
((Smalltalk includesKey:clsName) not
or:[ (Smalltalk at:clsName) isBehavior not]) ifTrue:[
Smalltalk
installAutoloadedClassNamed:clsName
category:cat
package:(package ? Project current package)
revision:nil
]
! !
!ClassDefinitionChange class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.28 2003-01-26 14:05:36 cg Exp $'
! !