author | Claus Gittinger <cg@exept.de> |
Wed, 22 Feb 2017 19:10:04 +0100 | |
changeset 4130 | daa497ff1a77 |
parent 3339 | 051a88ca25c4 |
child 4300 | cff050b708a1 |
permissions | -rw-r--r-- |
14 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
49 | 3 |
All Rights Reserved |
14 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1080 | 12 |
"{ Package: 'stx:libcomp' }" |
13 |
||
4130 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
14 | 16 |
SelfNode subclass:#SuperNode |
261 | 17 |
instanceVariableNames:'class isHere' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'System-Compiler-Support' |
|
14 | 21 |
! |
22 |
||
20 | 23 |
!SuperNode class methodsFor:'documentation'! |
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
49 | 28 |
All Rights Reserved |
20 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
node for parse-trees, representing super |
|
261 | 42 |
This is a helper class for the compiler. |
263 | 43 |
|
44 |
[author:] |
|
45 |
Claus Gittinger |
|
20 | 46 |
" |
47 |
! ! |
|
14 | 48 |
|
49 |
!SuperNode class methodsFor:'instance creation'! |
|
50 |
||
51 |
value:val inClass:cls |
|
49 | 52 |
^ (self basicNew) value:val inClass:cls here:false |
53 |
! |
|
54 |
||
55 |
value:val inClass:cls here:isHere |
|
56 |
^ (self basicNew) value:val inClass:cls here:isHere |
|
14 | 57 |
! ! |
58 |
||
59 |
!SuperNode methodsFor:'accessing'! |
|
60 |
||
140 | 61 |
definingClass |
62 |
^ class |
|
63 |
! |
|
64 |
||
49 | 65 |
value:val inClass:cls here:h |
14 | 66 |
type := #Super. |
67 |
value := val. |
|
49 | 68 |
class := cls. |
69 |
isHere := h |
|
14 | 70 |
! ! |
71 |
||
1080 | 72 |
!SuperNode methodsFor:'printing & storing'! |
14 | 73 |
|
2897
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
74 |
displayOn:aGCOrStream |
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
75 |
"Compatibility |
4130 | 76 |
append a printed desription on some stream (Dolphin, Squeak) |
2897
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
77 |
OR: |
4130 | 78 |
display the receiver in a graphicsContext at 0@0 (ST80). |
2897
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
79 |
This method allows for any object to be displayed in some view |
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
80 |
(although the fallBack is to display its printString ...)" |
745 | 81 |
|
2897
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
82 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
4130 | 83 |
"/ old ST80 means: draw-yourself on a GC. |
2897
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
84 |
aGCOrStream isStream ifFalse:[ |
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
85 |
^ super displayOn:aGCOrStream. |
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
86 |
]. |
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
87 |
|
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
88 |
aGCOrStream |
b97e8a922cd2
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
2605
diff
changeset
|
89 |
nextPutAll:(isHere ifTrue:['InterpreterVariable(here)'] ifFalse:['InterpreterVariable(super)']). |
4130 | 90 |
|
91 |
"Modified (comment): / 22-02-2017 / 16:52:49 / cg" |
|
745 | 92 |
! |
93 |
||
14 | 94 |
printOn:aStream indent:i |
49 | 95 |
isHere ifTrue:[ |
96 |
aStream nextPutAll:'here' |
|
97 |
] ifFalse:[ |
|
98 |
aStream nextPutAll:'super' |
|
99 |
] |
|
14 | 100 |
! ! |
140 | 101 |
|
2326 | 102 |
!SuperNode methodsFor:'testing'! |
140 | 103 |
|
104 |
isHere |
|
105 |
^ isHere |
|
106 |
! |
|
107 |
||
108 |
isSuper |
|
109 |
"return true, if this is a super-node" |
|
110 |
||
111 |
^ true |
|
3339 | 112 |
! |
113 |
||
114 |
name |
|
115 |
^ self isHere ifTrue:['here'] ifFalse:['super']. |
|
140 | 116 |
! ! |
117 |
||
2605 | 118 |
!SuperNode methodsFor:'visiting'! |
119 |
||
120 |
acceptVisitor:aVisitor |
|
121 |
"Double dispatch back to the visitor, passing my type encoded in |
|
122 |
the selector (visitor pattern)" |
|
123 |
||
124 |
"stub code automatically generated - please change if required" |
|
125 |
||
126 |
^ aVisitor visitSuperNode:self |
|
127 |
! ! |
|
128 |
||
148 | 129 |
!SuperNode class methodsFor:'documentation'! |
130 |
||
131 |
version |
|
4130 | 132 |
^ '$Header$' |
2326 | 133 |
! |
134 |
||
135 |
version_CVS |
|
4130 | 136 |
^ '$Header$' |
148 | 137 |
! ! |
3339 | 138 |