(defn desugar-deps
"Takes a map of pass-name -> pass deps and puts the :after :affects and :before passes
in the appropriate pass :depends"
[passes]
(reduce-kv (fn [m name {:keys [after affects before]}]
(reduce (fn [m p] (update-in m [p :depends] (fnil conj #{}) name))
(update-in m [name :depends] (fnil into #{}) (into affects (filter passes after)))
before)) passes passes))