From 898bee15817573b5ab865a1dae7e52da310affa8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 9 Nov 2024 16:27:54 -0500 Subject: Introduce a `Match` struct to represent pattern matching results, which improves the usability of a lot of the APIs. Also bugfix some issues with ranges. --- stdlib/optionals.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'stdlib/optionals.c') diff --git a/stdlib/optionals.c b/stdlib/optionals.c index cd93f936..7224c421 100644 --- a/stdlib/optionals.c +++ b/stdlib/optionals.c @@ -8,6 +8,7 @@ #include "datetime.h" #include "integers.h" #include "metamethods.h" +#include "patterns.h" #include "text.h" #include "threads.h" #include "util.h" @@ -34,6 +35,8 @@ public PUREFUNC bool is_null(const void *obj, const TypeInfo_t *non_optional_typ return *(pthread_t**)obj == NULL; else if (non_optional_type == &DateTime$info) return ((OptionalDateTime_t*)obj)->tv_usec < 0; + else if (non_optional_type == &Match$info) + return ((OptionalMatch_t*)obj)->index.small == 0; switch (non_optional_type->tag) { case ChannelInfo: return *(Channel_t**)obj == NULL; -- cgit v1.2.3