changed class creation to allow create including classInstVars (may be used to avoid recompilation)
--- a/Metaclass.st Mon Jan 22 14:18:17 1996 +0100
+++ b/Metaclass.st Mon Jan 22 14:19:31 1996 +0100
@@ -431,6 +431,37 @@
comment:commentString
changed:changed
+ ^ self
+ name:newName
+ inEnvironment:aSystemDictionary
+ subclassOf:aClass
+ instanceVariableNames:stringOfInstVarNames
+ variable:variableBoolean
+ words:wordsBoolean
+ pointers:pointersBoolean
+ classVariableNames:stringOfClassVarNames
+ poolDictionaries:stringOfPoolNames
+ category:categoryString
+ comment:commentString
+ changed:changed
+ classInstanceVariableNames:''
+
+ "Modified: 22.1.1996 / 13:18:08 / cg"
+!
+
+name:newName inEnvironment:aSystemDictionary
+ subclassOf:aClass
+ instanceVariableNames:stringOfInstVarNames
+ variable:variableBoolean
+ words:wordsBoolean
+ pointers:pointersBoolean
+ classVariableNames:stringOfClassVarNames
+ poolDictionaries:stringOfPoolNames
+ category:categoryString
+ comment:commentString
+ changed:changed
+ classInstanceVariableNames:stringOfClassInstVarNames
+
"this is the main workhorse for installing new classes - special care
has to be taken, when changing an existing classes definition. In this
case, some or all of the methods and subclasses methods have to be
@@ -444,7 +475,7 @@
classVarChange instVarChange superClassChange newComment
changeSet1 changeSet2 addedNames
anyChange oldInstVars newInstVars oldClassVars newClassVars superFlags newFlags
- project currentProject t|
+ project currentProject t nClassInstVars|
"NOTICE:
this method is too complex and should be splitted into managable pieces ...
@@ -477,7 +508,7 @@
"look, if it already exists as a class"
aSystemDictionary notNil ifTrue:[
- oldClass := aSystemDictionary at:classSymbol ifAbsent:[nil].
+ oldClass := aSystemDictionary at:classSymbol ifAbsent:[nil].
].
(oldClass isBehavior and:[oldClass isLoaded]) ifFalse:[
oldClass := nil.
@@ -567,13 +598,16 @@
]
].
+ nClassInstVars := stringOfClassInstVarNames countWords.
+
"create the metaclass first"
newMetaclass := Metaclass new.
newMetaclass setSuperclass:(aClass class).
- newMetaclass instSize:(aClass class instSize).
+ newMetaclass instSize:(aClass class instSize + nClassInstVars).
newMetaclass setName:(nameString , 'class') asSymbol.
newMetaclass classVariableString:'' "stringOfClassVarNames".
"/ newMetaclass setComment:newComment category:categoryString.
+ newMetaclass setInstanceVariableString:stringOfClassInstVarNames.
"then let the new meta create the class"
newClass := newMetaclass new.
@@ -740,7 +774,7 @@
self addChangeRecordForClass:newClass.
aSystemDictionary notNil ifTrue:[
"notify change of category"
- aSystemDictionary changed:#organization
+ aSystemDictionary changed:#organization
]
].
"notify change of class"
@@ -1047,12 +1081,12 @@
and make the new class globally known
"
aSystemDictionary notNil ifTrue:[
- aSystemDictionary at:classSymbol put:newClass.
+ aSystemDictionary at:classSymbol put:newClass.
- oldClass category ~= categoryString ifTrue:[
+ oldClass category ~= categoryString ifTrue:[
"notify change of organization"
aSystemDictionary changed:#organization
- ].
+ ].
].
"
@@ -1073,7 +1107,7 @@
^ newClass
- "Created: 9.12.1995 / 17:06:26 / cg"
+ "Modified: 22.1.1996 / 13:17:13 / cg"
!
new
@@ -1366,5 +1400,5 @@
!Metaclass class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.43 1996-01-16 02:25:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.44 1996-01-22 13:19:31 cg Exp $'
! !