Commit 1184b1d560
Changed files (2)
src
stage1
src/stage1/analyze.cpp
@@ -6291,6 +6291,11 @@ ZigValue *create_const_str_lit(CodeGen *g, Buf *str) {
return const_val;
}
+ZigValue *create_sentineled_str_lit(CodeGen *g, Buf *str, ZigValue *sentinel) {
+ ZigValue *array_val = create_const_str_lit(g, str)->data.x_ptr.data.ref.pointee;
+ return create_const_slice(g, array_val, 0, buf_len(str), true, sentinel);
+}
+
void init_const_bigint(ZigValue *const_val, ZigType *type, const BigInt *bigint) {
const_val->special = ConstValSpecialStatic;
const_val->type = type;
src/stage1/analyze.hpp
@@ -144,6 +144,7 @@ ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent);
void init_const_str_lit(CodeGen *g, ZigValue *const_val, Buf *str, bool move_str);
ZigValue *create_const_str_lit(CodeGen *g, Buf *str);
+ZigValue *create_sentineled_str_lit(CodeGen *g, Buf *str, ZigValue *sentinel);
void init_const_bigint(ZigValue *const_val, ZigType *type, const BigInt *bigint);
ZigValue *create_const_bigint(CodeGen *g, ZigType *type, const BigInt *bigint);