Metaclass.st
author Claus Gittinger <cg@exept.de>
Wed, 07 Feb 1996 15:11:43 +0100
changeset 939 ffee570b0f09
parent 912 a009f25a6800
child 943 57641242a972
permissions -rw-r--r--
added #setProject: (does not send change notifications)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
Class subclass:#Metaclass
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    14
	 instanceVariableNames:'myClass'
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    15
	 classVariableNames:''
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    16
	 poolDictionaries:''
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    17
	 category:'Kernel-Classes'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    20
!Metaclass class methodsFor:'documentation'!
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    21
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    22
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    23
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    24
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
    25
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    27
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    28
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    30
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    31
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    32
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    33
"
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    34
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    35
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    36
documentation
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    37
"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    38
    every classes class is a subclass of Metaclass.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    39
    (i.e. every class is the sole instance of its Metaclass)
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    40
    Metaclass provides support for creating new (sub)classes and/or 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    41
    changing the definition of an already existing class.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    42
"
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    43
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    44
356
claus
parents: 328
diff changeset
    45
!Metaclass class methodsFor:'creating metaclasses'!
claus
parents: 328
diff changeset
    46
claus
parents: 328
diff changeset
    47
new
claus
parents: 328
diff changeset
    48
    "creating a new metaclass - have to set the new classes
claus
parents: 328
diff changeset
    49
     flags correctly to have it behave like a metaclass ...
claus
parents: 328
diff changeset
    50
     Not for normal applications - creating new metaclasses is a very
claus
parents: 328
diff changeset
    51
     tricky thing; should be left to the gurus ;-)"
claus
parents: 328
diff changeset
    52
claus
parents: 328
diff changeset
    53
    |newMetaclass|
claus
parents: 328
diff changeset
    54
claus
parents: 328
diff changeset
    55
    newMetaclass := super new.
claus
parents: 328
diff changeset
    56
    newMetaclass instSize:(Class instSize).
claus
parents: 328
diff changeset
    57
    newMetaclass setSuperclass:Class.
claus
parents: 328
diff changeset
    58
claus
parents: 328
diff changeset
    59
    ^ newMetaclass
claus
parents: 328
diff changeset
    60
claus
parents: 328
diff changeset
    61
    "
claus
parents: 328
diff changeset
    62
     Metaclass new           <- new metaclass
claus
parents: 328
diff changeset
    63
     Metaclass new new       <- new class
claus
parents: 328
diff changeset
    64
     Metaclass new new new   <- new instance
claus
parents: 328
diff changeset
    65
    "
claus
parents: 328
diff changeset
    66
! !
claus
parents: 328
diff changeset
    67
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    68
!Metaclass methodsFor:'accessing'!
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    69
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    70
name
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    71
    "return my name - that is the name of my sole class, with 'class'
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    72
     appended. Currently, this is incompatible to ST-80 (which appends ' class')
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    73
     and will be changed (have to check for side effects first ...)"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    74
