aboutsummaryrefslogtreecommitdiff
path: root/stdlib/optionals.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-09 16:27:54 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-09 16:27:54 -0500
commit898bee15817573b5ab865a1dae7e52da310affa8 (patch)
treeb8531a828190997a63a1e1ef32f4aa568304e61c /stdlib/optionals.c
parent7a4f2e73addf6dfcde2a6b17b62b961608e556a0 (diff)
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.
Diffstat (limited to 'stdlib/optionals.c')
-rw-r--r--stdlib/optionals.c3
1 files changed, 3 insertions, 0 deletions
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;