 
       :else
       (let [props-extern (str "{" (string/join "," (for [p props]
-                                                             (build-props-extern p))) "}")]
+                                                     (build-props-extern p))) "}")]
         (if (get obj :top)
           (str "var " name "=" props-extern ";")
           (str (quote-string name) ":" props-extern))))))

(defn build-tree [obj name]
  {:name name
   :type (get-type obj)
   :props (mapv #(let [child (aget obj %)]
                   (if (and (parent-type? child)
                            (not (identical? obj child)))
                     (build-tree child %)
                     {:name % :type (get-type child)}))
                (js-keys obj))
   :prototype (mapv #(identity {:name % :type :function}) (js-keys (.-prototype obj)))})

(defn build-function [name]
  (str (quote-string name) ": function () {}"))

(defn build-prototype [namespace prototype]
  (when (seq prototype)
    (str namespace ".prototype = {" (string/join "," (for [p prototype]
                                                       (build-function (:name p)))) "};")))

(defn build-prototype-extern [obj namespace]
  (let [{:keys [name props prototype]} obj
