We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0cdbb23 commit fb312cdCopy full SHA for fb312cd
1 file changed
src/main/clojure/cljs/analyzer.cljc
@@ -1394,8 +1394,15 @@
1394
:children (vec (concat [v] tests thens (if default [default])))}))
1395
1396
(defmethod parse 'throw
1397
- [op env [_ throw :as form] name _]
1398
- (let [throw-expr (disallowing-recur (analyze (assoc env :context :expr) throw))]
+ [op env [_ throw-form :as form] name _]
+ (cond
1399
+ (= 1 (count form))
1400
+ (throw
1401
+ (error env "Too few arguments to throw, throw expects a single Error instance"))
1402
+ (< 2 (count form))
1403
1404
+ (error env "Too many arguments to throw, throw expects a single Error instance")))
1405
+ (let [throw-expr (disallowing-recur (analyze (assoc env :context :expr) throw-form))]
1406
{:env env :op :throw :form form
1407
:throw throw-expr
1408
:children [throw-expr]}))
0 commit comments