diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-09-01 13:20:17 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-09-01 13:20:17 -0400 |
| commit | c778c8822f1c8acf981e26f7b860a384c94cff6f (patch) | |
| tree | 550e52a4037b202de00d9f43321c996fd964c2a9 /src/compile/optionals.c | |
| parent | 639d5ddfca562e5b3645955551be244b5e8ca9c6 (diff) | |
| parent | ee020c72d92c3807fa4afcd1e170d3df81688b97 (diff) | |
Merge branch 'main' into optional-list-indexing
Diffstat (limited to 'src/compile/optionals.c')
| -rw-r--r-- | src/compile/optionals.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/compile/optionals.c b/src/compile/optionals.c index f32e925e..8340ecaa 100644 --- a/src/compile/optionals.c +++ b/src/compile/optionals.c @@ -127,10 +127,9 @@ Text_t compile_non_optional(env_t *env, ast_t *ast) { type_t *t = get_type(env, value); Text_t value_code = compile(env, value); int64_t line = get_line_number(ast->file, ast->start); - return Texts("({ ", compile_declaration(t, Text("opt")), " = ", value_code, "; ", "if unlikely (", - check_none(t, Text("opt")), ")\n", "#line ", String(line), "\n", "fail_source(", - quoted_str(ast->file->filename), ", ", String((int64_t)(value->start - value->file->text)), ", ", - String((int64_t)(value->end - value->file->text)), ", ", - "\"This was expected to be a value, but it's `none`\\n\");\n", optional_into_nonnone(t, Text("opt")), - "; })"); + return Texts( + "({ ", compile_declaration(t, Text("opt")), " = ", value_code, "; ", "if unlikely (", + check_none(t, Text("opt")), ")\n", "#line ", line, "\n", "fail_source(", quoted_str(ast->file->filename), ", ", + (int64_t)(value->start - value->file->text), ", ", (int64_t)(value->end - value->file->text), ", ", + "\"This was expected to be a value, but it's `none`\\n\");\n", optional_into_nonnone(t, Text("opt")), "; })"); } |
