Fixes #64 issue on nested scoping in non local exists
[jscl.git] / tests / control.lisp
1
2 ;;; Returning from a "dynamically" nested non local exists
3
4 (defun foo (x)
5   (when x (funcall x))
6   (foo (lambda () (return-from foo 1)))
7   (return-from foo 2))
8
9 (test (= (foo nil) 1))
10
11 (defun foo-2 (x)
12   (let (value)
13     (tagbody
14        (when x (funcall x))
15        (foo-2 (lambda () (go exit-2)))
16        (go end)
17      exit-2
18        (setq value t)
19      end)
20     value))
21
22 (test (foo-2 nil))
23