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.
This commit is contained in:
gambas 2018-12-11 02:40:14 +01:00
parent cc2b05a4c9
commit 82a9dca733

View File

@ -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();
}