aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-21 16:32:22 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-21 16:32:22 -0500
commit46b61d3ed2ae5bd5f74c9d580f5501b1226d9f4e (patch)
tree15256a67533f176332fec7a3feb56c6b4b2e4b23 /compile.c
parent325b367a1342826fe7174ce45cfab92091d4dbb5 (diff)
Add text:by_line()/:by_split()/:by_match()
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 87c872bf..38b6f754 100644
--- a/compile.c
+++ b/compile.c
@@ -308,6 +308,8 @@ CORD compile_type(type_t *t)
case StructType: {
if (nonnull == THREAD_TYPE)
return "Thread_t";
+ if (nonnull == MATCH_TYPE)
+ return "OptionalMatch_t";
auto s = Match(nonnull, StructType);
return CORD_all(namespace_prefix(s->env, s->env->namespace->parent), "$Optional", s->name, "_t");
}
@@ -422,7 +424,7 @@ CORD optional_into_nonnone(type_t *t, CORD value)
case IntType:
return CORD_all(value, ".i");
case StructType:
- if (t == THREAD_TYPE)
+ if (t == THREAD_TYPE || t == MATCH_TYPE)
return value;
return CORD_all(value, ".value");
default:
@@ -436,6 +438,8 @@ CORD check_none(type_t *t, CORD value)
if (t->tag == PointerType || t->tag == FunctionType || t->tag == CStringType
|| t->tag == ChannelType || t == THREAD_TYPE)
return CORD_all("(", value, " == NULL)");
+ else if (t == MATCH_TYPE)
+ return CORD_all("((", value, ").index.small == 0)");
else if (t->tag == BigIntType)
return CORD_all("((", value, ").small == 0)");
else if (t->tag == ClosureType)