flan/test/programs/dev-break-nullcall.flan

27 lines
825 B
Plaintext

;;;; A program that stops on a call through a null CFn, for driving the break
;;;; loop over one. Nothing handles NullCall here, so the signal reaches the
;;;; break hook and the program parks, as a bad index does in
;;;; dev-break-bounds.flan; the program's own continue is the way on.
(import agent "vendor:agent")
(defonce table [2 (CFn [i32] i32)])
(defonce skipped i64)
(defonce ticks i64)
(defn call-slot [i i32] i32 ((at table i) 5))
(defn frame [i i32] ()
(restart-case
(do (println (call-slot i)) (println "frame done"))
(continue [] (set skipped (+ skipped 1)))))
(defn main [] i32
(agent/start "/tmp/flan-dev-break-nullcall-fallback.sock")
;; Slot 1 was never set, so it is null.
(frame 1)
(print skipped) (println "")
(dotimes [i 4000]
(agent/wait 5)
(set ticks (+ ticks 1)))
0)