Skip to content

Commit

Permalink
CLJS-1001: reify metadata leakage
Browse files Browse the repository at this point in the history
 reify was incorrectly passing metadata through without eliding reader
 metadata on the form.
  • Loading branch information
swannodette committed Feb 10, 2015
1 parent ce829ed commit ef998e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/clj/cljs/analyzer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1707,9 +1707,12 @@
:children items
:tag (if (map? val) 'object 'array)}))

(defn elide-reader-meta [m]
(dissoc m :file :line :column :end-column :end-line :source))

(defn analyze-wrap-meta [expr]
(let [form (:form expr)
m (dissoc (meta form) :file :line :column :end-column :end-line :source)]
m (elide-reader-meta (meta form))]
(if (seq m)
(let [env (:env expr) ; take on expr's context ourselves
expr (assoc-in expr [:env :context] :expr) ; change expr to :expr
Expand Down
2 changes: 1 addition & 1 deletion src/clj/cljs/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@
IMeta
(~'-meta [~this-sym] ~meta-sym)
~@impls))
(new ~t ~@locals ~(meta &form)))))
(new ~t ~@locals ~(ana/elide-reader-meta (meta &form))))))

(defmacro specify! [expr & impls]
(let [x (with-meta (gensym "x") {:extend :instance})]
Expand Down

0 comments on commit ef998e8

Please sign in to comment.