682
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    75
    |nm|
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    76
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    77
    myClass isNil ifTrue:[
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    78
	^ 'someMetaclass'
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    79
    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    80
"/    ^ myClass name , ' class'
682
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    81
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    82
    (nm := myClass name) isNil ifTrue:[
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    83
	'oops - no name in my class' errorPrintNL.
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    84
	name notNil ifTrue:[
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    85
	    ^ name
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    86
	].
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    87
    ].
a10f434805a7 be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents: 657
diff changeset
    88
    ^ nm , 'class'
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    89
! !
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    90
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    91
!Metaclass methodsFor:'class instance variables'!
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    92
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    93
instanceVariableNames:aString
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    94
    "changing / adding class-inst vars -
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    95
     this actually creates a new metaclass and class, leaving the original
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    96
     classes around as obsolete classes. This may also be true for all subclasses,
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    97
     if class instance variables are added/removed.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    98
     Existing instances continue to be defined by their original classes.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
    99
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   100
     Time will show, if this is an acceptable behavior or if we should migrate
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   101
     instances to become insts. of the new classes."
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   102
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   103
    |newClass newMetaclass nClassInstVars oldClass 
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   104
     allSubclasses oldVars
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   105
     oldNames newNames addedNames
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   106
     oldOffsets newOffsets offset changeSet delta
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   107
     oldToNew newSubMeta newSub oldSubMeta oldSuper
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   108
     commonClassInstVars currentProject t|
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   109
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   110
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   111
     cleanup needed here: extract common things with name:inEnvironment:...
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   112
     and restructure things ... currently way too complex.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   113
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   114
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   115
    oldVars := self instanceVariableString.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   116
    aString = oldVars ifTrue:[
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   117
"
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   118
	Transcript showCr:'no change (', oldVars , ') -> (', aString , ')'.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   119
"
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   120
	^ self
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   121
    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   122
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   123
    oldNames := oldVars asCollectionOfWords.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   124
    newNames := aString asCollectionOfWords.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   125
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   126
    oldNames = newNames ifTrue:[
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   127
"
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   128
	Transcript showCr:'no real change'.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   129
"
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   130
	"no real change (just formatting)"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   131
	self setInstanceVariableString:aString.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   132
	^ self
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   133
    ]. 
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   134
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   135
"/    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   136
"/     let user confirm, if any name is no good (and was good before)
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   137
"/    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   138
"/    (oldNames inject:true
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   139
"/                into:[:okSoFar :word |
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   140
"/                         okSoFar and:[word first isUppercase]
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   141
"/                     ])
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   142
"/    ifTrue:[
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   143
"/        "was ok before"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   144
"/        (newNames inject:true
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   145
"/                    into:[:okSoFar :word |
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   146
"/                             okSoFar and:[word first isUppercase]
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   147
"/                         ])
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   148
"/        ifFalse:[
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   149
"/            (self confirm:'class instance variable names should start with an uppercase letter
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   150
"/(by convention only)
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   151
"/
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   152
"/install anyway ?' withCRs)
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   153
"/            ifFalse:[
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   154
"/                ^ nil
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   155
"/            ]
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   156
"/        ]
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   157
"/    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   158
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   159
    nClassInstVars := newNames size.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   160
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   161
"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   162
    Transcript showCr:'create new class/metaclass'.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   163
"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   164
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   165
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   166
     create the new metaclass
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   167
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   168
    newMetaclass := Metaclass new.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   169
    newMetaclass setSuperclass:superclass.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   170
    newMetaclass instSize:(superclass instSize + nClassInstVars).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   171
    (nClassInstVars ~~ 0) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   172
	newMetaclass setInstanceVariableString:aString
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   173
    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   174
"/    newMetaclass flags:(Behavior flagBehavior "flagNotIndexed").
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   175
    newMetaclass setName:name.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   176
    newMetaclass classVariableString:classvars.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   177
    newMetaclass category:category.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   178
    newMetaclass setComment:(self comment).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   179
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   180
    "find the class which is my sole instance"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   181
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   182
    t := Smalltalk allClasses select:[:element | element class == self].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   183
    (t size ~~ 1) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   184
	self error:'oops - I should have exactly one instance'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   185
	^ nil
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   186
    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   187
    oldClass := t anElement.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   188
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   189
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   190
     create the new class
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   191
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   192
    newClass := newMetaclass new.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   193
    newClass setSuperclass:(oldClass superclass).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   194
    newClass instSize:(oldClass instSize).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   195
    newClass flags:(oldClass flags).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   196
    newClass setName:(oldClass name).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   197
    newClass setInstanceVariableString:(oldClass instanceVariableString).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   198
    newClass classVariableString:(oldClass classVariableString).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   199
    newClass setComment:(oldClass comment).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   200
    newClass category:(oldClass category).
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   201
    (t := oldClass primitiveSpec) notNil ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   202
	newClass primitiveSpec:t.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   203
	newClass setClassFilename:(oldClass classFilename).
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   204
    ].        
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   205
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   206
    "/ set the new classes package
566
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   207
    "/ from the old package
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   208
566
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   209
    t := oldClass package.
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   210
    newMetaclass package:t.
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   211
    newClass package:t.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   212
723
ebc969b4678d preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   213
    "/ and keep the binary revision
ebc969b4678d preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   214
    newClass setBinaryRevision:(oldClass revision).
ebc969b4678d preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   215
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   216
    changeSet := Set new.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   217
    ((oldNames size == 0) 
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   218
    or:[newNames startsWith:oldNames]) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   219
	"new variable(s) has/have been added - old methods still work"
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   220
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   221
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   222
	Transcript showCr:'copying methods ...'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   223
	Transcript endEntry.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   224
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   225
	self copyMethodsFrom:self for:newMetaclass.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   226
	self copyMethodsFrom:oldClass for:newClass.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   227
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   228
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   229
	 but have to recompile methods accessing stuff now defined
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   230
	 (it might have been a global before ...)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   231
	"
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   232
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   233
	addedNames := newNames select:[:nm | (oldNames includes:nm) not].
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   234
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   235
	Transcript showCr:'recompiling methods accessing ' , addedNames printString ,  '...'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   236
	Transcript endEntry.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   237
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   238
	"recompile class-methods"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   239
	newMetaclass recompileMethodsAccessingAny:addedNames.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   240
    ] ifFalse:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   241
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   242
	 create the changeSet; thats the set of class instvar names
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   243
	 which have changed their position or are new
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   244
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   245
	offset := 0. oldOffsets := Dictionary new.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   246
	oldNames do:[:nm | offset := offset + 1. oldOffsets at:nm put:offset].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   247
	offset := 0. newOffsets := Dictionary new.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   248
	newNames do:[:nm | offset := offset + 1. newOffsets at:nm put:offset].
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   249
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   250
	oldOffsets associationsDo:[:a |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   251
	    |k|
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   252
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   253
	    k := a key.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   254
	    (newOffsets includesKey:k) ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   255
		changeSet add:k
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   256
	    ] ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   257
		(a value ~~ (newOffsets at:k)) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   258
		    changeSet add:k
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   259
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   260
	    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   261
	].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   262
	newOffsets associationsDo:[:a |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   263
	    |k|
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   264
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   265
	    k := a key.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   266
	    (oldOffsets includesKey:k) ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   267
		changeSet add:k
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   268
	    ] ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   269
		(a value ~~ (oldOffsets at:k)) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   270
		    changeSet add:k
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   271
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   272
	    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   273
	].
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   274
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   275
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   276
	Transcript showCr:'recompiling methods accessing ' , changeSet printString , ' ...'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   277
	Transcript endEntry.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   278
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   279
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   280
	 recompile class-methods
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   281
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   282
	self copyInvalidatedMethodsFrom:self for:newMetaclass accessingAny:changeSet.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   283
	newMetaclass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject).
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   284
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   285
	self copyMethodsFrom:oldClass for:newClass.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   286
    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   287
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   288
    delta := newNames size - oldNames size.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   289
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   290
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   291
     get list of all subclasses - do before superclass is changed
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   292
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   293
    allSubclasses := oldClass allSubclasses.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   294
    allSubclasses := allSubclasses asSortedCollection:[:a :b |
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   295
				b isSubclassOf:a
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   296
		     ].
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   297
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   298
    oldToNew := IdentityDictionary new.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   299
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   300
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   301
     create a new class tree, based on new version
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   302
    "
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   303
    allSubclasses do:[:aSubclass |
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   304
	oldSuper := aSubclass superclass.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   305
	oldSubMeta := aSubclass class.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   306
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   307
	newSubMeta := Metaclass new.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   308
	oldSuper == oldClass ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   309
	    newSubMeta setSuperclass:newMetaclass.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   310
	] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   311
	    newSubMeta setSuperclass:(oldToNew at:oldSuper) class.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   312
	].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   313
	newSubMeta instSize:(oldSubMeta instSize + delta).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   314
	newSubMeta flags:(oldSubMeta flags).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   315
	newSubMeta setName:(oldSubMeta name).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   316
	newSubMeta setInstanceVariableString:(oldSubMeta instanceVariableString).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   317
	newSubMeta classVariableString:(oldSubMeta classVariableString).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   318
	newSubMeta setComment:(oldSubMeta comment).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   319
	newSubMeta category:(oldSubMeta category).
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   320
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   321
	newSub := newSubMeta new.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   322
	oldSuper == oldClass ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   323
	    newSub setSuperclass:newClass.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   324
	] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   325
	    newSub setSuperclass:(oldToNew at:oldSuper).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   326
	].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   327
	newSub setSelectorArray:(aSubclass selectorArray).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   328
	newSub setMethodArray:(aSubclass methodArray).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   329
	newSub setName:(aSubclass name).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   330
	newSub classVariableString:(aSubclass classVariableString).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   331
	newSub setComment:(aSubclass comment).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   332
	newSub category:(aSubclass category).
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   333
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   334
	oldToNew at:aSubclass put:newSub.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   335
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   336
	aSubclass category:'obsolete'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   337
	aSubclass class category:'obsolete'.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   338
    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   339
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   340
    "recompile what needs to be"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   341
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   342
    delta == 0 ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   343
	"only have to recompile class methods accessing 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   344
	 class instvars from changeset
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   345
	"
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   346
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   347
	allSubclasses do:[:oldSubclass |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   348
	    |newSubclass|
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   349
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   350
	    newSubclass := oldToNew at:oldSubclass.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   351
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   352
Transcript showCr:'recompiling class methods of ' , newSubclass class name ,
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   353
		  ' accessing any of ' , changeSet printString.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   354
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   355
	    newSubclass class recompileMethodsAccessingAny:changeSet.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   356
	]
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   357
    ] ifFalse:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   358
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   359
	 have to recompile all class methods accessing class instvars
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   360
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   361
	commonClassInstVars := oldClass class allInstVarNames.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   362
	changeSet do:[:v |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   363
	    commonClassInstVars remove:v ifAbsent:[]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   364
	].
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   365
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   366
	allSubclasses do:[:oldSubclass |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   367
	    |newSubclass classInstVars|
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   368
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   369
	    newSubclass := oldToNew at:oldSubclass.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   370
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   371
	    classInstVars := newSubclass class allInstVarNames asSet.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   372
	    classInstVars removeAll:commonClassInstVars.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   373
	    classInstVars addAll:changeSet.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   374
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   375
Transcript showCr:'recompiling class methods of ' , newSubclass class name ,
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   376
		  ' accessing any of ' , classInstVars printString.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   377
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   378
	    newSubclass class recompileMethodsAccessingAny:classInstVars.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   379
	]
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   380
    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   381
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   382
    self addChangeRecordForClassInstvars:newClass.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   383
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   384
    "install all new classes"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   385
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   386
    Smalltalk at:(oldClass name asSymbol) put:newClass.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   387
    ObjectMemory flushCachesFor:oldClass.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   388
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   389
    allSubclasses do:[:oldClass |
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   390
	|newClass|
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   391
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   392
	newClass := oldToNew at:oldClass.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   393
"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   394
Transcript showCr:'install ' , newClass name , '(' , newClass category , ')' ,
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   395
		  ' as ' , newClass name.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   396
"
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   397
	Smalltalk at:newClass name asSymbol put:newClass.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   398
	ObjectMemory flushCachesFor:oldClass.
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   399
    ].
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   400
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   401
    "tell dependents ..."
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   402
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   403
    oldClass changed:#definition.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   404
    self changed:#definition.
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   405
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   406
    ^ newMetaclass
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   407
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   408
    "Created: 29.10.1995 / 19:57:08 / cg"
