Skip to content

Commit 2240d3d

Browse files
author
David Frese
committed
Use helper to define rtd record predicate too.
1 parent 919e97f commit 2240d3d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/active/clojure/record_helper.cljc

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342

343343
;; Predicate
344344
(def ~(add-meta (add-predicate-doc type predicate ?docref) meta-data)
345-
(fn [x#] (rrun/record-of-type? x# ~rtd-symbol)))
345+
(rrun/record-type-predicate ~rtd-symbol))
346346

347347
;; Constructor
348348
;; We are defining a anonymous function for the define constructor function.

src/active/clojure/record_runtime.cljc

+6-2
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,13 @@
160160
(.-rtd r))
161161

162162
(defn record-of-type?
163-
[^Record r ^RecordTypeDescriptor rtd]
163+
[r ^RecordTypeDescriptor rtd]
164164
(and (record? r)
165-
(rtd= rtd (.-rtd r))))
165+
(rtd= rtd (.-rtd ^Record r))))
166+
167+
(defn record-type-predicate [^RecordTypeDescriptor rtd]
168+
(fn [x]
169+
(record-of-type? x rtd)))
166170

167171
; assumes that ?r, ?rtd are identifiers alerady
168172
(defmacro record-check-rtd!

0 commit comments

Comments
 (0)