Allow string literals for [N]byte

This commit is contained in:
gingerBill
2020-11-20 16:01:59 +00:00
parent 87956676f5
commit 6416a6f39c
6 changed files with 34 additions and 7 deletions

View File

@@ -5126,7 +5126,15 @@ lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_loc
LLVMValueRef data = LLVMConstStringInContext(ctx,
cast(char const *)value.value_string.text,
cast(unsigned)value.value_string.len,
false);
false /*DontNullTerminate*/);
res.value = data;
return res;
} else if (is_type_u8_array(type) && value.kind == ExactValue_String) {
GB_ASSERT(type->Array.count == value.value_string.len);
LLVMValueRef data = LLVMConstStringInContext(ctx,
cast(char const *)value.value_string.text,
cast(unsigned)value.value_string.len,
true /*DontNullTerminate*/);
res.value = data;
return res;
} else if (is_type_array(type) &&