723
ebc969b4678d preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
   409
    "Modified: 9.12.1995 / 17:05:44 / cg"
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   410
! !
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   411
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   412
!Metaclass methodsFor:'copying'!
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   413
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   414
postCopy
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   415
    "redefined - a copy may have a new instance"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   416
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   417
    myClass := nil
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   418
! !
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
   419
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   420
!Metaclass methodsFor:'creating classes'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   421
a27a279701f8 Initial revision
claus
parents:
diff changeset
   422
name:newName inEnvironment:aSystemDictionary
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   423
	     subclassOf:aClass
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   424
	     instanceVariableNames:stringOfInstVarNames
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   425
	     variable:variableBoolean
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   426
	     words:wordsBoolean
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   427
	     pointers:pointersBoolean
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   428
	     classVariableNames:stringOfClassVarNames
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   429
	     poolDictionaries:stringOfPoolNames
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   430
	     category:categoryString
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   431
	     comment:commentString
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   432
	     changed:changed
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   433
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   434
    ^ self
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   435
	name:newName 
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   436
	inEnvironment:aSystemDictionary
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   437
	subclassOf:aClass
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   438
	instanceVariableNames:stringOfInstVarNames
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   439
	variable:variableBoolean
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   440
	words:wordsBoolean
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   441
	pointers:pointersBoolean
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   442
	classVariableNames:stringOfClassVarNames
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   443
	poolDictionaries:stringOfPoolNames
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   444
	category:categoryString
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   445
	comment:commentString
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   446
	changed:changed
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   447
	classInstanceVariableNames:''
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   448
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   449
    "Modified: 22.1.1996 / 13:18:08 / cg"
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   450
!
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   451
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   452
name:newName inEnvironment:aSystemDictionary
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   453
	     subclassOf:aClass
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   454
	     instanceVariableNames:stringOfInstVarNames
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   455
	     variable:variableBoolean
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   456
	     words:wordsBoolean
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   457
	     pointers:pointersBoolean
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   458
	     classVariableNames:stringOfClassVarNames
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   459
	     poolDictionaries:stringOfPoolNames
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   460
	     category:categoryString
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   461
	     comment:commentString
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   462
	     changed:changed
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   463
	     classInstanceVariableNames:stringOfClassInstVarNames
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   464
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   465
    "this is the main workhorse for installing new classes - special care
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   466
     has to be taken, when changing an existing classes definition. In this
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   467
     case, some or all of the methods and subclasses methods have to be
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   468
     recompiled.
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   469
     Also, the old class(es) are still kept (but not accessable as a global),
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   470
     to allow existing instances some life. 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   471
     This might change in the future.
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   472
    "
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   473
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   474
    |newClass newMetaclass nInstVars nameString classSymbol oldClass 
175
82ba8d2e3569 *** empty log message ***
claus
parents: 159
diff changeset
   475
     classVarChange instVarChange superClassChange newComment
308
f04744ef7b5d *** empty log message ***
claus
parents: 251
diff changeset
   476
     changeSet1 changeSet2 addedNames
326
d2902942491d *** empty log message ***
claus
parents: 314
diff changeset
   477
     anyChange oldInstVars newInstVars oldClassVars newClassVars superFlags newFlags
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   478
     project currentProject t nClassInstVars|
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   479
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   480
    "NOTICE:
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   481
     this method is too complex and should be splitted into managable pieces ...
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   482
     I dont like it anymore :-) 
356
claus
parents: 328
diff changeset
   483
     (well, at least, its a good test for the compilers ability 
claus
parents: 328
diff changeset
   484
      to handle big, complex methods ;-)
claus
parents: 328
diff changeset
   485
     take it as an example of bad coding style ...
claus
parents: 328
diff changeset
   486
claus
parents: 328
diff changeset
   487
     ST-80 uses a ClassBuilder object to collect the work and perform all updates;
claus
parents: 328
diff changeset
   488
     this method may be changed to do something similar in the future ...
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   489
    "
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   490
328
claus
parents: 326
diff changeset
   491
    project := Project. "/ have to fetch this before, in case its autoloaded
claus
parents: 326
diff changeset
   492
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   493
    newName = aClass name ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   494
	self error:'trying to create circular class definition'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   495
	^ nil
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   496
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   497
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   498
    "check for invalid subclassing of UndefinedObject and SmallInteger"
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   499
    aClass canBeSubclassed ifFalse:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   500
	self error:('it is not possible to subclass ' , aClass name).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   501
	^ nil
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   502
    ].
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   503
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   504
    nInstVars := stringOfInstVarNames countWords.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   505
    nameString := newName asString.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   506
    classSymbol := newName asSymbol.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   507
    newComment := commentString.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   508
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   509
    "look, if it already exists as a class"
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   510
    aSystemDictionary notNil ifTrue:[
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   511
	oldClass := aSystemDictionary at:classSymbol ifAbsent:[nil].
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   512
    ].
866
615ea25db48b dont copy comment from autoloaded classes
Claus Gittinger <cg@exept.de>
parents: 739
diff changeset
   513
    (oldClass isBehavior and:[oldClass isLoaded]) ifFalse:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   514
	oldClass := nil.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   515
    ] ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   516
	oldClass name ~= classSymbol ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   517
	    (self confirm:(classSymbol , ' is an alias for ' , oldClass name , '\\continue ?') withCRs)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   518
	    ifFalse:[^ self].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   519
	    oldClass := nil
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   520
	] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   521
	    "/
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   522
	    "/ some consisteny checks
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   523
	    "/
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   524
	    oldClass superclass notNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   525
		oldClass allSuperclasses do:[:cls |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   526
		    cls name = nameString ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   527
			self error:'trying to create circular class definition'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   528
			^ nil
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   529
		    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   530
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   531
	    ].
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   532
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   533
	    aClass superclass notNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   534
		aClass allSuperclasses do:[:cls |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   535
		    cls name = nameString ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   536
			self error:'trying to create circular class definition'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   537
			^ nil
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   538
		    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   539
		].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   540
	    ].
328
claus
parents: 326
diff changeset
   541
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   542
	    newComment isNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   543
		newComment := oldClass comment
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   544
	    ].
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   545
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   546
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   547
	     warn, if it exists with different category and different instvars,
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   548
	     and the existing is not an autoload class.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   549
	     Usually, this indicates that someone wants to create a new class with
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   550
	     a name, which already exists (it happened a few times to myself, while 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   551
	     I wanted to create a new class called ReturnNode ...).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   552
	     This will be much less of a problem, once multiple name spaces are
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   553
	     implemented and classes can be put into separate packages.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   554
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   555
	    oldClass isLoaded ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   556
		oldClass category ~= categoryString ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   557
		    oldClass instanceVariableString asCollectionOfWords 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   558
		    ~= stringOfInstVarNames asCollectionOfWords ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   559
			(self confirm:'a class named ' , oldClass name , 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   560
				      ' already exists -\\create (i.e. change) anyway ?' withCRs)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   561
			ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   562
			    ^ nil
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   563
			]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   564
		    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   565
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   566
	    ].
