 (defmacro defrecord [rsym fields & impls]
   (let [r (:name (cljs.compiler/resolve-var (dissoc &env :locals) rsym))]
     `(let []
-       ~(emit-defrecord rsym fields impls)
+       ~(emit-defrecord rsym r fields impls)
        ~(build-positional-factory rsym r fields)
        ~(build-map-factory rsym r fields))))
 

		  `(~'-pr-seq [this# opts#]
			      (let [pr-pair# (fn [keyval#] (pr-sequential pr-seq "" " " "" opts# keyval#))]
				(pr-sequential
				 pr-pair# (str "#:" ~(name tagname) "{") ", " "}" opts#
				 (concat [~@(map #(list `vector (keyword %) %) base-fields)] 
					 ~'__extmap))))
		  ])]


(defn- emit-defrecord
   "Do not use this directly - use defrecord"
  [tagname rname fields impls]
  (let [hinted-fields fields
        fields (vec (map #(with-meta % nil) fields))
        base-fields fields
