Fix bug where only lists were allowed as types (which breaks)

This commit is contained in:
Joshua Suskalo 2021-09-16 16:15:02 -05:00
parent 1c5fbff3dd
commit 6758fdebe1

View file

@ -148,7 +148,7 @@
[type]
(cond
(qualified-keyword? type) type
(list? type) (keyword (first type))))
(sequential? type) (keyword (first type))))
(defmulti c-layout
"Gets the layout object for a given `type`.
@ -223,6 +223,8 @@
([type] (alloc-instance type (connected-scope)))
([type scope] (MemorySegment/allocateNative ^long (size-of type) ^ResourceScope scope)))
(declare serialize serialize-into)
(defmulti serialize*
"Constructs a serialized version of the `obj` and returns it.
@ -243,6 +245,10 @@
{:type type
:object obj}))))
(defmethod serialize* ::pointer
[obj type scope]
(alloc-instance (serialize obj (second type) scope)))
(defmulti serialize-into
"Writes a serialized version of the `obj` to the given `segment`.