[BUG][FIX] ChangeSet class order

Bob Arning arning at charm.net
Thu Sep 30 18:47:42 UTC 1999


It is possible for the ChangeSorter to file out class definitions in an order that cannot be read back in. If you do the following

Object subclass: #BBB
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Kernel-Objects'

followed by:

BBB subclass: #AAA
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Kernel-Objects'

followed by:

AAA class
	instanceVariableNames: 'some '

and then file out the current changeset,  you get something like:

'From Squeak 2.5 of August 6, 1999 on 30 September 1999 at 2:39:31 pm'!
AAA class
	instanceVariableNames: 'some '!
Object subclass: #BBB
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Kernel-Objects'!
BBB subclass: #AAA
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Kernel-Objects'!

and the compiler is not going to be happy with the first chunk. Attached is a fix.

Cheers,
Bob

==========fix below==========
'From Squeak 2.5 of August 6, 1999 on 30 September 1999 at 2:36:29 pm'!

!ChangeSet class methodsFor: 'fileIn/Out' stamp: 'RAA 9/30/1999 14:34'!
superclassOrder: classes 
	"Arrange the classes in the collection, classes, in superclass order so the 
	classes can be properly filed in."

	| all list i aClass |
	list _ classes copy. 			"list is indexable"
	all _ OrderedCollection new: list size.
	[list size > 0] whileTrue: [
		i _ 0.
		[
			i _ i + 1.
			aClass _ list at: i.
			(list includesAnyOf: aClass allSuperclasses) or: [
				aClass isMeta and: [
					(list includes: aClass soleInstance) or: [
						list includesAnyOf: aClass soleInstance allSuperclasses
					] 
				].
			].
		] whileTrue.
		all addLast: aClass.
		list _ list copyWithout: aClass
	].
	^all! !





More information about the Squeak-dev mailing list