diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-11 15:31:38 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-11 15:31:38 -0400 |
| commit | 7e8604daeb9239e1669c5414dd6caa37af30c4ff (patch) | |
| tree | 8fcab61a296381280902a3fc7b2d8456e2a9b227 /src/environment.c | |
| parent | 25fa8ace21f0f6874f5b3ad1248e0e5d21190c84 (diff) | |
Make `{a,b,c}` shorthand for `{a:Empty(), b:Empty(), c:Empty()}` and
display it that way. Same for type annotations.
Diffstat (limited to 'src/environment.c')
| -rw-r--r-- | src/environment.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/environment.c b/src/environment.c index 7d0046de..a3cb5ba8 100644 --- a/src/environment.c +++ b/src/environment.c @@ -18,6 +18,8 @@ public type_t *PATH_TYPE = NULL; public type_t *PATH_TYPE_TYPE = NULL; +public +type_t *EMPTY_TYPE = NULL; static type_t *declare_type(env_t *env, const char *def_str) { ast_t *ast = parse_file_str(def_str); @@ -68,7 +70,7 @@ env_t *global_env(bool source_mapping) { PATH_TYPE_TYPE = declare_type(env, "enum PathType(Relative, Absolute, Home)"); PATH_TYPE = declare_type(env, "struct Path(type:PathType, components:[Text])"); - type_t *empty_type = declare_type(env, "struct Empty()"); + EMPTY_TYPE = declare_type(env, "struct Empty()"); typedef struct { const char *name, *code, *type_str; @@ -88,7 +90,7 @@ env_t *global_env(bool source_mapping) { MAKE_TYPE("Void", Type(VoidType), Text("void"), Text("Void$info")), MAKE_TYPE("Abort", Type(AbortType), Text("void"), Text("Abort$info")), MAKE_TYPE("Memory", Type(MemoryType), Text("void"), Text("Memory$info")), - MAKE_TYPE("Empty", empty_type, Text("Empty$$type"), Text("Empty$$info")), + MAKE_TYPE("Empty", EMPTY_TYPE, Text("Empty$$type"), Text("Empty$$info")), MAKE_TYPE( // "Bool", Type(BoolType), Text("Bool_t"), Text("Bool$info"), {"parse", "Bool$parse", "func(text:Text, remainder:&Text? = none -> Bool?)"}), |
