1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
1
|
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 |
"
|
|
12 |
|
|
13 |
Object variableSubclass:#Context
|
|
14 |
instanceVariableNames:'flags sender home receiver selector searchClass
|
92
|
15 |
lineNr retvalTemp handle*'
|
105
|
16 |
classVariableNames:'InvalidReturnSignal'
|
1
|
17 |
poolDictionaries:''
|
|
18 |
category:'Kernel-Methods'
|
|
19 |
!
|
|
20 |
|
|
21 |
Context comment:'
|
5
|
22 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
1
|
23 |
All Rights Reserved
|
92
|
24 |
|
105
|
25 |
$Header: /cvs/stx/stx/libbasic/Context.st,v 1.17 1994-08-11 21:35:18 claus Exp $
|
54
|
26 |
'!
|
|
27 |
|
|
28 |
!Context class methodsFor:'documentation'!
|
|
29 |
|
88
|
30 |
copyright
|
|
31 |
"
|
|
32 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
|
33 |
All Rights Reserved
|
|
34 |
|
|
35 |
This software is furnished under a license and may be used
|
|
36 |
only in accordance with the terms of that license and with the
|
|
37 |
inclusion of the above copyright notice. This software may not
|
|
38 |
be provided or otherwise made available to, or used by, any
|
|
39 |
other person. No title to or ownership of the software is
|
|
40 |
hereby transferred.
|
|
41 |
"
|
|
42 |
!
|
|
43 |
|
|
44 |
version
|
|
45 |
"
|
105
|
46 |
$Header: /cvs/stx/stx/libbasic/Context.st,v 1.17 1994-08-11 21:35:18 claus Exp $
|
88
|
47 |
"
|
|
48 |
!
|
|
49 |
|
54
|
50 |
documentation
|
|
51 |
"
|
69
|
52 |
Context represents the stack context objects; each message send adds a context
|
|
53 |
to a chain, which can be traced back via the sender field.
|
|
54 |
(The actual implementation uses the machines stack for this, building real contexts
|
|
55 |
when needed only).
|
54
|
56 |
|
69
|
57 |
For both method- and block-contexts, the layout is the same.
|
|
58 |
For method contexts, the home-field is nil, while for blockcontexts the home-field is either
|
|
59 |
the context of its surrounding block (i.e. the context of the block, in which the receiving
|
|
60 |
block was created, if its a nested block) or of its method.
|
54
|
61 |
|
69
|
62 |
Contexts of cheap blocks do not have a home context - their home field is also nil.
|
1
|
63 |
|
69
|
64 |
instance variables:
|
|
65 |
flags <SmallInteger> - used by the VM; never touch.
|
|
66 |
contains info about number of args, locals and
|
|
67 |
temporaries.
|
|
68 |
sender <Context> - the 'calling' context
|
|
69 |
home <Context> - the context, where this block was created, or nil
|
|
70 |
receiver <Object> - the receiver of this message
|
|
71 |
selector <Symbol> - the selector of this message
|
|
72 |
searchClass <Class> - the class, where the message lookup started
|
|
73 |
(for super sends) or nil, for regular sends.
|
|
74 |
lineNr <SmallInteger> - the position where the context left off
|
|
75 |
(kind of p-counter)
|
|
76 |
retValTemp nil - temporary - always nil, when you see the context
|
|
77 |
handle *noObject* - used by the VM; not accessable, not an object
|
1
|
78 |
|
69
|
79 |
<indexed> - arguments of the send followed by
|
|
80 |
locals of the method/block followed by
|
|
81 |
temporaries
|
54
|
82 |
|
69
|
83 |
WARNING: layout and size known by the compiler and runtime system - do not change.
|
54
|
84 |
"
|
|
85 |
! !
|
1
|
86 |
|
105
|
87 |
!Context class methodsFor:'initialization'!
|
|
88 |
|
|
89 |
initialize
|
|
90 |
InvalidReturnSignal isNil ifTrue:[
|
|
91 |
InvalidReturnSignal := (Signal new) mayProceed:true.
|
|
92 |
InvalidReturnSignal notifierString:'invalid return; method cannot return twice'.
|
|
93 |
]
|
|
94 |
! !
|
|
95 |
|
|
96 |
!Context class methodsFor:'signal access'!
|
|
97 |
|
|
98 |
invalidReturnSignal
|
|
99 |
^ InvalidReturnSignal
|
|
100 |
! !
|
|
101 |
|
3
|
102 |
!Context class methodsFor:'queries'!
|
|
103 |
|
|
104 |
isBuiltInClass
|
54
|
105 |
"this class & subclasses are known by the run-time-system"
|
3
|
106 |
|
|
107 |
^ true
|
|
108 |
! !
|
|
109 |
|
1
|
110 |
!Context methodsFor:'testing'!
|
|
111 |
|
|
112 |
isContext
|
|
113 |
"return true, iff the receiver is a Context, false otherwise"
|
|
114 |
|
|
115 |
^ true
|
|
116 |
!
|
|
117 |
|
|
118 |
isBlockContext
|
|
119 |
"return true, iff the receiver is a BlockContext, false otherwise"
|
|
120 |
|
|
121 |
^ false
|
54
|
122 |
!
|
25
|
123 |
|
|
124 |
isRecursive
|
|
125 |
"return true, if this context is one of a recursive send of the same
|
54
|
126 |
selector to the same receiver before.
|
|
127 |
Used to detect recursive errors - for example."
|
25
|
128 |
|
92
|
129 |
|c rec cls1 cls2|
|
25
|
130 |
|
69
|
131 |
rec := 0.
|
25
|
132 |
c := self sender.
|
|
133 |
[c notNil] whileTrue:[
|
69
|
134 |
|
|
135 |
((c selector == selector)
|
92
|
136 |
and:[(c receiver == receiver)]) ifTrue:[
|
|
137 |
"
|
|
138 |
stupid: the current ST/X context does not include
|
|
139 |
the method, but the class, in which the search started ...
|
|
140 |
"
|
|
141 |
(c searchClass whichClassImplements:selector) == (self searchClass whichClassImplements:selector) ifTrue:[
|
|
142 |
^ true
|
|
143 |
]
|
25
|
144 |
].
|
69
|
145 |
c := c sender.
|
|
146 |
"
|
|
147 |
this special test was added to get out after a while
|
|
148 |
if the sender chain is corrupt - this gives us at least
|
|
149 |
a chance to find those errors.
|
|
150 |
"
|
|
151 |
rec := rec + 1.
|
|
152 |
rec >= 100000 ifTrue:[
|
|
153 |
'bad context chain' errorPrintNewline.
|
|
154 |
^ true
|
|
155 |
]
|
25
|
156 |
].
|
|
157 |
^ false
|
|
158 |
! !
|
|
159 |
|
1
|
160 |
!Context methodsFor:'accessing'!
|
|
161 |
|
|
162 |
instVarAt:index
|
69
|
163 |
"have to catch instVar access to retVal and handle - they are invalid.
|
|
164 |
Notice, that one of the next ST/X versions will get some syntactic
|
|
165 |
extension to get this automatically)."
|
1
|
166 |
|
|
167 |
(index == 8) ifTrue:[^ nil].
|
|
168 |
(index == 9) ifTrue:[^ nil].
|
|
169 |
^ super instVarAt:index
|
|
170 |
!
|
|
171 |
|
|
172 |
instVarAt:index put:value
|
69
|
173 |
"have to catch instVar access to retVal and handle - they are invalid.
|
|
174 |
Notice, that one of the next ST/X versions will get some syntactic
|
|
175 |
extension to get this automatically)."
|
1
|
176 |
|
|
177 |
(index == 8) ifTrue:[^ nil].
|
|
178 |
(index == 9) ifTrue:[^ nil].
|
|
179 |
^ super instVarAt:index put:value
|
|
180 |
!
|
|
181 |
|
|
182 |
methodHome
|
|
183 |
"return the method-home - for method contexts this is the receiver"
|
|
184 |
|
|
185 |
^ self
|
|
186 |
!
|
|
187 |
|
|
188 |
home
|
|
189 |
"return the immediate home of the receiver.
|
|
190 |
for block contexts, this is the methodcontext, where the block was created,
|
|
191 |
for nested block contexts, its the surrounding blocks context.
|
|
192 |
for method-contexts this is nil."
|
|
193 |
|
|
194 |
^ nil "home"
|
|
195 |
!
|
|
196 |
|
|
197 |
method
|
54
|
198 |
"return the method for which the receiver was created.
|
|
199 |
To save time during normal execution, this information is not held in the
|
|
200 |
context, but computed here on request."
|
1
|
201 |
|
|
202 |
|c|
|
|
203 |
|
|
204 |
c := self searchClass whichClassImplements:selector.
|
|
205 |
c notNil ifTrue:[
|
|
206 |
^ c compiledMethodAt:selector
|
|
207 |
].
|
|
208 |
^ nil
|
|
209 |
!
|
|
210 |
|
|
211 |
sender
|
|
212 |
"return the sender of the context"
|
|
213 |
|
69
|
214 |
"this special test is for the very first context (startup-context);
|
|
215 |
actually, its cosmetics, to avoid a visible nil>>nil context in the debugger."
|
1
|
216 |
|
69
|
217 |
"
|
|
218 |
(sender isNil or:[sender selector isNil and:[sender sender isNil]]) ifTrue:[^ nil].
|
|
219 |
"
|
1
|
220 |
^ sender
|
|
221 |
!
|
|
222 |
|
|
223 |
receiver
|
|
224 |
"return the receiver of the context"
|
|
225 |
|
|
226 |
^ receiver
|
|
227 |
!
|
|
228 |
|
|
229 |
searchClass
|
69
|
230 |
"this is the class where the method-lookup started;
|
|
231 |
for normal sends, it is nil (or sometimes the receivers class).
|
|
232 |
For supersends, its the superclass of the one, in which the
|
|
233 |
caller was defined."
|
1
|
234 |
|
|
235 |
searchClass notNil ifTrue:[^ searchClass].
|
|
236 |
^ receiver class
|
|
237 |
!
|
|
238 |
|
|
239 |
selector
|
54
|
240 |
"return the selector of the method for which the context was created"
|
1
|
241 |
|
|
242 |
^ selector
|
|
243 |
!
|
|
244 |
|
|
245 |
nargs
|
|
246 |
"return the number of arguments to the Block/Method"
|
|
247 |
|
|
248 |
%{ /* NOCONTEXT */
|
|
249 |
|
|
250 |
RETURN ( _MKSMALLINT( (_intVal(_INST(flags)) >> __NARG_SHIFT) & __NARG_MASK) );
|
|
251 |
%}
|
|
252 |
!
|
|
253 |
|
|
254 |
nvars
|
54
|
255 |
"return the number of local variables of the Block/Method"
|
1
|
256 |
|
|
257 |
%{ /* NOCONTEXT */
|
|
258 |
|
|
259 |
RETURN ( _MKSMALLINT( (_intVal(_INST(flags)) >> __NVAR_SHIFT) & __NVAR_MASK) );
|
|
260 |
%}
|
|
261 |
!
|
|
262 |
|
54
|
263 |
ntemp
|
|
264 |
"return the number of temporary variables of the Block/Method.
|
|
265 |
(for debugging only)"
|
|
266 |
|
|
267 |
^ self size - self nargs - self nvars
|
|
268 |
!
|
|
269 |
|
1
|
270 |
args
|
|
271 |
"return an array filled with the arguments of this context"
|
|
272 |
|
|
273 |
|newArray n "{ Class: SmallInteger }" |
|
|
274 |
|
|
275 |
n := self nargs.
|
|
276 |
newArray := Array new:n.
|
|
277 |
1 to:n do:[:index |
|
|
278 |
newArray at:index put:(self at:index)
|
|
279 |
].
|
|
280 |
^ newArray
|
|
281 |
!
|
|
282 |
|
|
283 |
argsAndVars
|
|
284 |
"return an array filled with the arguments and variables of this context"
|
|
285 |
|
|
286 |
|newArray mySize "{ Class: SmallInteger }" |
|
|
287 |
|
|
288 |
mySize := self nargs + self nvars.
|
|
289 |
newArray := Array new:mySize.
|
|
290 |
1 to:mySize do:[:index |
|
|
291 |
newArray at:index put:(self at:index)
|
|
292 |
].
|
|
293 |
^ newArray
|
|
294 |
!
|
|
295 |
|
10
|
296 |
argAt:n
|
|
297 |
"return the n'th argument"
|
|
298 |
|
|
299 |
^ self at:n
|
|
300 |
!
|
|
301 |
|
|
302 |
argAt:n put:value
|
|
303 |
"set the n'th argument - useful when the receiver should be restarted"
|
|
304 |
|
|
305 |
^ self at:n put:value
|
|
306 |
!
|
|
307 |
|
|
308 |
varAt:n
|
|
309 |
"return the n'th local variable"
|
|
310 |
|
|
311 |
^ self at:(n + self nargs)
|
|
312 |
!
|
|
313 |
|
|
314 |
varAt:n put:value
|
|
315 |
"set the n'th local variable - useful when the receiver should be restarted
|
54
|
316 |
or continued"
|
10
|
317 |
|
|
318 |
self at:(n + self nargs) put:value
|
|
319 |
!
|
|
320 |
|
1
|
321 |
lineNumber
|
|
322 |
"this returns the lineNumber within the methods source, where the context was
|
|
323 |
interrupted or called another method. (currently, sometimes this information
|
|
324 |
is not available - in this case 0 is returned)"
|
|
325 |
|
|
326 |
^ lineNr
|
|
327 |
! !
|
|
328 |
|
92
|
329 |
!Context methodsFor:'printing & storing'!
|
1
|
330 |
|
42
|
331 |
argsDisplayString
|
1
|
332 |
|fullString n "{ Class: SmallInteger }" |
|
|
333 |
|
|
334 |
fullString := ''.
|
|
335 |
n := self nargs.
|
|
336 |
1 to:n do:[:index |
|
42
|
337 |
fullString := fullString , (' ' , (self at:index) displayString)
|
1
|
338 |
].
|
|
339 |
^ fullString
|
|
340 |
!
|
|
341 |
|
|
342 |
printReceiver
|
37
|
343 |
"print the receiver of the context - used for MiniDebugger only"
|
|
344 |
|
69
|
345 |
|class implementorClass|
|
1
|
346 |
|
69
|
347 |
class := receiver class.
|
|
348 |
(class == SmallInteger) ifTrue:[
|
1
|
349 |
'(' print. receiver print. ') ' print
|
|
350 |
].
|
69
|
351 |
class name print.
|
1
|
352 |
|
|
353 |
selector notNil ifTrue:[
|
|
354 |
implementorClass := self searchClass whichClassImplements:selector.
|
|
355 |
implementorClass notNil ifTrue: [
|
|
356 |
(implementorClass ~= receiver class) ifTrue: [
|
|
357 |
'>>>' print.
|
|
358 |
implementorClass name print
|
|
359 |
]
|
|
360 |
] ifFalse:[
|
54
|
361 |
self searchClass ~~ receiver class ifTrue:[
|
|
362 |
'>>>' print. self searchClass name print
|
|
363 |
].
|
1
|
364 |
'>>>**NONE**' print
|
|
365 |
]
|
|
366 |
]
|
|
367 |
!
|
|
368 |
|
37
|
369 |
fullPrint
|
|
370 |
"print the receiver, selector and args of the context
|
|
371 |
- used for MiniDebuggers walkback print only"
|
|
372 |
|
|
373 |
self printReceiver.
|
|
374 |
' ' print.
|
|
375 |
selector print.
|
|
376 |
self size ~~ 0 ifTrue: [
|
|
377 |
' ' print.
|
42
|
378 |
self argsDisplayString print
|
37
|
379 |
].
|
|
380 |
' [' print. lineNr print. ']' printNewline
|
|
381 |
!
|
|
382 |
|
1
|
383 |
receiverPrintString
|
37
|
384 |
"return a string describing the receiver of the context"
|
|
385 |
|
1
|
386 |
|newString receiverClassName implementorClass|
|
|
387 |
|
|
388 |
receiverClassName := receiver class name.
|
|
389 |
(receiver class == SmallInteger) ifTrue:[
|
|
390 |
newString := '(' , receiver printString , ') ' , receiverClassName
|
|
391 |
] ifFalse:[
|
|
392 |
newString := receiverClassName
|
|
393 |
].
|
|
394 |
|
|
395 |
selector notNil ifTrue:[
|
|
396 |
implementorClass := self searchClass whichClassImplements:selector.
|
|
397 |
implementorClass notNil ifTrue: [
|
|
398 |
(implementorClass ~~ receiver class) ifTrue: [
|
|
399 |
newString := newString , '>>>',
|
|
400 |
implementorClass name printString
|
|
401 |
]
|
|
402 |
] ifFalse:[
|
54
|
403 |
self searchClass ~~ receiver class ifTrue:[
|
|
404 |
newString := newString , '>>>' , self searchClass name
|
|
405 |
].
|
1
|
406 |
newString := newString , '>>>**NONE**'
|
|
407 |
]
|
|
408 |
].
|
|
409 |
|
|
410 |
^ newString
|
|
411 |
!
|
|
412 |
|
|
413 |
printString
|
37
|
414 |
"return a string describing the context"
|
|
415 |
|
1
|
416 |
^ self receiverPrintString , ' ' , self selector printString
|
|
417 |
!
|
|
418 |
|
12
|
419 |
displayString
|
37
|
420 |
"return a string describing the context - for display in Inspector"
|
|
421 |
|
42
|
422 |
^ self class name , '(' , self printString , ')'
|
12
|
423 |
!
|
|
424 |
|
1
|
425 |
printOn:aStream
|
37
|
426 |
"append a printed description of the receiver onto aStream"
|
|
427 |
|
1
|
428 |
aStream nextPutAll:(self receiverPrintString).
|
|
429 |
aStream space.
|
|
430 |
self selector printOn:aStream
|
|
431 |
!
|
|
432 |
|
|
433 |
fullPrintAll
|
37
|
434 |
"print a full walkback starting at the receiver
|
|
435 |
- for MiniDebugger only"
|
|
436 |
|
1
|
437 |
|context|
|
|
438 |
context := self.
|
|
439 |
[context notNil] whileTrue: [
|
|
440 |
context fullPrint.
|
|
441 |
context := context sender
|
|
442 |
]
|
|
443 |
! !
|
|
444 |
|
77
|
445 |
!Context methodsFor:'error handling'!
|
|
446 |
|
|
447 |
invalidReturn:returnValue
|
|
448 |
"this message is sent by the VM, when a methods context
|
|
449 |
which has already returned is about to return again.
|
|
450 |
(i.e. about to execute a return from an already returned
|
105
|
451 |
method in a block).
|
|
452 |
We raise a signal here, to allow catching of that exception"
|
77
|
453 |
|
105
|
454 |
"in previous versions of ST/X and ST-80, this was no error;
|
77
|
455 |
comment out the error to get that (old) behavior
|
|
456 |
"
|
|
457 |
" "
|
105
|
458 |
InvalidReturnSignal raiseRequestWith:returnValue.
|
77
|
459 |
" "
|
|
460 |
^ returnValue
|
|
461 |
! !
|
|
462 |
|
1
|
463 |
!Context methodsFor:'non local control flow'!
|
|
464 |
|
|
465 |
restart
|
|
466 |
"restart the receiver - i.e. the method is evaluated again.
|
69
|
467 |
if the context to restart already died - do nothing.
|
|
468 |
LIMITATION: currently a context can only be restarted by
|
|
469 |
the owning process - not from outside."
|
1
|
470 |
|
|
471 |
sender isNil ifTrue:[^ nil].
|
|
472 |
%{
|
10
|
473 |
__RESUMECONTEXT(SND_COMMA self, RESTART_VALUE);
|
1
|
474 |
|
|
475 |
/* when we reach here, something went wrong */
|
|
476 |
%}
|
|
477 |
.
|
69
|
478 |
'restart: context not on calling chain' errorPrintNewline.
|
|
479 |
"
|
|
480 |
debugging ...
|
|
481 |
"
|
|
482 |
self error:'restart: context not on calling chain'.
|
1
|
483 |
^ nil
|
|
484 |
!
|
|
485 |
|
69
|
486 |
return
|
|
487 |
"return from this context with nil.
|
|
488 |
NO unwind actions are performed.
|
|
489 |
LIMITATION: currently a context can only be returned by
|
|
490 |
the owning process - not from outside."
|
1
|
491 |
|
69
|
492 |
self return:nil
|
1
|
493 |
!
|
|
494 |
|
69
|
495 |
return:value
|
|
496 |
"return from this context as if it did a '^ value'.
|
|
497 |
NO unwind actions are performed.
|
|
498 |
LIMITATION: currently a context can only be returned by
|
|
499 |
the owning process - not from outside."
|
1
|
500 |
|
|
501 |
sender isNil ifTrue:[^ nil].
|
|
502 |
%{
|
|
503 |
__RESUMECONTEXT(SND_COMMA self, value);
|
|
504 |
|
|
505 |
/* when we reach here, something went wrong */
|
|
506 |
%}
|
|
507 |
.
|
69
|
508 |
'return: context not on calling chain' errorPrintNewline.
|
|
509 |
"
|
|
510 |
debugging ...
|
|
511 |
"
|
|
512 |
self error:'restart: context not on calling chain'.
|
1
|
513 |
^ nil
|
|
514 |
!
|
|
515 |
|
69
|
516 |
resume
|
|
517 |
"resume execution in this context.
|
|
518 |
NO unwind actions are performed.
|
|
519 |
If the context has already returned, do nothing.
|
|
520 |
LIMITATION: currently a context can only be resumed by
|
|
521 |
the owning process - not from outside."
|
|
522 |
|
|
523 |
self resume:nil
|
|
524 |
!
|
|
525 |
|
|
526 |
resume:value
|
|
527 |
"resume the receiver - as if it got 'value' from whatever
|
|
528 |
it called.
|
|
529 |
If the context has already died - do nothing.
|
|
530 |
NO unwind actions are performed (see unwind: in this class).
|
|
531 |
LIMITATION: currently a context can only be resumed by
|
|
532 |
the owning process - not from outside."
|
|
533 |
|
|
534 |
|con|
|
|
535 |
|
|
536 |
"start with this context, find the one below and return from it"
|
|
537 |
con := thisContext.
|
|
538 |
[con notNil and:[con sender ~~ self]] whileTrue:[
|
|
539 |
con := con sender
|
|
540 |
].
|
|
541 |
con isNil ifTrue:[
|
|
542 |
'resume: context not on calling chain' errorPrintNewline.
|
|
543 |
"
|
|
544 |
debugging ...
|
|
545 |
"
|
|
546 |
self error:'resume: context not on calling chain'.
|
|
547 |
^ nil
|
|
548 |
].
|
|
549 |
con return:value
|
|
550 |
!
|
|
551 |
|
1
|
552 |
unwind
|
69
|
553 |
"return nil from the receiver - i.e. simulate a '^ nil'.
|
|
554 |
If the context has already retruned, do nothing.
|
1
|
555 |
Evaluate all unwind-blocks as specified in Block>>valueNowOrOnUnwind:
|
69
|
556 |
and Block>>valueOnUnwindDo: on the way.
|
|
557 |
LIMITATION: currently a context can only be unwound by
|
|
558 |
the owning process - not from outside."
|
1
|
559 |
|
|
560 |
self unwind:nil
|
|
561 |
!
|
|
562 |
|
|
563 |
unwind:value
|
69
|
564 |
"return value from the receiver - i.e. simulate a '^ value'.
|
|
565 |
If the context has already returned , do nothing.
|
1
|
566 |
Evaluate all unwind-blocks as specified in Block>>valueNowOrOnUnwind:
|
69
|
567 |
and Block>>valueOnUnwindDo: on the way.
|
|
568 |
LIMITATION: currently a context can only be unwound by
|
|
569 |
the owning process - not from outside."
|
1
|
570 |
|
10
|
571 |
|con sel|
|
1
|
572 |
|
|
573 |
sender isNil ifTrue:[^ nil].
|
|
574 |
|
|
575 |
"start with this context, moving up"
|
|
576 |
con := thisContext.
|
69
|
577 |
[con notNil and:[con ~~ self]] whileTrue:[
|
1
|
578 |
con isBlockContext ifFalse:[
|
54
|
579 |
|
10
|
580 |
"the way we find those unwind contexts seems kludgy ..."
|
12
|
581 |
sel := con selector.
|
10
|
582 |
((sel == #valueNowOrOnUnwindDo:) or:[sel == #valueOnUnwindDo:]) ifTrue:[
|
|
583 |
"... the way we evaluate the unwind blocks too"
|
|
584 |
(con argAt:1) value
|
1
|
585 |
]
|
|
586 |
].
|
|
587 |
con := con sender
|
|
588 |
].
|
69
|
589 |
|
|
590 |
"this should be avoided"
|
|
591 |
con isNil ifTrue:[
|
|
592 |
'unwind: context not on calling chain' errorPrintNewline.
|
|
593 |
"
|
|
594 |
debugging ...
|
|
595 |
"
|
|
596 |
self error:'unwind: context not on calling chain'.
|
|
597 |
^ nil
|
|
598 |
].
|
|
599 |
self return:value
|
1
|
600 |
! !
|