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 1963
1963
:shadow (m fld)}))
1964
1964
{} (if (= :defrecord* op)
1965
1965
(concat fields '[__meta __extmap ^:mutable __hash])
1966
- fields))]
1966
+ fields))
1967
+ protocols (-> tsym meta :protocols )]
1967
1968
(swap! env/*compiler* update-in [::namespaces (-> env :ns :name ) :defs tsym]
1968
1969
(fn [m]
1969
1970
(let [m (assoc (or m {})
1973
1974
:record (= :defrecord* op))]
1974
1975
(merge m
1975
1976
(dissoc (meta tsym) :protocols )
1976
- {:protocols ( -> tsym meta : protocols) }
1977
+ {:protocols protocols}
1977
1978
(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)}))
1979
1982
1980
1983
(defmethod parse 'deftype*
1981
1984
[_ env form _ _]
Original file line number Diff line number Diff line change 1042
1042
(load-libs uses requires (:use reloads)))
1043
1043
1044
1044
(defmethod emit* :deftype*
1045
- [{:keys [t fields pmasks body]}]
1045
+ [{:keys [t fields pmasks body protocols ]}]
1046
1046
(let [fields (map munge fields)]
1047
1047
(emitln " " )
1048
1048
(emitln " /**" )
1049
1049
(emitln " * @constructor" )
1050
+ (doseq [protocol protocols]
1051
+ (emitln " * @implements {" (munge (str protocol)) " }" ))
1050
1052
(emitln " */" )
1051
1053
(emitln (munge t) " = (function (" (comma-sep fields) " ){" )
1052
1054
(doseq [fld fields]
1057
1059
(emit body)))
1058
1060
1059
1061
(defmethod emit* :defrecord*
1060
- [{:keys [t fields pmasks body]}]
1062
+ [{:keys [t fields pmasks body protocols ]}]
1061
1063
(let [fields (concat (map munge fields) '[__meta __extmap __hash])]
1062
1064
(emitln " " )
1063
1065
(emitln " /**" )
1064
1066
(emitln " * @constructor" )
1067
+ (doseq [protocol protocols]
1068
+ (emitln " * @implements {" (munge (str protocol)) " }" ))
1065
1069
(emitln " */" )
1066
1070
(emitln (munge t) " = (function (" (comma-sep fields) " ){" )
1067
1071
(doseq [fld fields]
Original file line number Diff line number Diff line change 1895
1895
sigs))))]
1896
1896
`(do
1897
1897
(set! ~'*unchecked-if* true )
1898
- (def ~psym (js-obj ))
1898
+ (def ~psym (~'js* " function(){} " ))
1899
1899
~@(map method methods)
1900
1900
(set! ~'*unchecked-if* false ))))
1901
1901
You can’t perform that action at this time.
0 commit comments