diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-12-23 15:28:53 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-12-23 15:28:53 -0500 |
| commit | 4771d6394d84eefaa45b661c1af8e20ac092a225 (patch) | |
| tree | 6c0f08c7a6386eb454ef5b3a9059b84883a9ecdb /src/compile/promotions.c | |
| parent | 0ea6cdf216ca765039f3c01f5b32dc1103265b58 (diff) | |
| parent | 1a62de25c448d2661864ba25a98686ed506e66af (diff) | |
Merge branch 'dev'
Diffstat (limited to 'src/compile/promotions.c')
| -rw-r--r-- | src/compile/promotions.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compile/promotions.c b/src/compile/promotions.c index 5b0ccb95..482e5ed0 100644 --- a/src/compile/promotions.c +++ b/src/compile/promotions.c @@ -61,12 +61,12 @@ bool promote(env_t *env, ast_t *ast, Text_t *code, type_t *actual, type_t *neede // Automatic optional checking for nums: if (needed->tag == NumType && actual->tag == OptionalType && Match(actual, OptionalType)->type->tag == NumType) { int64_t line = get_line_number(ast->file, ast->start); - *code = - Texts("({ ", compile_declaration(actual, Text("opt")), " = ", *code, "; ", "if unlikely (", - check_none(actual, Text("opt")), ")\n", "#line ", line, "\n", "fail_source(", - quoted_str(ast->file->filename), ", ", (int64_t)(ast->start - ast->file->text), ", ", - (int64_t)(ast->end - ast->file->text), ", ", "\"This was expected to be a value, but it's none\");\n", - optional_into_nonnone(actual, Text("opt")), "; })"); + *code = Texts("({ ", compile_declaration(actual, Text("opt")), " = ", *code, "; ", "if unlikely (", + check_none(actual, Text("opt")), ")\n", "#line ", line, "\n", "fail_source(", + quoted_str(ast->file->filename), ", ", (int64_t)(ast->start - ast->file->text), ", ", + (int64_t)(ast->end - ast->file->text), ", ", + "Text(\"This was expected to be a value, but it's none\"));\n", + optional_into_nonnone(actual, Text("opt")), "; })"); return true; } |
