made a copy
[strongtalk-kjk.git] / StrongtalkSource / DeltaBlockApplication.dlt
blobc693620944f9ddb4f4a5a82ec7eb0c94f2c76f29
1 Delta define: #DeltaBlockApplication as: (\r
2 (Class subclassOf: 'DeltaGenericApplicationExpression' instanceVariables: '')) !\r
3 \r
4 (Delta mirrorFor: #DeltaBlockApplication) revision: '$Revision: 1.1 $'!\r
5 \r
6 (Delta mirrorFor: #DeltaBlockApplication) group: 'ast'!\r
7 \r
8 (Delta mirrorFor: #DeltaBlockApplication)\r
9 comment: \r
10 '(c) 1995-1997 Sun Microsystems, Inc. ALL RIGHTS RESERVED. \r
11 Use and distribution of this software is subject to the terms of the attached source license.'!\r
13 ! (Delta mirrorFor: #DeltaBlockApplication) classSide methodsFor: 'Unclassified' !\r
16 blokName: n <Int > ^ <Symbol>\r
17     ^(n printString, '_argFun') asSymbol.!\r
19 blokType: n <Int > ^ <DeltaGeneric>\r
20     ^Delta at: (self blokName: n)\r
21            ifAbsent:[self createBlokType: n].!\r
23 createBlokType: n <Int > ^ <DeltaGeneric[Protocol]>\r
24     |\r
25 body <Protocol> \r
26 formals <VarOrdCltn[TypeFormal]> \r
27 f <TypeFormal> \r
28 tv <TypeVar> \r
29 bound <TypeId> \r
30 newGen <Generic[Protocol]>\r
31 |\r
33 formals := OrderedCollection[TypeFormal]  new.\r
34 1 to: n do:[:i <Int>  |\r
35                  bound := DeltaTypeId new setId: #Object; scope: DeltaGlobals.\r
36                  tv := DeltaTypeVar new name: ('A', n printString) asSymbol bound: bound.\r
37                  f := DeltaTypeFormal new variance: #contravariant typeVar: tv.\r
38                  formals addLast: f\r
39                  ].\r
40 bound := DeltaTypeId new setId: #Object; scope: DeltaGlobals.\r
41 tv := DeltaTypeVar new name: #R bound: bound.\r
42  f := DeltaTypeFormal new variance: #covariant typeVar: tv.\r
43 formals addLast: f.\r
45 body := DeltaProtocolUpdate new.\r
46 newGen := DeltaGeneric[Protocol]  new body: body formals: formals.\r
48 Type addMagicType: newGen.\r
49 ^Delta at: (self blokName: n) put: newGen\r
50 ! !\r
52 ! (Delta mirrorFor: #DeltaBlockApplication) methodsFor: 'Unclassified' !\r
55 target ^ <DeltaVar>\r
56     ^self class blokType: self actuals size.! !\r