Skip to content

Commit

Permalink
* missing information from try/catch processing, we need to add `:loc…
Browse files Browse the repository at this point in the history
…al` `:catch` so that `analyze-symbol` can pick it up later

* add test-try
  • Loading branch information
swannodette committed Nov 20, 2024
1 parent 1ce0ca7 commit 0ad7f04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/clojure/cljs/analyzer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,11 @@
(assoc locals e
{:name e
:line (get-line e env)
:column (get-col e env)})
:column (get-col e env)
;; :local is required for {:op :local ...} nodes
;; but previously we had no way to figure this out
;; by adding it here we can recover it later
:local :catch})
locals)
catch (when cblock
(disallowing-recur (analyze (assoc catchenv :locals locals) cblock)))
Expand Down
2 changes: 1 addition & 1 deletion src/test/clojure/cljs/analyzer/spec_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
(is (= :throw (:op node)))
(is (s/valid? ::a/node node))))

#_(deftest test-try
(deftest test-try
(let [node (no-warn (analyze ns-env '(try 1 (catch :default e) (finally))))]
(is (= :try (:op node)))
(is (s/valid? ::a/node node))))
Expand Down

0 comments on commit 0ad7f04

Please sign in to comment.