362
claus
parents: 357
diff changeset
   567
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   568
	    "/
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   569
	    "/ hints - warn, if creating a variableSubclass of a Set
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   570
	    "/ (common error - containers in ST/X do not use variable-slots)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   571
	    "/
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   572
	    ((variableBoolean == true) and:[pointersBoolean]) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   573
		(oldClass isKindOf:Set class) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   574
		    (self confirm:'ST/X Set & Dictionary are not variable-classes\create anyway ?' withCRs)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   575
		    ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   576
			^ nil
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   577
		    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   578
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   579
	    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   580
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   581
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   582
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   583
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   584
     Check for some 'considered bad-style' things, like lower case names.
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   585
     But only do these checks for new classes - 
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   586
     - thus, once confirmed, the warnings will not come again and again.
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   587
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   588
     NOTICE:
195
515af3696a5c *** empty log message ***
claus
parents: 175
diff changeset
   589
     I dont like the confirmers there - we need a notifying: argument, to give
44
b262907c93ea *** empty log message ***
claus
parents: 33
diff changeset
   590
     the outer codeview a chance to highlight the error.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   591
     (but thats how its defined in the book - maybe I will change anyway).
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   592
    "
44
b262907c93ea *** empty log message ***
claus
parents: 33
diff changeset
   593
    oldClass isNil ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   594
	(self checkConventionsFor:newName 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   595
		    instVarNames:stringOfInstVarNames 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   596
		    classVarNames:stringOfClassVarNames) ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   597
	    ^ nil
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   598
	]
44
b262907c93ea *** empty log message ***
claus
parents: 33
diff changeset
   599
    ].
b262907c93ea *** empty log message ***
claus
parents: 33
diff changeset
   600
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   601
    nClassInstVars := stringOfClassInstVarNames countWords.
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   602
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   603
    "create the metaclass first"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   604
    newMetaclass := Metaclass new.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   605
    newMetaclass setSuperclass:(aClass class).
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   606
    newMetaclass instSize:(aClass class instSize + nClassInstVars).
175
82ba8d2e3569 *** empty log message ***
claus
parents: 159
diff changeset
   607
    newMetaclass setName:(nameString , 'class') asSymbol.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   608
    newMetaclass classVariableString:'' "stringOfClassVarNames".
226
9287f8ace7ae set package
claus
parents: 202
diff changeset
   609
"/    newMetaclass setComment:newComment category:categoryString.
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   610
    newMetaclass setInstanceVariableString:stringOfClassInstVarNames.
326
d2902942491d *** empty log message ***
claus
parents: 314
diff changeset
   611
195
515af3696a5c *** empty log message ***
claus
parents: 175
diff changeset
   612
    "then let the new meta create the class"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   613
    newClass := newMetaclass new.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   614
    newClass setSuperclass:aClass.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   615
    newClass instSize:(aClass instSize + nInstVars).
175
82ba8d2e3569 *** empty log message ***
claus
parents: 159
diff changeset
   616
    newClass setName:classSymbol.
82ba8d2e3569 *** empty log message ***
claus
parents: 159
diff changeset
   617
    newClass setComment:newComment category:categoryString.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   618
362
claus
parents: 357
diff changeset
   619
    "/ set the new classes package
566
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   620
    "/ but prefer the old package
362
claus
parents: 357
diff changeset
   621
566
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   622
    oldClass notNil ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   623
	t := oldClass package.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   624
	newClass setBinaryRevision:(oldClass revision).
566
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   625
    ] ifFalse:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   626
	project notNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   627
	    currentProject := project current.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   628
	    currentProject notNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   629
		t := currentProject packageName.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   630
	    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   631
	].
566
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   632
    ].
3d2527a9e96d preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   633
    t notNil ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   634
	newMetaclass package:t.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   635
	newClass package:t.
362
claus
parents: 357
diff changeset
   636
    ].
claus
parents: 357
diff changeset
   637
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   638
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   639
     Allowing non-booleans as variableBoolean
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   640
     is a hack for backward (ST-80) compatibility:
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   641
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   642
     ST-80 code will pass true or false as variableBoolean,
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   643
     while ST/X also calls it with symbols such as #float, #double etc.
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   644
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   645
    (variableBoolean == true) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   646
	pointersBoolean ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   647
	    newFlags := Behavior flagPointers
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   648
	] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   649
	    wordsBoolean ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   650
		newFlags := Behavior flagWords
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   651
	    ] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   652
		newFlags := Behavior flagBytes
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   653
	    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   654
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   655
    ] ifFalse:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   656
	(variableBoolean == #float) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   657
	    newFlags := Behavior flagFloats
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   658
	] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   659
	    (variableBoolean == #double) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   660
		newFlags := Behavior flagDoubles
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   661
	    ] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   662
		(variableBoolean == #long) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   663
		    newFlags := Behavior flagLongs
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   664
		] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   665
		    newFlags := Behavior flagNotIndexed   
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   666
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   667
	    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   668
	].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   669
    ].
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   670
    superFlags := aClass flags bitAnd:(Behavior maskIndexType bitInvert). "preserve other bits"
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   671
    oldClass notNil ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   672
	oldClass isBuiltInClass ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   673
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   674
	     special care when redefining Method, Block and other built-in classes,
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   675
	     which might have other flag bits ...
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   676
	    "
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   677
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   678
	    newFlags := newFlags bitOr:(oldClass flags bitAnd:(Behavior maskIndexType bitInvert))
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   679
	]
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   680
    ].
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   681
    newClass flags:(newFlags bitOr:superFlags). "preserve  inherited special bits"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   682
a27a279701f8 Initial revision
claus
parents:
diff changeset
   683
    (nInstVars ~~ 0) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   684
	newClass setInstanceVariableString:stringOfInstVarNames
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   685
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   686
    oldClass notNil ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   687
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   688
	 setting first will make new class clear obsolete classvars
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   689
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   690
	newClass setClassVariableString:(oldClass classVariableString).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   691
	(t := oldClass primitiveSpec) notNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   692
	    newClass primitiveSpec:t.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   693
	    newClass setClassFilename:(oldClass classFilename).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   694
	]        
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   695
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   696
    newClass classVariableString:stringOfClassVarNames.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   697
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   698
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   699
     for new classes, we are almost done here
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   700
     (also for autoloaded classes)
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   701
    "
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   702
    (oldClass isNil or:[oldClass isLoaded not]) ifTrue:[
904
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   703
	(oldClass isNil and:[changed]) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   704
	    self addChangeRecordForClass:newClass.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   705
	].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   706
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   707
	commentString notNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   708
	    newClass comment:commentString
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   709
	].
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   710
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   711
	aSystemDictionary notNil ifTrue:[
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   712
	    aSystemDictionary at:classSymbol put:newClass.
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   713
	].
314
7581a5c57224 *** empty log message ***
claus
parents: 308
diff changeset
   714
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   715
	oldClass isNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   716
	    project notNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   717
		currentProject := project current.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   718
		currentProject notNil ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   719
		    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   720
		     new classes get the package assigned
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   721
		    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   722
		    newClass package:(currentProject packageName asSymbol)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   723
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   724
	    ].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   725
	].
314
7581a5c57224 *** empty log message ***
claus
parents: 308
diff changeset
   726
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   727
	aSystemDictionary notNil ifTrue:[
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   728
	    aSystemDictionary changed:#newClass with:newClass.
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   729
	].
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   730
	^ newClass
2
claus
parents: 1
diff changeset
   731
    ].
claus
parents: 1
diff changeset
   732
10
claus
parents: 5
diff changeset
   733
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   734
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   735
     here comes the hard part - we are actually changing the
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   736
     definition of an existing class ....
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   737
     Try hard to get away WITHOUT recompiling, since it makes all
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   738
     compiled code into interpreted ...
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   739
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   740
10
claus
parents: 5
diff changeset
   741
    oldInstVars := oldClass instanceVariableString asCollectionOfWords.
