diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-02 12:32:18 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-02 12:32:18 +0100 |
| commit | 620bf162a048fdf29fdfcedc12abae79cffeedf4 (patch) | |
| tree | 0cac112f7f7d2c0983280b4acb0e9e1688dafa70 /src/check_builtin.cpp | |
| parent | bb4bc316a4bd86774953f1e8fcefffb5ed8bbf37 (diff) | |
Cache const `string16` in LLVM
Diffstat (limited to 'src/check_builtin.cpp')
| -rw-r--r-- | src/check_builtin.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 66ea0cfbd..da5eb8977 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -2329,10 +2329,15 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As if (operand->mode == Addressing_Constant) { mode = Addressing_Constant; - GB_ASSERT_MSG(!is_type_string16(op_type), "TODO(bill): constant utf-16 string len"); - - String str = operand->value.value_string; - value = exact_value_i64(str.len); + if (operand->value.kind == ExactValue_String) { + String str = operand->value.value_string; + value = exact_value_i64(str.len); + } else if (operand->value.kind == ExactValue_String16) { + String16 str = operand->value.value_string16; + value = exact_value_i64(str.len); + } else { + GB_PANIC("Unhandled value kind: %d", operand->value.kind); + } type = t_untyped_integer; } else { mode = Addressing_Value; |