Skip to content

Commit 6e23244

Browse files
anmonteiroswannodette
authored andcommitted
CLJS-2024: Self-host: find-ns-obj broken for namespaces with 'a' as the first segment
1 parent 947ccb4 commit 6e23244

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10852,7 +10852,9 @@ reduces them without incurring seq initialization"
1085210852
; may throw ReferenceError.
1085310853
(find-ns-obj*
1085410854
(try
10855-
(js/eval (first segs))
10855+
(let [ctxt (js/eval (first segs))]
10856+
(when (and ctxt (object? ctxt))
10857+
ctxt))
1085610858
(catch js/ReferenceError e
1085710859
nil))
1085810860
(next segs))

src/test/self/self_host/test.cljs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,20 @@
877877
(is (nil? error))
878878
(inc! l))))))
879879

880+
(deftest test-cljs-2024
881+
(async done
882+
(let [st (cljs/empty-state)
883+
l (latch 1 done)]
884+
(cljs/eval-str
885+
st
886+
"(find-ns-obj 'a.x)"
887+
nil
888+
{:context :expr
889+
:eval node-eval}
890+
(fn [{:keys [error] :as m}]
891+
(is (nil? error))
892+
(inc! l))))))
893+
880894
(defn -main [& args]
881895
(run-tests))
882896

0 commit comments

Comments
 (0)