claus
parents: 5
diff changeset
   742
    newInstVars := newClass instanceVariableString asCollectionOfWords.
claus
parents: 5
diff changeset
   743
    oldClassVars := oldClass classVariableString asCollectionOfWords.
claus
parents: 5
diff changeset
   744
    newClassVars := newClass classVariableString asCollectionOfWords.
claus
parents: 5
diff changeset
   745
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   746
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   747
     we are on the bright side of life, if the instance layout and
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   748
     inheritance do not change.
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   749
     In this case, we can go ahead and patch the class object.
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   750
    "
2
claus
parents: 1
diff changeset
   751
    (oldClass superclass == newClass superclass) ifTrue:[
claus
parents: 1
diff changeset
   752
      (oldClass instSize == newClass instSize) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   753
	(oldClass flags == newClass flags) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   754
	  (oldClass name = newClass name) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   755
	    (oldInstVars = newInstVars) ifTrue:[
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   756
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   757
	      (newComment ~= oldClass comment) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   758
		  oldClass setComment:newComment.        "writes a change-chunk"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   759
		  oldClass changed:#comment with:oldClass comment.
904
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   760
		  changed ifTrue:[
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   761
		      self addChangeRecordForClassComment:oldClass.
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   762
		  ]
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   763
	      ]. 
10
claus
parents: 5
diff changeset
   764
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   765
	      (oldClassVars = newClassVars) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   766
		"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   767
		 really no change (just comment and/or category)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   768
		"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   769
		anyChange := false.
10
claus
parents: 5
diff changeset
   770
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   771
		oldClass setInstanceVariableString:(newClass instanceVariableString).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   772
		oldClass setClassVariableString:(newClass classVariableString).
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   773
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   774
		oldClass category ~= categoryString ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   775
		    oldClass category:categoryString. 
904
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   776
		    changed ifTrue:[
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   777
			self addChangeRecordForClass:newClass.
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   778
		    ].    
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   779
		    aSystemDictionary notNil ifTrue:[
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   780
			"notify change of category"
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   781
			aSystemDictionary changed:#organization
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   782
		    ]
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   783
		].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   784
		"notify change of class"
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   785
"/                oldClass changed.
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   786
		^ oldClass
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   787
	      ].
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 13
diff changeset
   788
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   789
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   790
	       when we arrive here, class variables have changed
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   791
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   792
	      oldClass category ~= categoryString ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   793
		  "notify change of organization"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   794
		  oldClass category:categoryString. 
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   795
		  aSystemDictionary notNil ifTrue:[
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   796
		      "notify change of organization"
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   797
		      aSystemDictionary changed:#organization
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
   798
		  ].
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   799
	      ].
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 13
diff changeset
   800
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   801
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   802
	       set class variable string; 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   803
	       this also updates the set of class variables
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   804
	       by creating new / deleting obsolete ones.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   805
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   806
	      oldClass classVariableString:stringOfClassVarNames.
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 13
diff changeset
   807
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   808
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   809
	       get the set of changed class variables
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   810
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   811
	      changeSet1 := Set new.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   812
	      oldClassVars do:[:nm |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   813
		  (newClassVars includes:nm) ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   814
		      changeSet1 add:nm
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   815
		  ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   816
	      ].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   817
	      newClassVars do:[:nm |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   818
		  (oldClassVars includes:nm) ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   819
		      changeSet1 add:nm
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   820
		  ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   821
	      ].
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 13
diff changeset
   822
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   823
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   824
	       recompile all methods accessing set of changed classvars
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   825
	       here and also in all subclasses ...
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   826
	      "
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   827
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   828
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   829
	       dont update change file for the recompilation
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   830
	      "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   831
	      Class withoutUpdatingChangesDo:[
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 13
diff changeset
   832
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   833
		  Transcript showCr:'recompiling class & inst methods accessing ' , changeSet1 printString.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   834
		  Transcript endEntry.
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 13
diff changeset
   835
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   836
		  oldClass withAllSubclasses do:[:aClass |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   837
		      aClass class recompileMethodsAccessingAny:changeSet1.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   838
		      aClass recompileMethodsAccessingAny:changeSet1.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   839
		  ].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   840
	      ].
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 13
diff changeset
   841
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   842
	      "notify change of class"
904
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   843
	      changed ifTrue:[
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   844
		  self addChangeRecordForClass:oldClass.
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   845
	      ].  
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   846
	      oldClass changed:#definition.
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 13
diff changeset
   847
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   848
	      ^ oldClass
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   849
	    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   850
	  ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   851
	]
2
claus
parents: 1
diff changeset
   852
      ]
claus
parents: 1
diff changeset
   853
    ].
claus
parents: 1
diff changeset
   854
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   855
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   856
     here we enter the darkness of mordor ...
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   857
     since instance variable layout and/or inheritance has changed.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   858
    "
2
claus
parents: 1
diff changeset
   859
    (newComment ~= oldClass comment) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   860
	newClass comment:newComment
2
claus
parents: 1
diff changeset
   861
    ].
claus
parents: 1
diff changeset
   862
claus
parents: 1
diff changeset
   863
    superClassChange := oldClass superclass ~~ newClass superclass.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   864
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   865
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   866
     dont allow built-in classes to be modified this way
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   867
    "
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   868
    (oldClass notNil and:[oldClass isBuiltInClass and:[superClassChange]]) ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   869
	self error:'the inheritance of this class is fixed - you cannot change it'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   870
	^ oldClass
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   871
    ].
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   872
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   873
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   874
     catch special case, where superclass changed its layout and thus
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   875
     forced redefinition of this class; 
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   876
     only log if this is not the case.
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   877
    "
904
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   878
    changed ifTrue:[
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   879
	(superClassChange 
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   880
	 and:[(oldClass superclass isNil or:[oldClass superclass name = newClass superclass name])
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   881
	 and:[(oldClassVars = newClassVars) 
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   882
	 and:[(oldInstVars = newInstVars)
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   883
	 and:[newComment = oldClass comment]]]]) ifFalse:[
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   884
	    self addChangeRecordForClass:newClass.
be65513cde2a dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   885
	]
2
claus
parents: 1
diff changeset
   886
    ].
claus
parents: 1
diff changeset
   887
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   888
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   889
     care for class methods ...
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   890
    "
2
claus
parents: 1
diff changeset
   891
    changeSet1 := Set new.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   892
2
claus
parents: 1
diff changeset
   893
    classVarChange := false.
claus
parents: 1
diff changeset
   894
claus
parents: 1
diff changeset
   895
    superClassChange ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   896
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   897
	 superclass changed:
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   898
	 must recompile all class methods accessing ANY classvar
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   899
	 (
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   900
	  actually, we could be less strict and handle the case where
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   901
	  both the old and the new superclass have a common ancestor,
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   902
	  and both have no new classvariables in between.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   903
	  This would speedup the case when a class is inserted into
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   904
	  the inheritance chain.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   905
	 )
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   906
	"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   907
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   908
	oldClass allClassVarNames do:[:nm | changeSet1 add:nm].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   909
	newClass allClassVarNames do:[:nm | changeSet1 add:nm].
2
claus
parents: 1
diff changeset
   910
claus
parents: 1
diff changeset
   911
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   912
	Transcript showCr:'recompiling class methods accessing any classvar'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   913
	Transcript endEntry.
2
claus
parents: 1
diff changeset
   914
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   915
	self copyInvalidatedMethodsFrom:(oldClass class) 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   916
				    for:newMetaclass 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   917
			   accessingAny:changeSet1
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   918
				orSuper:true.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   919
	newMetaclass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject).
