From d4258274e03e83cf9ba5111ec7a911ede56207c1 Mon Sep 17 00:00:00 2001 From: Brandon Bloom Date: Sun, 12 Aug 2012 16:32:30 -0700 Subject: [PATCH] Eliminates incorrect merging of metadata when redefining vars --- src/clj/cljs/analyzer.clj | 49 +++++++++++++++++++++----------------------- 1 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/clj/cljs/analyzer.clj b/src/clj/cljs/analyzer.clj index f2bccbb..36405ce 100644 --- a/src/clj/cljs/analyzer.clj +++ b/src/clj/cljs/analyzer.clj @@ -322,32 +322,29 @@ (warning env (str "WARNING: " (symbol (str ns-name) (str sym)) " no longer fn, references are stale")))) - (swap! namespaces update-in [ns-name :defs sym] - (fn [m] - (let [m (assoc (or m {}) :name name)] - (merge m - (when tag {:tag tag}) - (when sym-meta sym-meta) - (when dynamic {:dynamic true}) - (when-let [line (:line env)] - {:file *cljs-file* :line line}) - ;; the protocol a protocol fn belongs to - (when protocol - {:protocol protocol}) - ;; symbol for reified protocol - (when-let [protocol-symbol (-> sym meta :protocol-symbol)] - {:protocol-symbol protocol-symbol}) - (when fn-var? - {:fn-var true - ;; protocol implementation context - :protocol-impl (:protocol-impl init-expr) - ;; inline protocol implementation context - :protocol-inline (:protocol-inline init-expr) - :variadic (:variadic init-expr) - :max-fixed-arity (:max-fixed-arity init-expr) - :method-params (map (fn [m] - (:params m)) - (:methods init-expr))}))))) + (swap! namespaces assoc-in [ns-name :defs sym] + (merge {:name name} + sym-meta + (when dynamic {:dynamic true}) + (when-let [line (:line env)] + {:file *cljs-file* :line line}) + ;; the protocol a protocol fn belongs to + (when protocol + {:protocol protocol}) + ;; symbol for reified protocol + (when-let [protocol-symbol (-> sym meta :protocol-symbol)] + {:protocol-symbol protocol-symbol}) + (when fn-var? + {:fn-var true + ;; protocol implementation context + :protocol-impl (:protocol-impl init-expr) + ;; inline protocol implementation context + :protocol-inline (:protocol-inline init-expr) + :variadic (:variadic init-expr) + :max-fixed-arity (:max-fixed-arity init-expr) + :method-params (map (fn [m] + (:params m)) + (:methods init-expr))}))) (merge {:env env :op :def :form form :name name :doc doc :init init-expr} (when tag {:tag tag}) -- 1.7.9.1