|
14 | 14 | :refer [no-warn wrapping-errors
|
15 | 15 | disallowing-recur allowing-redef]]
|
16 | 16 | [cljs.env.macros :refer [ensure]]))
|
17 |
| - #?(:clj (:require [cljs.util :as util :refer [ns->relpath topo-sort]] |
| 17 | + #?(:clj (:require [cljs.util :as util :refer [ns->relpath topo-sort]] |
18 | 18 | [clojure.java.io :as io]
|
19 | 19 | [clojure.string :as string]
|
20 | 20 | [clojure.set :as set]
|
|
83 | 83 | :protocol-invalid-method true
|
84 | 84 | :protocol-duped-method true
|
85 | 85 | :protocol-multiple-impls true
|
| 86 | + :protocol-with-variadic-method true |
86 | 87 | :single-segment-namespace true
|
87 | 88 | :munged-namespace true
|
88 | 89 | :ns-var-clash true
|
|
294 | 295 | [warning-type info]
|
295 | 296 | (str "Protocol " (:protocol info) " implemented multiple times"))
|
296 | 297 |
|
| 298 | +(defmethod error-message :protocol-with-variadic-method |
| 299 | + [warning-type info] |
| 300 | + (str "Protocol " (:protocol info) " declares method " |
| 301 | + (:name info) " with variadic signature (&)")) |
| 302 | + |
297 | 303 | (defmethod error-message :multiple-variadic-overloads
|
298 | 304 | [warning-type info]
|
299 | 305 | (str (:name info) ": Can't have more than 1 variadic overload"))
|
|
1142 | 1148 | (and (:fn-var v) (not fn-var?)))
|
1143 | 1149 | (warning :fn-var env {:ns-name ns-name :sym sym})))
|
1144 | 1150 | (swap! env/*compiler* assoc-in [::namespaces ns-name :defs sym]
|
1145 |
| - (merge |
| 1151 | + (merge |
1146 | 1152 | {:name var-name}
|
1147 | 1153 | ;; remove actual test metadata, as it includes non-valid EDN and
|
1148 | 1154 | ;; cannot be present in analysis cached to disk - David
|
|
1503 | 1509 |
|
1504 | 1510 | (defn analyze-let
|
1505 | 1511 | [encl-env [_ bindings & exprs :as form] is-loop]
|
1506 |
| - (when-not (and (vector? bindings) (even? (count bindings))) |
| 1512 | + (when-not (and (vector? bindings) (even? (count bindings))) |
1507 | 1513 | (throw (error encl-env "bindings must be vector of even number of elements")))
|
1508 | 1514 | (let [context (:context encl-env)
|
1509 | 1515 | [bes env] (analyze-let-bindings encl-env bindings)
|
|
1538 | 1544 | (let [context (:context env)
|
1539 | 1545 | frame (first *recur-frames*)
|
1540 | 1546 | exprs (disallowing-recur (vec (map #(analyze (assoc env :context :expr) %) exprs)))]
|
1541 |
| - (when-not frame |
| 1547 | + (when-not frame |
1542 | 1548 | (throw (error env "Can't recur here")))
|
1543 |
| - (when-not (= (count exprs) (count (:params frame))) |
| 1549 | + (when-not (= (count exprs) (count (:params frame))) |
1544 | 1550 | (throw (error env "recur argument count mismatch")))
|
1545 | 1551 | (reset! (:flag frame) true)
|
1546 | 1552 | (assoc {:env env :op :recur :form form}
|
|
1554 | 1560 |
|
1555 | 1561 | (defmethod parse 'new
|
1556 | 1562 | [_ env [_ ctor & args :as form] _ _]
|
1557 |
| - (when-not (symbol? ctor) |
| 1563 | + (when-not (symbol? ctor) |
1558 | 1564 | (throw (error env "First arg to new must be a symbol")))
|
1559 | 1565 | (disallowing-recur
|
1560 | 1566 | (let [enve (assoc env :context :expr)
|
|
1616 | 1622 | (when (:field targetexpr)
|
1617 | 1623 | targetexpr))))
|
1618 | 1624 | valexpr (analyze enve val)]
|
1619 |
| - (when-not targetexpr |
| 1625 | + (when-not targetexpr |
1620 | 1626 | (throw (error env "set! target must be a field or a symbol naming a var")))
|
1621 | 1627 | (cond
|
1622 | 1628 | (= targetexpr ::set-unchecked-if) {:env env :op :no-op}
|
|
1729 | 1735 | (fn [s [k exclude xs]]
|
1730 | 1736 | (if (= k :refer-clojure)
|
1731 | 1737 | (do
|
1732 |
| - (when-not (= exclude :exclude) |
| 1738 | + (when-not (= exclude :exclude) |
1733 | 1739 | (throw (error env "Only [:refer-clojure :exclude (names)] form supported")))
|
1734 | 1740 | (when (seq s)
|
1735 | 1741 | (throw (error env "Only one :refer-clojure form is allowed per namespace definition")))
|
|
1883 | 1889 |
|
1884 | 1890 | (defmethod parse 'ns
|
1885 | 1891 | [_ env [_ name & args :as form] _ opts]
|
1886 |
| - (when-not (symbol? name) |
| 1892 | + (when-not (symbol? name) |
1887 | 1893 | (throw (error env "Namespaces must be named by a symbol.")))
|
1888 | 1894 | (let [name (cond-> name (:macros-ns opts) macro-ns-name)]
|
1889 | 1895 | (let [segments (string/split (clojure.core/name name) #"\.")]
|
|
0 commit comments