cljs.test/mapped-line-and-column

functionsince v0.0-2496Edit
(mapped-line-and-column filename line column)

Source code @ clojurescript:src/main/cljs/cljs/test.cljs
(defn mapped-line-and-column [filename line column]
  (let [default [filename line column]]
    (if-let [source-map (:source-map (get-current-env))]
      ;; source maps are 0 indexed for lines
      (if-let [columns (get-in source-map [filename (dec line)])]
        (vec
          (map
            ;; source maps are 0 indexed for columns
            ;; multiple segments may exist at column
            ;; just take first
            (first
              (if-let [mapping (get columns (dec column))]
                mapping
                (second (first columns))))
            [:source :line :col]))
        default)
      default)))