From 82a9dca733b1e285b257487ba9d15c3fb3b7d5cd Mon Sep 17 00:00:00 2001 From: gambas Date: Tue, 11 Dec 2018 02:40:14 +0100 Subject: [PATCH] Allow local variable declaration anywhere in the function. [COMPILER] * NEW: Allow local variable declaration anywhere in the function. The local symbol still has a function scope, but can be used after its declaration only. --- main/gbc/gbc_trans_code.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/gbc/gbc_trans_code.c b/main/gbc/gbc_trans_code.c index 54ddcf70e..788d4de60 100644 --- a/main/gbc/gbc_trans_code.c +++ b/main/gbc/gbc_trans_code.c @@ -372,7 +372,11 @@ static void translate_body() just_got_select = FALSE; } - if (PATTERN_is_identifier(look[0]) && PATTERN_is(look[1], RS_COLON)) + if (PATTERN_is(look[0], RS_DIM)) + { + TRANS_local(); + } + else if (PATTERN_is_identifier(look[0]) && PATTERN_is(look[1], RS_COLON)) { TRANS_label(); }