             (sorted-map)))))
 
 (defn decode-reverse
-  "Convert a v3 source map JSON object into a nested sorted map 
-   organized as file, line, and column that maps ClojureScript
-   source locations to the generated JavaScript."
+  "Convert a v3 source map JSON object into a reverse source map
+  mapping original ClojureScript source locations to the generated
+  JavaScript."
   ([source-map]
-     (decode (aget source-map "mappings") source-map))
+     (decode-reverse (aget source-map "mappings") source-map))
   ([mappings source-map]
      (let [sources (aget source-map "sources")
            relseg-init [0 0 0 0 0]


(defn source-compare
  "Take a seq of source file names and return a comparator
   that can be used to construct a sorted map."
  [sources]
  (let [sources (indexed-sources sources)]
    (fn [a b] (compare (sources a) (sources b)))))

            [cljs.source-map.base64-vlq :as base64-vlq]))

;; =============================================================================
;; Source map code in the file assumes the following in memory
;; representation of source map data.
;;
;; { gline[Integer]
;;   { gcol[Integer]
;;    [{ :line ..., :col ..., :name ..., :source ... }] } }
;;
;; Reverse source map code in the file assumes the following in memory
;; representation of source map data.
;;
;; { file-name[String]
;;   { line[Integer]
;;     { col[Integer]
;;       [{ :gline ..., :gcol ..., :name ... }] } }

;; -----------------------------------------------------------------------------
;; Utilities

(defn indexed-sources
  "Take a seq of source file names and return a map from
   file number to integer index. For reverse source maps."
  [sources]
  (->> sources
    (map-indexed (fn [a b] [a b]))
