From fce86ff3d58dd38a6343053a76186e58a977bd72 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 16 Aug 2021 18:17:26 +0100 Subject: Correct struct tag bug --- src/check_type.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index d2a216c93..7dbd72612 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -159,7 +159,12 @@ void check_struct_fields(CheckerContext *ctx, Ast *node, Array *fields Entity *field = alloc_entity_field(ctx->scope, name_token, type, is_using, field_src_index); add_entity(ctx, ctx->scope, name, field); array_add(fields, field); - array_add(tags, p->tag.string); + String tag = p->tag.string; + if (tag.len != 0 && !unquote_string(permanent_allocator(), &tag, 0, tag.text[0] == '`')) { + error(p->tag, "Invalid string literal"); + tag = {}; + } + array_add(tags, tag); field_src_index += 1; } -- cgit v1.2.3