made a copy
[strongtalk-kjk.git] / StrongtalkSource / DeltaMixinDerivationNode.dlt
blob6f3976ffa89e3949af2322a4966b165209dba92e
1 Delta define: #DeltaMixinDerivationNode as: (\r
2 (Class subclassOf: 'DeltaMixinNode' instanceVariables: '')) !\r
3 \r
4 (Delta mirrorFor: #DeltaMixinDerivationNode) revision: '$Revision: 1.3 $'!\r
5 \r
6 (Delta mirrorFor: #DeltaMixinDerivationNode) group: 'ast'!\r
7 \r
8 (Delta mirrorFor: #DeltaMixinDerivationNode)\r
9 comment: \r
10 'This node represents the AST for a mixin derivation.\r
12  (c) 1995-1997 Sun Microsystems, Inc. ALL RIGHTS RESERVED. \r
13 Use and distribution of this software is subject to the terms of the attached source license.'!\r
15 ! (Delta mirrorFor: #DeltaMixinDerivationNode) methodsFor: 'Unclassified' !\r
18 abstract ^ <Boolean>\r
19     ^self klass abstract!\r
21 apply: tool <DeltaASTTool>\r
23 tool mixinDerivationNode: self!\r
25 asMixinSide ^ <Side>\r
26     ^self klass asMixinSide!\r
28 asProtocol ^ <Protocol>\r
30 ^self klass asProtocol!\r
32 asSide ^ <Side>\r
33     ^self asMixinSide asSide!\r
35 basicLocator\r
36         ^self klass basicLocator!\r
38 branded ^ <Boolean>\r
39     ^self klass branded!\r
41 class: c selector: s\r
43 self filter:(BasicMixinDerivationData new class: c selector: s)\r
44          using: DeltaSubstitution new initialize.!\r
46 compositeSubstitute: t <Interface> ^ <Interface>\r
48 ^(self filteree compositeSubstitute: t) substitute: self substitution\r
50  !\r
52 dualClassType ^ <ClassType>\r
53     ^self class new class: self klass dualClassType selector: self selector!\r
55 extensionsAreSubtypes ^ <Boolean>\r
56     ^self klass extensionsAreSubtypes!\r
58 firstClassRepType  ^ <ObjectType>\r
60    ^self asMixinSide firstClassRepType!\r
62 heirScope ^ <Scope>\r
63     ^self asMixinSide  heirScope !\r
65 isMonotonic ^ <Boolean>\r
66     ^self klass isMonotonic!\r
68 klass\r
70 ^self filteree klass substitute: self substitution!\r
72 komment\r
74 "This node represents the AST for a mixin derivation.\r
75 "!\r
77 localScope ^ <Scope>\r
78     ^self asMixinSide  localScope !\r
80 messages ^ <Dict[Symbol,Message]>\r
82    ^self asMixinSide messages!\r
84 methods ^ <Dict[Symbol,Method]>\r
85    ^self asMixinSide methods!\r
87 mixinObj ^ <Mixin>\r
89 "Return the mixin I denote"\r
91 self deltaHack.\r
93 ^self selector = #delta\r
94     ifTrue:[(Mirror on: self klass classObj) mixin reflectee]\r
95     ifFalse:[(Mirror on: self klass classObj) mixin reflectee].!\r
97 mixinSubstitute: t <Interface> ^ <Interface>\r
99 ^self filteree mixinSubstitute: t!\r
101 monotonic ^ <Boolean>\r
102     ^self klass monotonic!\r
104 name\r
106 ^(self klass name, ' ', self selector) asSymbol!\r
108 protocolForInvocation: i <MixinInvocationNode> ^ <Protocol>\r
110 | key <Protocol> |\r
112 key :=  i superclassType asProtocol canonicalRep.\r
114 "If i represents an invocation that is equivalent to klass, we just\r
115 return the protocol for klass. This can be determined by checking\r
116 if i's superclass is the same as klass'."\r
117 key == self klass asProtocol canonicalRep superprotocol  asProtocol canonicalRep\r
118   ifTrue:[^self klass asProtocol canonicalRep].\r
120 "Otherwise, have klass look up the protocol"\r
121 ^self klass protocolForInvocation: i!\r
123 selector  ^ <Symbol>\r
125 ^self filteree selector!\r
127 subtype ^ <Boolean>\r
128     ^self klass subtype!\r
130 superclassType ^ <ClassType>\r
131     ^self asMixinSide superclassType!\r
133 supportedProtocol ^ <Protocol>\r
134     ^self asMixinSide supportedProtocol!\r
136 untypedName\r
138 ^self klass untypedName!\r
140 varDecls ^ <Dict[Symbol,VarDecl]>\r
141      ^self asMixinSide varDecls!\r
143 wellFormed ^ <Boolean>\r
145 | wf <Boolean> |\r
147 "should test  if klass is a class"\r
149 wf := self klass wellFormed.\r
151 ^wf.! !\r