From 798d3c36dec6fa7c7a6c65c0e8879950439024e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 30 Sep 2023 14:14:03 +0200 Subject: [PATCH] Using a label inside an expression now raises an error. [COMPILER] * BUG: Using a label inside an expression now raises an error. --- main/gbc/gbc_trans_expr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/gbc/gbc_trans_expr.c b/main/gbc/gbc_trans_expr.c index f2531595a..6619a0445 100644 --- a/main/gbc/gbc_trans_expr.c +++ b/main/gbc/gbc_trans_expr.c @@ -278,8 +278,12 @@ static void trans_identifier(int index, bool point, PATTERN next) _last_symbol_used = NULL; //fprintf(stderr, "_last_symbol_used = NULL\n"); + if (!TYPE_is_null(sym->local.type) && !point) { + if (TYPE_get_kind(sym->local.type) == TK_LABEL) + goto __CLASS; + if (TYPE_is_static(sym->local.type)) CODE_push_global(sym->local.value, TRUE, FALSE); else @@ -294,6 +298,7 @@ static void trans_identifier(int index, bool point, PATTERN next) else if (!TYPE_is_null(sym->global.type) && !point) { type = TYPE_get_kind(sym->global.type); + if (!TYPE_is_public(sym->global.type)) { sym->global_used = TRUE;