aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-25 14:37:44 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-25 14:37:44 -0400
commitf0f8f218703ebb4512b3cd3f9e06b86a7d9861b0 (patch)
tree08af628f61e0368b90462f0291dbf8cfe3e506cc
parent9496c4abcbaa823f7c63ac4e8dc86a514a9b5ef1 (diff)
`Where` should use empty struct typeinfos
-rw-r--r--builtins/where.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/builtins/where.c b/builtins/where.c
index b69166e0..f7db2db3 100644
--- a/builtins/where.c
+++ b/builtins/where.c
@@ -9,24 +9,6 @@
#include "where.h"
#include "util.h"
-static CORD Where$Anywhere$as_text(Where$Anywhere_t *obj, bool use_color)
-{
- if (!obj) return "Anywhere";
- return CORD_all(use_color ? "\x1b[0;1mAnywhere\x1b[m(" : "Anywhere(", ")");
-}
-
-static CORD Where$Start$as_text(Where$Start_t *obj, bool use_color)
-{
- if (!obj) return "Start";
- return CORD_all(use_color ? "\x1b[0;1mStart\x1b[m(" : "Start(", ")");
-}
-
-static CORD Where$End$as_text(Where$End_t *obj, bool use_color)
-{
- if (!obj) return "End";
- return CORD_all(use_color ? "\x1b[0;1mEnd\x1b[m(" : "End(", ")");
-}
-
static CORD Where$as_text(Where_t *obj, bool use_color)
{
if (!obj)
@@ -46,9 +28,10 @@ static CORD Where$as_text(Where_t *obj, bool use_color)
public const Where_t Where$tagged$Anywhere = {$tag$Where$Anywhere};
public const Where_t Where$tagged$Start = {$tag$Where$Start};
public const Where_t Where$tagged$End = {$tag$Where$End};
-public const TypeInfo Where$Anywhere = {0, 0, {.tag=CustomInfo, .CustomInfo={.as_text=(void*)Where$Anywhere$as_text}}};
-public const TypeInfo Where$Start = {0, 0, {.tag=CustomInfo, .CustomInfo={.as_text=(void*)Where$Start$as_text}}};
-public const TypeInfo Where$End = {0, 0, {.tag=CustomInfo, .CustomInfo={.as_text=(void*)Where$End$as_text}}};
-public const TypeInfo Where = {4, 4, {.tag=CustomInfo, .CustomInfo={.as_text=(void*)Where$as_text}}};
+public const TypeInfo Where$Anywhere = {0, 0, {.tag=EmptyStruct, .EmptyStruct.name="Anywhere"}};
+public const TypeInfo Where$Start = {0, 0, {.tag=EmptyStruct, .EmptyStruct.name="Start"}};
+public const TypeInfo Where$End = {0, 0, {.tag=EmptyStruct, .EmptyStruct.name="End"}};
+public const TypeInfo Where = {sizeof(Where_t), __alignof__(Where_t),
+ {.tag=CustomInfo, .CustomInfo={.as_text=(void*)Where$as_text}}};
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0