98
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
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 |
"
|
1208
|
12 |
"{ Package: 'stx:libcomp' }"
|
|
13 |
|
1106
|
14 |
ParseNode subclass:#MethodNode
|
2691
|
15 |
instanceVariableNames:'selector arguments locals statements encoder'
|
1208
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'System-Compiler ST-80-compatibility'
|
98
|
19 |
!
|
|
20 |
|
1106
|
21 |
!MethodNode class methodsFor:'documentation'!
|
98
|
22 |
|
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
|
37 |
documentation
|
|
38 |
"
|
|
39 |
This is a pure mimicri class.
|
|
40 |
It is not used by ST/X, but provided to support limited
|
|
41 |
compatibility for applications which build up codetrees,
|
|
42 |
knowing internals of ST-80's compiler class hierarchy.
|
|
43 |
This classes protocol is not (not meant to be) fully covering
|
|
44 |
the corresponding ST-80's classes protocol. It maps ST-80 messages
|
|
45 |
to corresponding ST/X messages (as far as possible).
|
|
46 |
|
|
47 |
NO WARRANTY and GUARANTEE; this class may be removed without notice.
|
|
48 |
"
|
|
49 |
! !
|
|
50 |
|
1106
|
51 |
!MethodNode methodsFor:'accessing'!
|
|
52 |
|
1788
|
53 |
arguments
|
|
54 |
^ arguments
|
|
55 |
!
|
|
56 |
|
|
57 |
arguments:something
|
|
58 |
arguments := something.
|
|
59 |
!
|
|
60 |
|
|
61 |
arguments:argVars locals:localVars statements:stats
|
|
62 |
arguments := argVars.
|
|
63 |
locals := localVars.
|
|
64 |
statements := stats.
|
|
65 |
|
|
66 |
"Created: / 06-08-2006 / 03:04:18 / cg"
|
|
67 |
!
|
|
68 |
|
2691
|
69 |
encoder
|
|
70 |
^ encoder
|
|
71 |
!
|
|
72 |
|
|
73 |
encoder:something
|
|
74 |
encoder := something.
|
|
75 |
!
|
|
76 |
|
1788
|
77 |
locals
|
|
78 |
^ locals
|
|
79 |
!
|
|
80 |
|
1208
|
81 |
selector
|
|
82 |
^ selector
|
|
83 |
!
|
|
84 |
|
1788
|
85 |
selector:sel
|
|
86 |
selector := sel.
|
|
87 |
|
|
88 |
"Created: / 06-08-2006 / 01:17:42 / cg"
|
|
89 |
!
|
|
90 |
|
1106
|
91 |
selector:sel arguments:argVars locals:localVars statements:stats
|
|
92 |
selector := sel.
|
|
93 |
arguments := argVars.
|
|
94 |
locals := localVars.
|
|
95 |
statements := stats.
|
|
96 |
!
|
98
|
97 |
|
1208
|
98 |
statementCollection
|
|
99 |
"returns an orderedColl for my linked statement list"
|
|
100 |
|
|
101 |
|coll stat|
|
|
102 |
|
|
103 |
coll := OrderedCollection new.
|
|
104 |
stat := statements.
|
|
105 |
[stat notNil] whileTrue:[
|
|
106 |
coll add:stat.
|
|
107 |
stat := stat nextStatement.
|
|
108 |
].
|
|
109 |
^ coll
|
|
110 |
!
|
|
111 |
|
|
112 |
statements
|
|
113 |
^ statements
|
1788
|
114 |
!
|
|
115 |
|
|
116 |
statements:something
|
|
117 |
statements := something.
|
98
|
118 |
! !
|
|
119 |
|
1106
|
120 |
!MethodNode methodsFor:'code generation'!
|
98
|
121 |
|
1788
|
122 |
codeForSideEffectOn:aStream inBlock:b for:aCompiler
|
|
123 |
statements do:[:stat |
|
|
124 |
stat isSequenceable ifTrue:[
|
|
125 |
stat do:[:eachSubStat |
|
|
126 |
eachSubStat codeForSideEffectOn:aStream inBlock:nil for:aCompiler
|
|
127 |
]
|
|
128 |
] ifFalse:[
|
|
129 |
stat codeForSideEffectOn:aStream inBlock:nil for:aCompiler
|
|
130 |
].
|
|
131 |
].
|
|
132 |
|
|
133 |
"Created: / 06-08-2006 / 03:29:54 / cg"
|
|
134 |
"Modified: / 06-08-2006 / 23:19:01 / cg"
|
|
135 |
!
|
|
136 |
|
106
|
137 |
emitEffect:aStream
|
98
|
138 |
statements do:[:stat |
|
106
|
139 |
stat codeForSideEffectOn:aStream inBlock:nil for:nil
|
98
|
140 |
].
|
|
141 |
! !
|
|
142 |
|
1106
|
143 |
!MethodNode methodsFor:'printing'!
|
98
|
144 |
|
|
145 |
printOn:aStream indent:i
|
|
146 |
|n parts|
|
|
147 |
|
1788
|
148 |
selector isNil ifTrue:[
|
|
149 |
self basicPrintOn:aStream.
|
|
150 |
^ self.
|
|
151 |
].
|
|
152 |
|
98
|
153 |
n := selector numArgs.
|
|
154 |
n == 0 ifTrue:[
|
1788
|
155 |
aStream nextPutAll:selector printString.
|
98
|
156 |
] ifFalse:[
|
1788
|
157 |
parts := selector partsIfSelector.
|
|
158 |
parts with:arguments do:[:part :arg |
|
3046
|
159 |
aStream nextPutAll:part; space.
|
1788
|
160 |
aStream nextPutAll:arg name.
|
|
161 |
aStream space.
|
|
162 |
]
|
98
|
163 |
].
|
|
164 |
aStream cr.
|
|
165 |
|
1788
|
166 |
statements notNil ifTrue:[
|
|
167 |
statements do:[:stat |
|
|
168 |
aStream spaces:i+4.
|
|
169 |
stat printOn:aStream indent:i+4.
|
|
170 |
aStream nextPut:$..
|
|
171 |
aStream cr.
|
|
172 |
].
|
1106
|
173 |
].
|
1788
|
174 |
|
|
175 |
"Modified: / 06-08-2006 / 15:12:15 / cg"
|
98
|
176 |
! !
|
1208
|
177 |
|
3415
|
178 |
!MethodNode methodsFor:'testing'!
|
|
179 |
|
|
180 |
isMethodNode
|
|
181 |
^ true
|
|
182 |
! !
|
|
183 |
|
1208
|
184 |
!MethodNode class methodsFor:'documentation'!
|
|
185 |
|
|
186 |
version
|
3415
|
187 |
^ '$Header: /cvs/stx/stx/libcomp/MethodNode.st,v 1.14 2014-03-24 12:12:59 stefan Exp $'
|
1208
|
188 |
! !
|
3046
|
189 |
|