~subsetpark/fugue

3fa72f84830605be2656e0de9dbefa7ee2ffd4bb — Zach Smith 5 months ago f449002
Do not unnecessarily quote (and why was I including gettrs in :meta?)
2 files changed, 2 insertions(+), 5 deletions(-)

M fugue.janet
M test/fugue.janet
M fugue.janet => fugue.janet +2 -4
@@ 89,16 89,14 @@
  [name parent fields defined-fields
   {:proto-allocated-fields proto-allocated-fields
    :proto-allocations to-allocate
    :instance-defaults instance-defaults
    :getters getters}]
    :instance-defaults instance-defaults}]
  ~(let [object (,bare-proto (,string ',name) ,defined-fields)
         parent (if (symbol? ',parent) ,parent ',Root)]
     (,put-in object [:_meta :prototype-allocations]
        (,table/setproto
           (,table ;(,mapcat |[$0 object] ',proto-allocated-fields))
           (,table ;(,mapcat |[$0 object] ,proto-allocated-fields))
           (,get-in parent [:_meta :prototype-allocations])))
     (,put-in object [:_meta :instance-defaults] ,instance-defaults)
     (,put-in object [:_meta :getters] ',getters)
     (,merge-into object ,to-allocate)
     (,table/setproto object parent)))


M test/fugue.janet => test/fugue.janet +0 -1
@@ 171,7 171,6 @@
(deftest getter
  (let [a-form (:new Form :unique-field :echo)
        a-dog (:new Dog)]
    (is (== @{'unique-field 'get-unique-field} (get-in Form [:_meta :getters])))
    (is (nil? (dyn 'unique-field)))
    (is (= :echo (get-unique-field a-form)))
    (is (= :echo (a-form (fugue/@ Form :unique-field))))