--- a/ClassBuilder.st Sat Nov 07 11:14:40 2009 +0100
+++ b/ClassBuilder.st Sat Nov 07 14:26:45 2009 +0100
@@ -370,18 +370,6 @@
classVariableNames := ''
].
- (instanceVariableNames size > 0
- or:[classVariableNames size > 0]) ifTrue:[
- (self
- checkValidVarNamesFor:className
- subClassOf:superClass
- instVarNames:instanceVariableNames
- classVarNames:classVariableNames)
- ifFalse:[
- ^ nil
- ].
- ].
-
buildingPrivateClass := false.
environment notNil ifTrue:[
self determineNewName ifFalse:[
@@ -404,6 +392,18 @@
]
].
+ (instanceVariableNames size > 0
+ or:[classVariableNames size > 0]) ifTrue:[
+ (self
+ checkValidVarNamesFor:className
+ subClassOf:superClass
+ instVarNames:instanceVariableNames
+ classVarNames:classVariableNames)
+ ifFalse:[
+ ^ nil
+ ].
+ ].
+
oldClass notNil ifTrue:[
(oldClass isRealNameSpace) ifTrue:[
(superClass == NameSpace or:[superClass isNamespace]) ifFalse:[
@@ -2152,18 +2152,18 @@
checkValidVarNamesFor:className subClassOf:aClass instVarNames:instVarNameString classVarNames:classVarNameString
"Check for some 'considered bad-style' things, like lower case names.
NOTICE:
- I dont like the confirmers below - we need a notifying: argument, to give
- the outer codeview a chance to highlight the error.
- (but thats how its defined in the book - maybe I will change it anyway).
+ I dont like the confirmers below - we need a notifying: argument, or a
+ notifierSignal to give the outer codeview a chance to highlight the error.
+ (but that's how its defined in the book - maybe I will change it anyway).
"
- |names|
+ |instVarNames classVarNames privateClassNames conflicts|
- names := instVarNameString asCollectionOfWords.
+ instVarNames := instVarNameString asCollectionOfWords.
"check for instvar redefs within local instvars"
- names keysAndValuesDo:[:index :aName |
- (names indexOf:aName startingAt:index+1) ~~ 0 ifTrue:[
+ instVarNames keysAndValuesDo:[:index :aName |
+ (instVarNames indexOf:aName startingAt:index+1) ~~ 0 ifTrue:[
self warn:('instance variable "%1"\occurs multiple times in instVarString.\\Class %2 not installed.'
bindWith:aName
with:className) withCRs.
@@ -2171,15 +2171,32 @@
]
].
- names := classVarNameString asCollectionOfWords.
+ classVarNames := classVarNameString asCollectionOfWords.
"check for classvar redefs within local instvars"
- names keysAndValuesDo:[:index :aName |
- (names indexOf:aName startingAt:index+1) ~~ 0 ifTrue:[
+ classVarNames keysAndValuesDo:[:index :aName |
+ (classVarNames indexOf:aName startingAt:index+1) ~~ 0 ifTrue:[
self warn:'class variable ''' , aName , '''\occurs multiple times in classVarString.\\Class not installed.' withCRs.
^ false.
]
].
+
+ oldClass notNil ifTrue:[
+ "check against private classes"
+
+ privateClassNames := oldClass theNonMetaclass privateClasses collect:[:cls | cls nameWithoutPrefix].
+ conflicts := classVarNames intersect:privateClassNames.
+ conflicts notEmpty ifTrue:[
+ conflicts size == 1 ifTrue:[
+ self warn:('Class variable "%1"\conflicts with corresponding private classes name.'
+ bindWith:conflicts first) withCRs.
+ ] ifFalse:[
+ self warn:('Some class variables conflict with corresponding private classes name.').
+ ].
+ ^ true.
+ ]
+ ].
+
^ true
"Created: 8.1.1997 / 21:09:14 / cg"
@@ -2189,9 +2206,9 @@
!ClassBuilder class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.84 2009-11-05 23:15:35 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.85 2009-11-07 13:26:45 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.84 2009-11-05 23:15:35 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.85 2009-11-07 13:26:45 cg Exp $'
! !