(ns com.tailrecursion.blacktide.aot-fixture
"Fresh AOT client exercising both compiler loading and generated code."
(:require [com.tailrecursion.blacktide :refer [loophole setq label goto]]))
(defn keyword-read [target]
(loophole [saved nil] (:k (setq saved target))))
(defn sample [n]
(loophole [^long i 0 total 0]
(while (< i n)
(setq total (case i 0 3
(+ total 2))
i (inc i)))
total))
(defn reference-site [flag value]
(let [result (loophole [a 0 b 0]
(if flag (setq a 1 b 2) (setq a 3 b 4))
(label again)
(when (neg? a) (goto again))
(+ a b)
value)]
result))