Skip to content

Commit ddede75

Browse files
mfikesdnolen
authored andcommitted
CLJS-1157: Stacktrace unmunging blindly use locals
Use a little discretion when replacing munged names with local (unmunged) names: Only do so if we can munge them back. The function used in merge-with in this patch makes a best effort at trying to see if we can munge back.
1 parent 7224cd7 commit ddede75

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/clj/cljs/repl.clj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,12 @@
302302
:column column'}
303303
(when url
304304
{:url url}))))]
305-
;; take each non-nil :call and merge it into :function one-level up
306-
(map merge
305+
;; take each non-nil :call and optionally merge it into :function one-level up
306+
;; to avoid replacing with local symbols, we only replace munged name if we can munge call symbol back to it
307+
(map #(merge-with (fn [munged-fn-name unmunged-call-name]
308+
(if (= munged-fn-name (string/replace (cljs.compiler/munge unmunged-call-name) "." "$"))
309+
unmunged-call-name
310+
munged-fn-name)) %1 %2)
307311
(map #(dissoc % :call) with-calls)
308312
(concat (rest (map #(if (:call %)
309313
(hash-map :function (:call %))

0 commit comments

Comments
 (0)