1 Delta define: #DeltaSideUpdate as: (
\r
2 (Class subclassOf: 'DeltaSideUpdateBehavior' instanceVariables: 'superclassType supportedProtocol classDecl klass mirror messages methods selfTV selfPublicTV typeOfInstances relevantTVs scope invocationCache loopMarker ')) !
\r
4 (Delta mirrorFor: #DeltaSideUpdate) revision: '$Revision: 1.3 $'!
\r
6 (Delta mirrorFor: #DeltaSideUpdate) group: 'ast'!
\r
8 (Delta mirrorFor: #DeltaSideUpdate)
\r
10 'Concrete class representing a side.
\r
11 (c) 1995-1997 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
\r
12 Use and distribution of this software is subject to the terms of the attached source license.'!
\r
14 ! (Delta mirrorFor: #DeltaSideUpdate) methodsFor: 'Unclassified' !
\r
17 addRelevantTypeVar: tv <TypeVar>
\r
19 self relevantTypeVars add: tv.
\r
20 self supportedProtocol isNil
\r
21 ifFalse:[self supportedProtocol addRelevantTypeVar: tv].!
\r
23 asMixinSide ^ <MixinSide>
\r
29 ifTrue: [^self classDecl instanceSide basicLocator isMetaSide: true]
\r
30 ifFalse: [^DeltaBasicMixinLocator new id: self name; isMetaSide: false]!
\r
32 classDecl ^ <DeltaClassUpdate>
\r
35 classDecl: cd <DeltaClassUpdate > ^ <Self>
\r
40 self relevantTVs: nil.!
\r
42 hasMethodsLoaded ^ <Boolean>
\r
52 loopMarker := false.
\r
54 self invocationCache: (IdentityDictionary[ObjectType, ObjectType] new).!
\r
56 initializeWithin: lexicalScope <Scope>
\r
58 loopMarker := false.
\r
59 super initializeWith: lexicalScope.
\r
60 self invocationCache: (IdentityDictionary[ObjectType, ObjectType] new).!
\r
62 invocationCache ^ <Dict[ObjectType, ObjectType]>
\r
66 invocationCache: c <VarDict[ObjectType, ObjectType]>
\r
68 invocationCache := c!
\r
75 "Transcript show: 'SideUpdate>>klass'; cr."
\r
77 self isMetaSide ifFalse:[self scope at: #Instance put: self selfTV]
\r
79 self selfTV isMeta: true.
\r
80 self selfPublicTV isMeta: true.
\r
81 self scope at: #Instance put: self selfClassTV.
\r
82 self scope at: #PublicInstance put: self selfPublicClassTV.
\r
83 self selfTV dual: self selfClassTV.
\r
84 self selfClassTV dual: self selfTV.
\r
85 self selfPublicTV dual: self selfPublicClassTV.
\r
86 self selfPublicClassTV dual: self selfPublicTV.
\r
88 "Whatever class is linked to me, must have my type var in its scope"!
\r
90 localScope ^ <Scope>
\r
91 ^self heirScope delta!
\r
93 lookupTypeOfInstances ^ <ObjectType>
\r
95 | key <ObjectType> result <ObjectType> |
\r
100 key := self superclassType asProtocol canonicalRep.
\r
101 result := self invocationCache at: key
\r
102 ifAbsent:[self invocationCache at: key
\r
103 put: self typeOfInstances].
\r
104 loopMarker := false.
\r
107 ifTrue:[typeOfInstances := super typeOfInstances].!
\r
109 messages ^ <Dict[Symbol,Message]>
\r
111 messages isNil ifTrue:[self mirror createMethodTypeStructure].
\r
114 messages: ms<Dict[Symbol,Message]>
\r
117 methods ^ <Dict[Symbol,Method]>
\r
119 methods isNil ifTrue:[self mirror createMethodTypeStructure].
\r
122 methods: ms<Dict[Symbol,Method]>
\r
127 mirror isNil ifTrue:[mirror :=super mirror].
\r
130 relevantTVs ^ <Set[TypeVar]>
\r
134 relevantTVs: rtvs <Set[TypeVar]>
\r
136 relevantTVs := rtvs!
\r
138 relevantTypeVars ^ <Set[TypeVar]>
\r
140 self relevantTVs isNil
\r
141 ifTrue:[self relevantTVs: super relevantTypeVars].
\r
142 ^self relevantTVs.!
\r
150 selfPublicTV ^ <TypeVar>
\r
153 selfPublicTV: stv <TypeVar>
\r
154 selfPublicTV := stv.
\r
155 self localScope at: #PublicSelf put: stv.!
\r
160 selfTV: stv <TypeVar>
\r
162 self localScope at: #Self put: stv.!
\r
164 superclassType ^ <ClassNode>
\r
167 superclassType: st <ClassNode > ^ <Self>
\r
169 superclassType := st.
\r
170 self heirScope base: st heirScope.
\r
171 " (DeltaScopeReference for: st accessBlk: [:x | x heirScope])."
\r
172 "self scope at: #super put: (DeltaSuperVar new name: #super type: nil)."!
\r
174 supportedProtocol ^ <Protocol>
\r
175 ^supportedProtocol!
\r
177 supportedProtocol: p <Protocol > ^ <Self>
\r
178 supportedProtocol := p.!
\r
180 typeOfInstances ^ <ObjectType>
\r
181 "This method returns and caches the public protocol of the side. The actual
\r
182 construction of the value is handled by super's version of the
\r
185 ^typeOfInstances isNil
\r
187 typeOfInstances := self lookupTypeOfInstances.
\r
189 ifFalse:[typeOfInstances].! !
\r