2
claus
parents: 1
diff changeset
   920
    ] ifFalse:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   921
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   922
	 same superclass, find out which classvars have changed
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   923
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   924
	classVarChange := oldClassVars ~= newClassVars.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   925
	classVarChange ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   926
	    oldClassVars do:[:nm |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   927
		(newClassVars includes:nm) ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   928
		    changeSet1 add:nm
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   929
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   930
	    ].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   931
	    newClassVars do:[:nm |
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   932
		(oldClassVars includes:nm) ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   933
		    changeSet1 add:nm
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   934
		]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   935
	    ].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   936
	].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   937
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   938
	classVarChange ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   939
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   940
	     must recompile some class-methods
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   941
	    "
2
claus
parents: 1
diff changeset
   942
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   943
	    Transcript showCr:'recompiling class methods accessing ' , changeSet1 printString.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   944
	    Transcript endEntry.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   945
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   946
	    self copyInvalidatedMethodsFrom:(oldClass class) for:newMetaclass accessingAny:changeSet1.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   947
	    newMetaclass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   948
	] ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   949
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   950
	     class methods still work
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   951
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   952
	    self copyMethodsFrom:(oldClass class) for:newMetaclass
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   953
	].
2
claus
parents: 1
diff changeset
   954
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   955
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   956
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   957
     care for instance methods ...
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   958
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   959
2
claus
parents: 1
diff changeset
   960
    superClassChange ifTrue:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   961
	"superclass changed,
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   962
	 must recompile all methods accessing any class or instvar.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   963
	 If number of instvars (i.e. the instances instSize) is the same,
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   964
	 we can limit the set of recompiled instance methods to those methods,
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   965
	 which refer to an instvar with a different inst-index
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   966
	"
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   967
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   968
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   969
	 the changeset consists of instance variables, 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   970
	 with a different position
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   971
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   972
	changeSet2 := self differentInstanceVariableOffsetsIn:oldClass and:newClass.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   973
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   974
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   975
	 merge in the changed class variables
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   976
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   977
	changeSet1 do:[:nm | changeSet2 add:nm].
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
   978
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   979
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   980
	Transcript showCr:'recompiling instance methods accessing ' , changeSet2 printString , ' ...'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   981
	Transcript endEntry.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   982
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   983
	self copyInvalidatedMethodsFrom:oldClass 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   984
				    for:newClass 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   985
			   accessingAny:changeSet2
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   986
				orSuper:true.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   987
	newClass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject).
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   988
2
claus
parents: 1
diff changeset
   989
    ] ifFalse:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   990
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   991
	 same inheritance ...
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   992
	"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   993
	instVarChange := oldInstVars ~= newInstVars.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   994
	instVarChange ifFalse:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   995
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   996
	     same instance variables ...
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   997
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   998
	    classVarChange ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
   999
		"recompile all inst methods accessing changed classvars"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1000
2
claus
parents: 1
diff changeset
  1001
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1002
		Transcript showCr:'recompiling instance methods accessing ' , changeSet1 printString , ' ...'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1003
		Transcript endEntry.
2
claus
parents: 1
diff changeset
  1004
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1005
		self copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:changeSet1.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1006
		newClass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1007
	    ]
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1008
	] ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1009
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1010
	     dont allow built-in classes to be modified
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1011
	    "
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1012
	    (oldClass notNil and:[oldClass isBuiltInClass and:[instVarChange]]) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1013
		self error:'the layout of this class is fixed - you cannot change it'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1014
		^ oldClass
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1015
	    ].
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  1016
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1017
	    ((oldInstVars size == 0) 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1018
	    or:[newInstVars startsWith:oldInstVars]) ifTrue:[
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1019
		"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1020
		 only new inst variable(s) has/have been added - 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1021
		 old methods still work (the existing inst-indices are still valid)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1022
		"
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1023
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1024
		Transcript showCr:'copying methods ...'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1025
		Transcript endEntry.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1026
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1027
		self copyMethodsFrom:oldClass for:newClass.
2
claus
parents: 1
diff changeset
  1028
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1029
		"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1030
		 but: we have to recompile all methods accessing new instars
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1031
		 (it might have been a classVar/global before ...)
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1032
		"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1033
		addedNames := newInstVars select:[:nm | (oldInstVars includes:nm) not].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1034
		"merge in class variables"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1035
		changeSet1 do:[:nm | addedNames add:nm].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1036
2
claus
parents: 1
diff changeset
  1037
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1038
		Transcript showCr:'recompiling instance methods accessing ' , addedNames printString ,  '...'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1039
		Transcript endEntry.
2
claus
parents: 1
diff changeset
  1040
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1041
		newClass recompileMethodsAccessingAny:addedNames.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1042
	    ] ifFalse:[
2
claus
parents: 1
diff changeset
  1043
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1044
		"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1045
		 the changeset consists of instance variables, 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1046
		 with a different position
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1047
		"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1048
		changeSet2 := self differentInstanceVariableOffsetsIn:oldClass and:newClass.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1049
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1050
		"merge in the class variables"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1051
		changeSet1 do:[:nm | changeSet2 add:nm].
2
claus
parents: 1
diff changeset
  1052
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1053
		Transcript showCr:'recompiling instance methods accessing ' , changeSet2 printString , ' ...'.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1054
		Transcript endEntry.
2
claus
parents: 1
diff changeset
  1055
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1056
		self copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:changeSet2.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1057
		newClass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject).
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1058
	    ].
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1059
	].
2
claus
parents: 1
diff changeset
  1060
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1061
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1062
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1063
     WOW, everything done for this class
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1064
     what about subclasses ?
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1065
    "
2
claus
parents: 1
diff changeset
  1066
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1067
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1068
     update superclass of immediate subclasses - 
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1069
     this forces recompilation (recursively) if needed
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1070
     (dont update change file for the subclass changes)
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1071
    "
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1072
    Class withoutUpdatingChangesDo:[
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1073
	oldClass subclassesDo:[:aClass |
2
claus
parents: 1
diff changeset
  1074
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1075
	    Transcript showCr:'changing superclass of:' , aClass name.
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1076
	    Transcript endEntry.
2
claus
parents: 1
diff changeset
  1077
" "
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1078
	    aClass superclass:newClass
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1079
	]
2
claus
parents: 1
diff changeset
  1080
    ].
claus
parents: 1
diff changeset
  1081
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1082
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1083
     change category in oldClass - so we see immediately what it is ...
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1084
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1085
    oldClass category:'obsolete'.
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1086
    oldClass class category:'obsolete'.
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1087
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1088
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1089
     and make the new class globally known
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1090
    "
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
  1091
    aSystemDictionary notNil ifTrue:[
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1092
	aSystemDictionary at:classSymbol put:newClass.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1093
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1094
	oldClass category ~= categoryString ifTrue:[
870
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
  1095
	    "notify change of organization"
0d60b4b7962a handle nil environment
Claus Gittinger <cg@exept.de>
parents: 866
diff changeset
  1096
	    aSystemDictionary changed:#organization
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1097
	].
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1098
    ].
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1099
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1100
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1101
     Not becoming the old class creates some update problems;
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1102
     the browsers must check carefully - a simple identity compare is
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1103
     not enough ...
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1104
     QUESTION: is this a good idea ?
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1105
    "
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1106
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1107
    newClass dependents:(oldClass dependents).
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1108
    newClass changed:#definition.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1109
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1110
    "just to make certain ... - tell dependents of oldClass, that something changed
