author | Claus Gittinger <cg@exept.de> |
Wed, 25 Jun 1997 15:20:43 +0200 | |
changeset 557 | 8202a13be88b |
parent 555 | 987b766b8b6e |
child 559 | 42cf4afd99b3 |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
45 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
12 |
||
13 |
ParseNode subclass:#BlockNode |
|
168 | 14 |
instanceVariableNames:'blockArgs statements home inlineBlock exitBlock blockVars |
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
15 |
needsHome lineNr endLineNr blockArgAccessedInBlock numTemp |
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
16 |
maxNumTemp' |
168 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'System-Compiler-Support' |
|
0 | 20 |
! |
21 |
||
366 | 22 |
!BlockNode class methodsFor:'documentation'! |
20 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
45 | 27 |
All Rights Reserved |
0 | 28 |
|
20 | 29 |
This software is furnished under a license and may be used |
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
0 | 37 |
|
20 | 38 |
documentation |
39 |
" |
|
40 |
node for parse-trees, representing blocks |
|
261 | 41 |
This is a helper class for the compiler. |
263 | 42 |
|
43 |
[author:] |
|
44 |
Claus Gittinger |
|
20 | 45 |
" |
46 |
! ! |
|
0 | 47 |
|
366 | 48 |
!BlockNode class methodsFor:'instance creation'! |
0 | 49 |
|
3 | 50 |
arguments:argList home:h variables:vars |
51 |
^ (self basicNew) setArguments:argList home:h variables:vars |
|
0 | 52 |
! ! |
53 |
||
54 |
!BlockNode methodsFor:'accessing'! |
|
55 |
||
56 |
arguments |
|
57 |
^ blockArgs |
|
58 |
! |
|
59 |
||
26 | 60 |
arguments:argList |
61 |
blockArgs := argList |
|
62 |
! |
|
63 |
||
534 | 64 |
blockArgAccessed |
65 |
"return true if any block argument is accessed in the block" |
|
66 |
||
67 |
^ blockArgAccessedInBlock ? false |
|
68 |
||
69 |
"Modified: 18.6.1997 / 12:06:31 / cg" |
|
70 |
! |
|
71 |
||
72 |
blockArgAccessed:aBoolen |
|
73 |
"set/clear the flag stating if any block argument is accessed in the block" |
|
74 |
||
75 |
blockArgAccessedInBlock := aBoolen |
|
76 |
||
77 |
"Created: 18.6.1997 / 11:35:00 / cg" |
|
78 |
"Modified: 18.6.1997 / 12:06:43 / cg" |
|
79 |
! |
|
80 |
||
394 | 81 |
endLineNumber |
82 |
^ endLineNr |
|
83 |
||
84 |
"Created: 23.10.1996 / 15:51:32 / cg" |
|
85 |
! |
|
86 |
||
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
87 |
endLineNumber:aNumber |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
88 |
endLineNr := aNumber |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
89 |
|
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
90 |
"Created: 21.10.1996 / 14:17:57 / cg" |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
91 |
! |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
92 |
|
140 | 93 |
home |
94 |
^ home |
|
0 | 95 |
! |
96 |
||
97 |
home:aBlock |
|
98 |
home := aBlock |
|
99 |
! |
|
100 |
||
555 | 101 |
inlineBlock:aBoolean |
102 |
inlineBlock := aBoolean |
|
0 | 103 |
! |
104 |
||
555 | 105 |
isInlineBlock |
106 |
^ inlineBlock |
|
107 |
||
108 |
"Created: 25.6.1997 / 14:11:33 / cg" |
|
0 | 109 |
! |
110 |
||
394 | 111 |
lineNumber |
112 |
^ lineNr |
|
113 |
||
114 |
"Created: 23.10.1996 / 15:51:50 / cg" |
|
115 |
! |
|
116 |
||
140 | 117 |
lineNumber:aNumber |
118 |
lineNr := aNumber |
|
119 |
! |
|
120 |
||
0 | 121 |
needsHome |
122 |
^ needsHome |
|
123 |
! |
|
124 |
||
125 |
needsHome:aBoolean |
|
126 |
needsHome := aBoolean |
|
6 | 127 |
! |
128 |
||
140 | 129 |
statements |
130 |
^ statements |
|
131 |
! |
|
132 |
||
133 |
statements:s |
|
134 |
statements := s |
|
135 |
! |
|
136 |
||
137 |
variables |
|
138 |
^ blockVars |
|
139 |
! |
|
140 |
||
141 |
variables:varList |
|
142 |
blockVars := varList |
|
143 |
! ! |
|
144 |
||
145 |
!BlockNode methodsFor:'block messages'! |
|
146 |
||
147 |
doesNotUnderstand:aMessage |
|
148 |
|numArgs kludgeBlock| |
|
149 |
||
150 |
(Block implements:(aMessage selector)) ifTrue:[ |
|
212
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
151 |
|
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
152 |
"/ mhmh - a message which I dont understand, but Block implements |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
153 |
"/ send it to a kludgeblock, which will evaluate me again ..." |
ff39051e219f
more constant folding options
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
154 |
|
140 | 155 |
numArgs := blockArgs size. |
156 |
numArgs == 0 ifTrue:[ |
|
157 |
kludgeBlock := [self value] |
|
158 |
] ifFalse:[ |
|
159 |
numArgs == 1 ifTrue:[ |
|
160 |
kludgeBlock := [:a1 | self value:a1]. |
|
161 |
] ifFalse:[ |
|
162 |
numArgs == 2 ifTrue:[ |
|
163 |
kludgeBlock := [:a1 :a2 | self value:a1 value:a2]. |
|
164 |
] ifFalse:[ |
|
165 |
numArgs == 3 ifTrue:[ |
|
166 |
kludgeBlock := [:a1 :a2 :a3| self value:a1 value:a2 value:a3]. |
|
167 |
] ifFalse:[ |
|
168 |
numArgs == 4 ifTrue:[ |
|
169 |
kludgeBlock := [:a1 :a2 :a3 :a4| self value:a1 value:a2 value:a3 value:a4]. |
|
170 |
] ifFalse:[ |
|
171 |
^ self error:'only support blocks with up-to 4 args' |
|
172 |
] |
|
173 |
] |
|
174 |
] |
|
175 |
] |
|
176 |
]. |
|
177 |
^ kludgeBlock perform:aMessage selector withArguments:aMessage arguments |
|
178 |
]. |
|
179 |
^ super doesNotUnderstand:aMessage |
|
0 | 180 |
! ! |
181 |
||
140 | 182 |
!BlockNode methodsFor:'code generation'! |
183 |
||
184 |
checkForSimpleBlock |
|
185 |
"simple things can be made cheap blocks right now - |
|
186 |
resulting in a simple pushLit instruction ..." |
|
187 |
||
506
3dc049d3a2d7
care for stackSize when creating blocks.
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
188 |
|cheapy e val code stackSize| |
140 | 189 |
|
190 |
statements isNil ifTrue:[ |
|
366 | 191 |
"a []-block" |
140 | 192 |
|
366 | 193 |
val := nil |
140 | 194 |
] ifFalse:[ |
366 | 195 |
statements nextStatement notNil ifTrue:[^ nil]. |
196 |
(statements isMemberOf:StatementNode) ifFalse:[^ nil]. |
|
140 | 197 |
|
366 | 198 |
e := statements expression. |
199 |
e isConstant ifFalse:[^ nil]. |
|
140 | 200 |
|
366 | 201 |
val := e value. |
140 | 202 |
]. |
203 |
||
506
3dc049d3a2d7
care for stackSize when creating blocks.
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
204 |
stackSize := 0. |
3dc049d3a2d7
care for stackSize when creating blocks.
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
205 |
|
140 | 206 |
val == 0 ifTrue:[ |
366 | 207 |
"a [0]-block" |
140 | 208 |
|
366 | 209 |
code := ByteArray with:(ByteCodeCompiler byteCodeFor:#ret0). |
140 | 210 |
]. |
211 |
val == 1 ifTrue:[ |
|
366 | 212 |
"a [1]-block" |
140 | 213 |
|
506
3dc049d3a2d7
care for stackSize when creating blocks.
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
214 |
stackSize := 1. |
366 | 215 |
code := ByteArray with:(ByteCodeCompiler byteCodeFor:#push1) |
216 |
with:(ByteCodeCompiler byteCodeFor:#retTop). |
|
140 | 217 |
]. |
218 |
||
219 |
val == true ifTrue:[ |
|
366 | 220 |
"a [true]-block" |
140 | 221 |
|
366 | 222 |
code := ByteArray with:(ByteCodeCompiler byteCodeFor:#retTrue). |
140 | 223 |
]. |
224 |
||
225 |
val == false ifTrue:[ |
|
366 | 226 |
"a [false]-block" |
140 | 227 |
|
366 | 228 |
code := ByteArray with:(ByteCodeCompiler byteCodeFor:#retFalse). |
140 | 229 |
]. |
230 |
||
231 |
val == nil ifTrue:[ |
|
366 | 232 |
"a [nil]-block" |
140 | 233 |
|
366 | 234 |
code := ByteArray with:(ByteCodeCompiler byteCodeFor:#retNil). |
140 | 235 |
]. |
236 |
||
237 |
code notNil ifTrue:[ |
|
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
238 |
cheapy := CheapBlock |
366 | 239 |
byteCode:code |
240 |
numArgs:(blockArgs size) |
|
506
3dc049d3a2d7
care for stackSize when creating blocks.
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
241 |
numStack:stackSize |
366 | 242 |
sourcePosition:nil |
243 |
initialPC:nil |
|
244 |
literals:nil. |
|
245 |
^ ConstantNode type:#Block value:cheapy |
|
140 | 246 |
]. |
247 |
||
248 |
^ nil |
|
366 | 249 |
|
506
3dc049d3a2d7
care for stackSize when creating blocks.
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
250 |
"Modified: 13.4.1997 / 00:05:29 / cg" |
140 | 251 |
! |
252 |
||
253 |
codeForSideEffectOn:aStream inBlock:b for:aCompiler |
|
254 |
"generate code for this statement - value not needed. |
|
255 |
For blocks, no code is generated at all." |
|
256 |
||
257 |
^ self |
|
258 |
! |
|
259 |
||
260 |
codeInlineOn:aStream inBlock:b for:aCompiler |
|
261 |
self codeInlineOn:aStream inBlock:b valueNeeded:true for:aCompiler |
|
262 |
! |
|
263 |
||
264 |
codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler |
|
265 |
|thisStatement nextStatement| |
|
266 |
||
267 |
blockVars notNil ifTrue:[ |
|
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
268 |
"cannot currently compile this block inline (have to move blockvars into |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
269 |
surrounding method. generate a make-block and send it value" |
0 | 270 |
|
553 | 271 |
self numArgs ~~ 0 ifTrue:[ |
272 |
self halt:'unexpected: inlineBlock with args'. |
|
273 |
]. |
|
274 |
||
278 | 275 |
"/ Transcript showCR:'cannot (yet) compile block with blockvars inline'. |
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
276 |
self codeOn:aStream inBlock:b for:aCompiler. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
277 |
aStream nextPut:#value. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
278 |
(aCompiler hasLineNumber:#value) ifTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
279 |
aStream nextPut:lineNr. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
280 |
]. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
281 |
valueNeeded ifFalse:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
282 |
aStream nextPut:#drop |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
283 |
]. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
284 |
^ self |
140 | 285 |
]. |
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
286 |
|
140 | 287 |
inlineBlock := true. |
555 | 288 |
|
140 | 289 |
statements isNil ifTrue:[ |
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
290 |
valueNeeded ifTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
291 |
aStream nextPut:#pushNil |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
292 |
] |
140 | 293 |
] ifFalse:[ |
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
294 |
thisStatement := statements. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
295 |
[thisStatement notNil] whileTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
296 |
nextStatement := thisStatement nextStatement. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
297 |
(nextStatement notNil or:[valueNeeded not]) ifTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
298 |
thisStatement codeForSideEffectOn:aStream inBlock:b for:aCompiler |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
299 |
] ifFalse:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
300 |
thisStatement codeOn:aStream inBlock:b for:aCompiler |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
301 |
]. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
302 |
thisStatement := nextStatement |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
303 |
] |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
304 |
]. |
386 | 305 |
"/ endLineNr notNil ifTrue:[ |
306 |
"/ ParseNode codeLineNumber:endLineNr on:aStream for:aCompiler |
|
307 |
"/ ]. |
|
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
308 |
|
555 | 309 |
"Modified: 25.6.1997 / 14:05:16 / cg" |
140 | 310 |
! |
311 |
||
312 |
codeOn:aStream inBlock:b for:aCompiler |
|
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
313 |
|thisStatement nextStatement lastStatement pos code cheapy p0| |
140 | 314 |
|
315 |
cheapy := self checkForSimpleBlock. |
|
316 |
cheapy notNil ifTrue:[ |
|
333
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
317 |
cheapy codeOn:aStream inBlock:b for:aCompiler. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
318 |
^ self |
140 | 319 |
]. |
320 |
||
321 |
pos := aStream position. |
|
62 | 322 |
|
555 | 323 |
aStream nextPut:#makeBlock. "+0" |
324 |
aStream nextPut:0. "+1" |
|
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
325 |
aStream nextPut:(blockVars size + maxNumTemp). "+2" |
555 | 326 |
aStream nextPut:(blockArgs size). "+3" |
327 |
"+4" |
|
394 | 328 |
p0 := pos+4. |
329 |
||
140 | 330 |
statements isNil ifTrue:[ |
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
331 |
endLineNr notNil ifTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
332 |
ParseNode codeLineNumber:endLineNr on:aStream for:aCompiler |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
333 |
]. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
334 |
aStream nextPut:#pushNil. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
335 |
aStream nextPut:#retTop. |
140 | 336 |
] ifFalse:[ |
333
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
337 |
thisStatement := statements. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
338 |
[thisStatement notNil] whileTrue:[ |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
339 |
nextStatement := thisStatement nextStatement. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
340 |
nextStatement notNil ifTrue:[ |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
341 |
thisStatement codeForSideEffectOn:aStream inBlock:self for:aCompiler |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
342 |
] ifFalse:[ |
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
343 |
lastStatement := thisStatement |
333
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
344 |
]. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
345 |
thisStatement := nextStatement |
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
346 |
]. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
347 |
|
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
348 |
lastStatement isPrimary ifTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
349 |
ReturnNode |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
350 |
codeSimpleReturnFor:lastStatement expression |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
351 |
inBlock:nil |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
352 |
on:aStream |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
353 |
inLine:endLineNr |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
354 |
for:aCompiler |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
355 |
]. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
356 |
lastStatement codeOn:aStream inBlock:self for:aCompiler. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
357 |
endLineNr notNil ifTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
358 |
ParseNode codeLineNumber:endLineNr on:aStream for:aCompiler |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
359 |
]. |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
360 |
aStream nextPut:#retTop. |
140 | 361 |
]. |
362 |
||
363 |
"check for [0]-block; |
|
364 |
these are sometimes used as in ... ifAbsent:[0] |
|
365 |
" |
|
366 |
code := (aStream contents). |
|
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
367 |
(code at:p0) == #lineno ifTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
368 |
p0 := p0 + 2 |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
369 |
] ifFalse:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
370 |
(code at:p0) == #lineno16 ifTrue:[ |
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
371 |
p0 := p0 + 3 |
333
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
372 |
] |
140 | 373 |
]. |
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
374 |
|
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
375 |
(code at:p0) == #ret0 ifTrue:[ |
333
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
376 |
aStream position:pos. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
377 |
code grow:pos. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
378 |
aStream nextPut:#mk0Block. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
379 |
^ self |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
380 |
]. |
140 | 381 |
|
382 |
"check for [nil]-block; |
|
383 |
these come to play when code in blocks is commented |
|
384 |
out, or as dummy exception blocks |
|
385 |
" |
|
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
386 |
(code at:p0) == #retNil ifTrue:[ |
333
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
387 |
aStream position:pos. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
388 |
code grow:pos. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
389 |
aStream nextPut:#mkNilBlock. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
390 |
^ self |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
391 |
]. |
140 | 392 |
|
379
24399d5c465c
optionally mark the blocks-end with a lineNr.
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
393 |
code at:pos+1 put:(aStream position) |
333
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
394 |
|
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
395 |
"Modified: 25.6.1997 / 15:07:30 / cg" |
555 | 396 |
! ! |
397 |
||
398 |
!BlockNode methodsFor:'code generation helpers'! |
|
399 |
||
400 |
addTempVar |
|
401 |
"add a temporary variable; return its position (1-based). |
|
402 |
Used when a block with args/locals is inlined." |
|
403 |
||
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
404 |
numTemp isNil ifTrue:[numTemp := maxNumTemp := 0]. |
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
405 |
numTemp := numTemp + 1. |
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
406 |
maxNumTemp := maxNumTemp max:numTemp. |
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
407 |
^ numTemp |
555 | 408 |
|
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
409 |
"Modified: 25.6.1997 / 15:06:56 / cg" |
555 | 410 |
! |
411 |
||
412 |
removeTempVar |
|
413 |
"remove a temporary variable" |
|
414 |
||
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
415 |
numTemp := numTemp - 1. |
555 | 416 |
|
417 |
"Created: 25.6.1997 / 14:04:20 / cg" |
|
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
418 |
"Modified: 25.6.1997 / 15:07:07 / cg" |
0 | 419 |
! ! |
420 |
||
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
421 |
!BlockNode methodsFor:'enumeration'! |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
422 |
|
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
423 |
nodeDo:anEnumerator |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
424 |
"helper for parse tree walking" |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
425 |
|
544
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
426 |
|args| |
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
427 |
|
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
428 |
args := blockArgs ? #(). |
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
429 |
args := args collect:[:var | |
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
430 |
|p| |
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
431 |
|
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
432 |
p := ParameterNode new. |
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
433 |
p variable:var |
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
434 |
]. |
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
435 |
^ anEnumerator doBlock:self arguments:args body:statements |
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
436 |
|
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
437 |
"Created: 19.6.1997 / 16:38:30 / cg" |
544
fcfff6f8bc31
more ST80 compatible enumeration
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
438 |
"Modified: 19.6.1997 / 17:17:57 / cg" |
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
439 |
! ! |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
534
diff
changeset
|
440 |
|
0 | 441 |
!BlockNode methodsFor:'evaluating'! |
442 |
||
140 | 443 |
evaluate |
444 |
^ self |
|
445 |
! |
|
446 |
||
0 | 447 |
exitWith:something |
448 |
"return via return-statement" |
|
449 |
||
450 |
home notNil ifTrue:[ |
|
45 | 451 |
home exitWith:something |
0 | 452 |
]. |
453 |
exitBlock value:something. |
|
454 |
^ something |
|
455 |
! |
|
456 |
||
457 |
value |
|
458 |
(blockArgs size ~~ 0) ifTrue:[ |
|
45 | 459 |
^ self wrongNumberOfArguments:0 |
0 | 460 |
]. |
461 |
statements isNil ifTrue:[^ nil]. |
|
462 |
exitBlock := [:val | ^ val]. |
|
463 |
^ statements evaluate |
|
464 |
! |
|
465 |
||
466 |
value:anArg |
|
467 |
|oldValue val| |
|
468 |
||
469 |
(blockArgs size ~~ 1) ifTrue:[ |
|
45 | 470 |
^ self wrongNumberOfArguments:1 |
0 | 471 |
]. |
472 |
statements isNil ifTrue:[^ nil]. |
|
473 |
||
474 |
oldValue := (blockArgs at:1) value. |
|
475 |
(blockArgs at:1) value:anArg. |
|
476 |
||
15 | 477 |
exitBlock := [:v | |
45 | 478 |
(blockArgs at:1) value:oldValue. |
479 |
^ v |
|
0 | 480 |
]. |
481 |
||
482 |
val := statements evaluate. |
|
483 |
||
484 |
(blockArgs at:1) value:oldValue. |
|
485 |
^ val |
|
486 |
! |
|
487 |
||
488 |
value:arg1 value:arg2 |
|
489 |
|oldValue1 oldValue2 val| |
|
490 |
||
491 |
(blockArgs size ~~ 2) ifTrue:[ |
|
45 | 492 |
^ self wrongNumberOfArguments:2 |
0 | 493 |
]. |
494 |
statements isNil ifTrue:[^ nil]. |
|
495 |
||
496 |
oldValue1 := (blockArgs at:1) value. |
|
497 |
oldValue2 := (blockArgs at:2) value. |
|
498 |
(blockArgs at:1) value:arg1. |
|
499 |
(blockArgs at:2) value:arg2. |
|
500 |
||
15 | 501 |
exitBlock := [:v | |
45 | 502 |
(blockArgs at:1) value:oldValue1. |
503 |
(blockArgs at:2) value:oldValue2. |
|
504 |
^ v |
|
0 | 505 |
]. |
506 |
||
507 |
val := statements evaluate. |
|
508 |
||
509 |
(blockArgs at:1) value:oldValue1. |
|
510 |
(blockArgs at:2) value:oldValue2. |
|
511 |
^ val |
|
512 |
! |
|
513 |
||
514 |
value:arg1 value:arg2 value:arg3 |
|
515 |
|oldValue1 oldValue2 oldValue3 val| |
|
516 |
||
517 |
(blockArgs size ~~ 3) ifTrue:[ |
|
45 | 518 |
^ self wrongNumberOfArguments:3 |
0 | 519 |
]. |
520 |
statements isNil ifTrue:[^ nil]. |
|
521 |
||
522 |
oldValue1 := (blockArgs at:1) value. |
|
523 |
oldValue2 := (blockArgs at:2) value. |
|
524 |
oldValue3 := (blockArgs at:3) value. |
|
525 |
(blockArgs at:1) value:arg1. |
|
526 |
(blockArgs at:2) value:arg2. |
|
527 |
(blockArgs at:3) value:arg3. |
|
528 |
||
15 | 529 |
exitBlock := [:v | |
45 | 530 |
(blockArgs at:1) value:oldValue1. |
531 |
(blockArgs at:2) value:oldValue2. |
|
532 |
(blockArgs at:3) value:oldValue3. |
|
533 |
^ v |
|
0 | 534 |
]. |
535 |
||
536 |
val := statements evaluate. |
|
537 |
||
538 |
(blockArgs at:1) value:oldValue1. |
|
539 |
(blockArgs at:2) value:oldValue2. |
|
540 |
(blockArgs at:3) value:oldValue3. |
|
541 |
^ val |
|
542 |
! |
|
543 |
||
544 |
value:arg1 value:arg2 value:arg3 value:arg4 |
|
545 |
|oldValue1 oldValue2 oldValue3 oldValue4 val| |
|
546 |
||
547 |
(blockArgs size ~~ 4) ifTrue:[ |
|
45 | 548 |
^ self wrongNumberOfArguments:4 |
0 | 549 |
]. |
550 |
statements isNil ifTrue:[^ nil]. |
|
551 |
||
552 |
oldValue1 := (blockArgs at:1) value. |
|
553 |
oldValue2 := (blockArgs at:2) value. |
|
554 |
oldValue3 := (blockArgs at:3) value. |
|
555 |
oldValue4 := (blockArgs at:4) value. |
|
556 |
(blockArgs at:1) value:arg1. |
|
557 |
(blockArgs at:2) value:arg2. |
|
558 |
(blockArgs at:3) value:arg3. |
|
559 |
(blockArgs at:4) value:arg4. |
|
560 |
||
15 | 561 |
exitBlock := [:v | |
45 | 562 |
(blockArgs at:1) value:oldValue1. |
563 |
(blockArgs at:2) value:oldValue2. |
|
564 |
(blockArgs at:3) value:oldValue3. |
|
565 |
(blockArgs at:4) value:oldValue4. |
|
566 |
^ v |
|
0 | 567 |
]. |
568 |
||
569 |
val := statements evaluate. |
|
570 |
||
571 |
(blockArgs at:1) value:oldValue1. |
|
572 |
(blockArgs at:2) value:oldValue2. |
|
573 |
(blockArgs at:3) value:oldValue3. |
|
574 |
(blockArgs at:4) value:oldValue4. |
|
575 |
^ val |
|
140 | 576 |
! |
3 | 577 |
|
578 |
valueWithArguments:argArray |
|
579 |
|oldValues val| |
|
580 |
||
581 |
(blockArgs size ~~ argArray size) ifTrue:[ |
|
45 | 582 |
^ self wrongNumberOfArguments:argArray size |
3 | 583 |
]. |
584 |
statements isNil ifTrue:[^ nil]. |
|
585 |
||
586 |
oldValues := Array new:(argArray size). |
|
587 |
1 to:argArray size do:[:i | |
|
45 | 588 |
oldValues at:i put:(blockArgs at:i) value. |
589 |
(blockArgs at:i) value:(argArray at:i). |
|
3 | 590 |
]. |
15 | 591 |
exitBlock := [:v | |
45 | 592 |
1 to:argArray size do:[:i | |
593 |
( blockArgs at:i) value:(oldValues at:i) |
|
594 |
]. |
|
595 |
^ v |
|
3 | 596 |
]. |
597 |
||
598 |
val := statements evaluate. |
|
599 |
||
600 |
1 to:argArray size do:[:i | |
|
45 | 601 |
(blockArgs at:i) value:(oldValues at:i) |
3 | 602 |
]. |
603 |
^ val |
|
140 | 604 |
! |
605 |
||
606 |
wrongNumberOfArguments:numberGiven |
|
607 |
Block argumentSignal |
|
608 |
raiseRequestWith:self |
|
609 |
errorString:('block got ' , numberGiven printString , |
|
610 |
' args while ' , blockArgs size printString , ' where expected') |
|
0 | 611 |
! ! |
612 |
||
613 |
!BlockNode methodsFor:'looping'! |
|
614 |
||
615 |
whileFalse:aBlock |
|
26 | 616 |
self value ifTrue:[^ nil]. |
617 |
aBlock value. |
|
618 |
thisContext restart |
|
0 | 619 |
! |
620 |
||
140 | 621 |
whileTrue:aBlock |
622 |
self value ifFalse:[^ nil]. |
|
623 |
aBlock value. |
|
624 |
thisContext restart |
|
0 | 625 |
! ! |
626 |
||
627 |
!BlockNode methodsFor:'printing'! |
|
628 |
||
629 |
printOn:aStream indent:i |
|
98 | 630 |
|n "{Class: SmallInteger }"| |
631 |
||
0 | 632 |
aStream nextPut:$[. |
98 | 633 |
(n := blockArgs size) > 0 ifTrue:[ |
634 |
1 to:n do:[:index | |
|
96 | 635 |
aStream nextPut:$:. |
636 |
aStream nextPutAll:(blockArgs at:index) name. |
|
637 |
aStream space. |
|
638 |
]. |
|
98 | 639 |
aStream nextPut:$|. |
640 |
aStream space. |
|
641 |
]. |
|
642 |
(n := blockVars size) > 0 ifTrue:[ |
|
643 |
aStream nextPut:$|. |
|
644 |
1 to:n do:[:index | |
|
645 |
aStream nextPutAll:(blockVars at:index) name. |
|
646 |
aStream space. |
|
647 |
]. |
|
648 |
aStream nextPut:$|. |
|
0 | 649 |
]. |
650 |
statements notNil ifTrue:[ |
|
45 | 651 |
aStream cr. |
652 |
statements printAllOn:aStream indent:i + 4. |
|
653 |
aStream cr. |
|
654 |
aStream spaces:i. |
|
0 | 655 |
]. |
656 |
aStream nextPut:$] |
|
657 |
! ! |
|
140 | 658 |
|
659 |
!BlockNode methodsFor:'private accessing'! |
|
660 |
||
661 |
setArguments:argList home:h variables:vars |
|
662 |
inlineBlock := false. |
|
663 |
needsHome := false. |
|
664 |
blockArgs := argList. |
|
665 |
home := h. |
|
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
666 |
blockVars := vars. |
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
667 |
numTemp := maxNumTemp := 0. |
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
668 |
|
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
669 |
"Modified: 25.6.1997 / 15:07:52 / cg" |
140 | 670 |
! ! |
671 |
||
672 |
!BlockNode methodsFor:'queries'! |
|
673 |
||
394 | 674 |
collectBlocksInto:aCollection |
675 |
aCollection add:self. |
|
458 | 676 |
statements notNil ifTrue:[statements collectBlocksInto:aCollection] |
394 | 677 |
|
678 |
"Created: 23.10.1996 / 15:45:16 / cg" |
|
679 |
"Modified: 23.10.1996 / 16:02:57 / cg" |
|
680 |
! |
|
681 |
||
333
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
682 |
endsWithReturn |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
683 |
statements isNil ifTrue:[ |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
684 |
^ false |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
685 |
]. |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
686 |
^ statements listEndsWithReturn |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
687 |
|
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
688 |
"Created: 19.8.1996 / 14:36:32 / cg" |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
689 |
! |
96bb5c3dab61
added query if blocks statementList ends in a return;
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
690 |
|
140 | 691 |
isBlock |
692 |
"a kludge, to have blocknodes mimic blocks" |
|
693 |
||
694 |
^ true |
|
168 | 695 |
! |
696 |
||
394 | 697 |
numArgs |
522 | 698 |
"return the number of arguments the block represented by myself |
699 |
expects for evaluation" |
|
700 |
||
394 | 701 |
^ blockArgs size |
702 |
||
703 |
"Created: 23.10.1996 / 15:57:04 / cg" |
|
522 | 704 |
"Modified: 7.5.1997 / 15:34:35 / cg" |
394 | 705 |
! |
706 |
||
707 |
numVars |
|
708 |
^ blockVars size |
|
709 |
||
710 |
"Created: 23.10.1996 / 16:17:07 / cg" |
|
711 |
! |
|
712 |
||
169 | 713 |
simpleSendBlockExpression |
714 |
blockVars notNil ifTrue:[^ nil]. |
|
715 |
statements isNil ifTrue:[^ nil]. |
|
716 |
statements nextStatement notNil ifTrue:[^ nil]. |
|
717 |
^ statements expression |
|
718 |
||
719 |
"Created: 13.12.1995 / 20:06:09 / cg" |
|
140 | 720 |
! ! |
721 |
||
366 | 722 |
!BlockNode class methodsFor:'documentation'! |
148 | 723 |
|
724 |
version |
|
557
8202a13be88b
preps to move vars of inlined blocks to outer context
Claus Gittinger <cg@exept.de>
parents:
555
diff
changeset
|
725 |
^ '$Header: /cvs/stx/stx/libcomp/BlockNode.st,v 1.42 1997-06-25 13:20:43 cg Exp $' |
148 | 726 |
! ! |