diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-08-07 15:50:58 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-08-07 15:50:58 -0700 |
| commit | 345cdfb7b9ba7eec98f0378530cd05074999877b (patch) | |
| tree | edd38d86f0ea1714a0f78c42af044bcdd53e7781 /lib/scheme | |
| parent | Add booleans. (diff) | |
| download | chromatopelma-345cdfb7b9ba7eec98f0378530cd05074999877b.tar.zst | |
Fix a bug in the records library.
We have to check if it's a pointer before dereferencing.
Diffstat (limited to 'lib/scheme')
| -rw-r--r-- | lib/scheme/base/50-records.csc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/scheme/base/50-records.csc b/lib/scheme/base/50-records.csc index 2830b3c..e0954d3 100644 --- a/lib/scheme/base/50-records.csc +++ b/lib/scheme/base/50-records.csc @@ -80,7 +80,8 @@ (let ((id *next-type-id*)) (set! *next-type-id* (call-builtin + 1 *next-type-id*)))) (define (pred r) - (call-builtin eq? type-id (call-builtin peek r 0))) + (and (call-builtin eq? 0 (call-builtin typeof r)) + (call-builtin eq? type-id (call-builtin peek r 0)))) (define (constructor field ...) (define r (call-builtin alloc (macro-length (field ...)))) (call-builtin poke type-id r 0) |