85
claus
parents: 77
diff changeset
  1111
     (systemBrowsers will react on this, and update their views)"
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1112
    oldClass changed:#definition with:newClass.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1113
2
claus
parents: 1
diff changeset
  1114
    ObjectMemory flushCaches.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1115
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1116
    ^ newClass
723
ebc969b4678d preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents: 682
diff changeset
  1117
885
ca805f0f4984 changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1118
    "Modified: 22.1.1996 / 13:17:13 / cg"
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1119
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1120
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1121
new
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1122
    "create & return a new metaclass (a classes class).
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1123
     Since metaclasses only have one instance (the class),
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1124
     complain if there is already one.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1125
     You get a new class by sending #new to the returned metaclass
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1126
     (confusing - isn't it ?)"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1127
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1128
    |newClass|
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1129
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1130
    myClass notNil ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1131
	^ self error:'Each metaclass may only have one instance'.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1132
    ].
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1133
    newClass := self basicNew.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1134
    newClass setSuperclass:Object
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1135
	       selectors:(Array new:0)
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1136
		 methods:(Array new:0)
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1137
		instSize:0 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1138
		   flags:(Behavior flagBehavior).
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1139
    newClass setName:'someClass'.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1140
    myClass := newClass.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1141
    ^ newClass
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1142
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1143
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1144
!Metaclass methodsFor:'private'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1145
739
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1146
setSoleInstance:aClass 
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1147
    myClass := aClass
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1148
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1149
    "Created: 12.12.1995 / 13:46:22 / cg"
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1150
!
63566c9b691a oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents: 723
diff changeset
  1151
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1152
anyInvalidatedMethodsIn:aClass
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1153
    "return true, if aClass has any invalidated methods in it"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1154
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1155
    |trap trapCode trapByteCode|
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1156
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1157
    trap := Metaclass compiledMethodAt:#invalidCodeObject.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1158
    trapCode := trap code.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1159
    trapByteCode := trap byteCode.
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1160
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1161
    aClass methodArray do:[:aMethod |
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1162
	trapCode notNil ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1163
	    (aMethod code = trapCode) ifTrue:[^ true]
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1164
	].
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1165
	trapByteCode notNil ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1166
	    (aMethod byteCode == trapByteCode) ifTrue:[^ true]
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1167
	]
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1168
    ].
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1169
    ^ false
68
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1170
!
59faa75185ba *** empty log message ***
claus
parents: 49
diff changeset
  1171
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1172
checkConventionsFor:className instVarNames:instVarNameString classVarNames:classVarNameString
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1173
    "Check for some 'considered bad-style' things, like lower case names.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1174
     NOTICE:
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1175
     I dont like the confirmers below - we need a notifying: argument, to give
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1176
     the outer codeview a chance to highlight the error.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1177
     (but thats how its defined in the book - maybe I will change it anyway).
