File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 19631963 :shadow (m fld)}))
19641964 {} (if (= :defrecord* op)
19651965 (concat fields '[__meta __extmap ^:mutable __hash])
1966- fields))]
1966+ fields))
1967+ protocols (-> tsym meta :protocols )]
19671968 (swap! env/*compiler* update-in [::namespaces (-> env :ns :name ) :defs tsym]
19681969 (fn [m]
19691970 (let [m (assoc (or m {})
19731974 :record (= :defrecord* op))]
19741975 (merge m
19751976 (dissoc (meta tsym) :protocols )
1976- {:protocols ( -> tsym meta : protocols) }
1977+ {:protocols protocols}
19771978 (source-info tsym env)))))
1978- {:op op :env env :form form :t t :fields fields :pmasks pmasks :body (analyze (assoc env :locals locals) body)}))
1979+ {:op op :env env :form form :t t :fields fields :pmasks pmasks
1980+ :protocols (disj protocols 'cljs.core/Object)
1981+ :body (analyze (assoc env :locals locals) body)}))
19791982
19801983(defmethod parse 'deftype*
19811984 [_ env form _ _]
Original file line number Diff line number Diff line change 10421042 (load-libs uses requires (:use reloads)))
10431043
10441044(defmethod emit* :deftype*
1045- [{:keys [t fields pmasks body]}]
1045+ [{:keys [t fields pmasks body protocols ]}]
10461046 (let [fields (map munge fields)]
10471047 (emitln " " )
10481048 (emitln " /**" )
10491049 (emitln " * @constructor" )
1050+ (doseq [protocol protocols]
1051+ (emitln " * @implements {" (munge (str protocol)) " }" ))
10501052 (emitln " */" )
10511053 (emitln (munge t) " = (function (" (comma-sep fields) " ){" )
10521054 (doseq [fld fields]
10571059 (emit body)))
10581060
10591061(defmethod emit* :defrecord*
1060- [{:keys [t fields pmasks body]}]
1062+ [{:keys [t fields pmasks body protocols ]}]
10611063 (let [fields (concat (map munge fields) '[__meta __extmap __hash])]
10621064 (emitln " " )
10631065 (emitln " /**" )
10641066 (emitln " * @constructor" )
1067+ (doseq [protocol protocols]
1068+ (emitln " * @implements {" (munge (str protocol)) " }" ))
10651069 (emitln " */" )
10661070 (emitln (munge t) " = (function (" (comma-sep fields) " ){" )
10671071 (doseq [fld fields]
Original file line number Diff line number Diff line change 18951895 sigs))))]
18961896 `(do
18971897 (set! ~'*unchecked-if* true )
1898- (def ~psym (js-obj ))
1898+ (def ~psym (~'js* " function(){} " ))
18991899 ~@(map method methods)
19001900 (set! ~'*unchecked-if* false ))))
19011901
You can’t perform that action at this time.
0 commit comments