Fix bug where deserializing nullpointers as functions failed instead of returning nil

This commit is contained in:
Joshua Suskalo 2021-09-30 15:26:56 -05:00
parent 50cc6f3bdc
commit ea53cfbdc2
2 changed files with 9 additions and 7 deletions

View file

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This change
## [Unreleased] ## [Unreleased]
### Fixed ### Fixed
- Deserializing nullpointers as functions threw an exception
- Upcall stubs with non-primitive arguments failed to compile - Upcall stubs with non-primitive arguments failed to compile
- Upcall stubs had incorrect types - Upcall stubs had incorrect types

View file

@ -367,13 +367,14 @@
(defmethod mem/deserialize* ::fn (defmethod mem/deserialize* ::fn
[addr [_fn arg-types ret-type & {:keys [raw-fn?]}]] [addr [_fn arg-types ret-type & {:keys [raw-fn?]}]]
(-> addr (when-not (mem/null? addr)
(downcall-handle (-> addr
(method-type arg-types ret-type) (downcall-handle
(function-descriptor arg-types ret-type)) (method-type arg-types ret-type)
(downcall-fn arg-types ret-type) (function-descriptor arg-types ret-type))
(cond-> (downcall-fn arg-types ret-type)
(not raw-fn?) (make-serde-wrapper arg-types ret-type)))) (cond->
(not raw-fn?) (make-serde-wrapper arg-types ret-type)))))
;;; Static memory access ;;; Static memory access