308
f04744ef7b5d *** empty log message ***
claus
parents: 251
diff changeset
  1178
    "
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1179
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1180
    "let user confirm, if the classname is no good"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1181
    className first isUppercase ifFalse:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1182
	(self confirm:'classename ''' , className , ''' should start with an uppercase letter
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1183
(by convention only)
308
f04744ef7b5d *** empty log message ***
claus
parents: 251
diff changeset
  1184
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1185
install anyway ?' withCRs)
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1186
	    ifFalse:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1187
		^ false
308
f04744ef7b5d *** empty log message ***
claus
parents: 251
diff changeset
  1188
	    ]
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1189
    ].
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1190
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1191
    "let user confirm, if any instvarname is no good"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1192
    (instVarNameString asCollectionOfWords 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1193
    findFirst:[:word | word first isUppercase]) ~~ 0 ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1194
	(self confirm:'instance variable names should start with a lowercase letter
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1195
(by convention only)
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1196
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1197
install anyway ?' withCRs)
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1198
	ifFalse:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1199
	    ^ false
308
f04744ef7b5d *** empty log message ***
claus
parents: 251
diff changeset
  1200
	]
f04744ef7b5d *** empty log message ***
claus
parents: 251
diff changeset
  1201
    ].
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1202
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1203
    "let user confirm, if any classvarname is no good"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1204
    (classVarNameString asCollectionOfWords 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1205
    findFirst:[:word | word first isLowercase]) ~~ 0 ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1206
	(self confirm:'class variable names should start with an uppercase letter
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1207
(by convention only)
308
f04744ef7b5d *** empty log message ***
claus
parents: 251
diff changeset
  1208
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1209
install anyway ?' withCRs)
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1210
	ifFalse:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1211
	    ^ false
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1212
	].
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1213
    ].
308
f04744ef7b5d *** empty log message ***
claus
parents: 251
diff changeset
  1214
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1215
    ^ true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1216
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1217
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1218
copyInvalidatedMethodsFrom:oldClass for:newClass
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1219
    "copy all methods from oldClass to newClass and change their code
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1220
     to a trap method reporting an error.
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1221
     This is done when a class has changed its layout or inheritance,
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1222
     before recompilation is attempted.
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1223
     This allows us to keep the source while trapping uncompilable (due to
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1224
     now undefined instvars) methods. Later compilation of these methods will show
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1225
     an error on the transcript and lead to the debugger once called."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1226
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1227
    |trap trapCode trapByteCode oldMethod newMethod oldMethodArray 
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1228
     newSelectorArray newMethodArray
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1229
     nMethods "{ Class: SmallInteger }"|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1230
328
claus
parents: 326
diff changeset
  1231
    trap := Metaclass compiledMethodAt:#invalidCodeObject.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1232
    trapCode := trap code.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1233
    trapByteCode := trap byteCode.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1234
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1235
    newMethodArray := oldClass methodArray copy.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1236
    newSelectorArray := oldClass selectorArray copy.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1237
    newClass selectors:newSelectorArray methods:newMethodArray.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1238
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1239
    nMethods := newMethodArray size.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1240
    1 to:nMethods do:[:i |
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1241
	oldMethod := newMethodArray at:i.
251
claus
parents: 226
diff changeset
  1242
	oldMethod isWrapped ifTrue:[
claus
parents: 226
diff changeset
  1243
	    oldMethod := oldMethod originalMethod
claus
parents: 226
diff changeset
  1244
	].
claus
parents: 226
diff changeset
  1245
	newMethod := oldMethod copy.
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1246
	newMethod code:trapCode.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1247
	newMethod literals:nil.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1248
	newMethod byteCode:trapByteCode.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1249
	newMethodArray at:i put:newMethod
2
claus
parents: 1
diff changeset
  1250
    ]
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1251
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1252
    "Modified: 27.1.1996 / 17:57:48 / cg"
2
claus
parents: 1
diff changeset
  1253
!
claus
parents: 1
diff changeset
  1254
claus
parents: 1
diff changeset
  1255
copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:setOfNames
claus
parents: 1
diff changeset
  1256
    "copy all methods from oldClass to newClass. Those methods accessing
claus
parents: 1
diff changeset
  1257
     a variable in setOfNames will be copied as invalid method, leading to
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1258
     a trap when its executed. This is used when a class has changed its
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1259
     layout for all methods which are affected by the change."
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1260
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1261
    self copyInvalidatedMethodsFrom:oldClass 
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1262
				for:newClass 
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1263
		       accessingAny:setOfNames 
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1264
			    orSuper:false 
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1265
!
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1266
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1267
copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:setOfNames orSuper:superBoolean
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1268
    "copy all methods from oldClass to newClass. 
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1269
     Those methods accessing a variable in setOfNames will be copied as invalid method, 
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1270
     leading to a trap when its executed. If superBoolean is true, this is also done
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1271
     for methods accessing super.  This is used when a class has changed its
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1272
     layout for all methods which are affected by the change."
2
claus
parents: 1
diff changeset
  1273
251
claus
parents: 226
diff changeset
  1274
    |trap trapCode trapByteCode p source mustInvalidate
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1275
     oldMethod newMethod oldMethodArray newSelectorArray newMethodArray
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1276
     nMethods "{ Class: SmallInteger }"
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1277
     nNames usedVars|
2
claus
parents: 1
diff changeset
  1278
328
claus
parents: 326
diff changeset
  1279
    trap := Metaclass compiledMethodAt:#invalidCodeObject.
2
claus
parents: 1
diff changeset
  1280
    trapCode := trap code.
claus
parents: 1
diff changeset
  1281
    trapByteCode := trap byteCode.
claus
parents: 1
diff changeset
  1282
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1283
    newMethodArray := oldClass methodArray copy.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1284
    newSelectorArray := oldClass selectorArray copy.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1285
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1286
    newClass selectors:newSelectorArray methods:newMethodArray.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1287
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1288
    nNames := setOfNames size.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1289
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1290
    nMethods := newMethodArray size.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1291
    1 to:nMethods do:[:i |
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1292
	oldMethod := newMethodArray at:i.
251
claus
parents: 226
diff changeset
  1293
	oldMethod isWrapped ifTrue:[
claus
parents: 226
diff changeset
  1294
	    oldMethod := oldMethod originalMethod
claus
parents: 226
diff changeset
  1295
	].
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1296
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1297
	"before parsing (which may take some time),
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1298
	 do a string search if its only one variable,
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1299
	 we are looking for.
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1300
	 Could look for more than one variable by string compare, but then
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1301
	 parsing it right away may be faster ..."
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1302
251
claus
parents: 226
diff changeset
  1303
	source := oldMethod source.
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1304
	((nNames == 1) and:[superBoolean not]) ifTrue:[
251
claus
parents: 226
diff changeset
  1305
	    mustInvalidate := (source findString:(setOfNames first)) ~~ 0.
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1306
	] ifFalse:[
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1307
	    ((nNames == 0) and:[superBoolean]) ifTrue:[
251
claus
parents: 226
diff changeset
  1308
		mustInvalidate := (source findString:'super') ~~ 0.
claus
parents: 226
diff changeset
  1309
	    ] ifFalse:[
claus
parents: 226
diff changeset
  1310
		mustInvalidate := true
claus
parents: 226
diff changeset
  1311
	    ].
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1312
	].
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1313
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1314
	mustInvalidate ifTrue:[
251
claus
parents: 226
diff changeset
  1315
	    "we have to parse it ..."
claus
parents: 226
diff changeset
  1316
	    p := Parser parseMethod:source in:newClass.
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1317
	    (p isNil 
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1318
	     or:[((usedVars := p usedVars) notNil and:[usedVars includesAny:setOfNames])
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1319
	     or:[superBoolean and:[p usesSuper]]]) ifFalse:[
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1320
		mustInvalidate := false
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1321
	    ]
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1322
	].
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1323
40ca7cc6fb9c *** empty log message ***
claus
parents: 195
diff changeset
  1324
	mustInvalidate ifTrue:[
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1325
	    newMethod := oldMethod copy.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1326
	    newMethod code:trapCode.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1327
	    newMethod literals:nil.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1328
	    newMethod byteCode:trapByteCode
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1329
	] ifFalse:[
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1330
	    newMethod := oldMethod.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1331
	].
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1332
	newMethodArray at:i put:newMethod
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1333
    ]
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1334
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1335
    "Modified: 27.1.1996 / 17:56:44 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1336
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1337
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1338
copyMethodsFrom:oldClass for:newClass
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1339
    "copy all methods from oldClass to newClass.
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1340
     This is used for class-methods when a class has changed, but its metaclass is 
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1341
     unaffected (i.e. classVars/inheritance have not changed) so there is no need
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1342
     to recompile the class methods."
195
515af3696a5c *** empty log message ***
claus
parents: 175
diff changeset
  1343
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1344
    newClass selectors:(oldClass selectorArray copy) 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1345
	       methods:(oldClass methodArray copy)
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1346
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1347
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1348
differentInstanceVariableOffsetsIn:class1 and:class2
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1349
    "return a set of instance variable names which have different
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1350
     positions in class1 and class2.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1351
     Also, variables which are only present in one class are returned.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1352
     This is used to find methods which need recompilation after a
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1353
     change in the instance variable layout."
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1354
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1355
    |offsets1 offsets2 changeSet|
195
515af3696a5c *** empty log message ***
claus
parents: 175
diff changeset
  1356
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1357
    changeSet := Set new.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1358
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1359
    "
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1360
     collect the instvar-indices in the old and new class
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1361
    "
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1362
    offsets1 := class1 instanceVariableOffsets.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1363
    offsets2 := class2 instanceVariableOffsets.
195
515af3696a5c *** empty log message ***
claus
parents: 175
diff changeset
  1364
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1365
    "
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1366
     compute the changeset as a set of instance variables, 
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1367
     which have a different position
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1368
    "
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1369
    offsets1 keysAndValuesDo:[:varName :varIndex |
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1370
	(offsets2 includesKey:varName) ifFalse:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1371
	    changeSet add:varName 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1372
	] ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1373
	    (varIndex ~~ (offsets2 at:varName)) ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1374
		changeSet add:varName 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1375
	    ]
195
515af3696a5c *** empty log message ***
claus
parents: 175
diff changeset
  1376
	]
515af3696a5c *** empty log message ***
claus
parents: 175
diff changeset
  1377
    ].
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1378
    offsets2 keysAndValuesDo:[:varName :varIndex |
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1379
	(offsets1 includesKey:varName) ifFalse:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1380
	    changeSet add:varName
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1381
	] ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1382
	    (varIndex ~~ (offsets1 at:varName)) ifTrue:[
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1383
		changeSet add:varName
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1384
	    ]
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1385
	]
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1386
    ].
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1387
    ^ changeSet
195
515af3696a5c *** empty log message ***
claus
parents: 175
diff changeset
  1388
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1389
    "
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1390
     View class 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1391
	differentInstanceVariableOffsetsIn:View
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1392
				       and:StandardSystemView
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1393
     View class 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1394
	differentInstanceVariableOffsetsIn:Object 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1395
				       and:Point 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1396
    "
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1397
!
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1398
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1399
invalidCodeObject
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1400
    "When recompiling classes after a definition-change, all
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1401
     uncompilable methods will be bound to this method here,
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1402
     so that evaluating such an uncompilable method will trigger an error.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1403
     Can also happen when Compiler/runtime system is broken."
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1404
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1405
    self error:'invalid method - this method failed to compile when the class was changed'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1406
! !
457
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1407
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1408
!Metaclass methodsFor:'queries'!
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1409
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1410
isMeta
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1411
    "return true, if the receiver is some kind of metaclass;
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1412
     true is returned here. Redefines isMeta in Object"
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1413
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1414
    ^ true
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1415
!
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1416
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1417
soleInstance 
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1418
    "return my sole class."
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1419
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1420
    ^ myClass
41c73cbee305 change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents: 423
diff changeset
  1421
! !
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1422
639
9ff94fa31be6 version at the end
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
  1423
!Metaclass class methodsFor:'documentation'!
9ff94fa31be6 version at the end
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
  1424
9ff94fa31be6 version at the end
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
  1425
version
912
a009f25a6800 be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
  1426
    ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.46 1996-01-27 17:12:38 cg Exp $'
639
9ff94fa31be6 version at the end
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
  1427
! !