fixed mixing of old and new framemacro syntax

This commit is contained in:
Dale Weiler 2021-07-07 22:58:13 -04:00
parent 1e8ce1733b
commit 663723f00a
3 changed files with 26 additions and 2 deletions

View file

@ -5180,7 +5180,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
}
}
/* we only allow 1-dimensional arrays */
if (parser->tok == '[') {
if (var->m_vtype != TYPE_FUNCTION && parser->tok == '[') {
wasarray = true;
var = parse_arraysize(parser, var);
if (!var) {
@ -5618,7 +5618,7 @@ skipvar:
}
}
if (parser->tok != '{' || var->m_vtype != TYPE_FUNCTION) {
if (var->m_vtype != TYPE_FUNCTION || (parser->tok != '{' && parser->tok != '[')) {
if (parser->tok != '=') {
parseerror(parser, "missing semicolon or initializer, got: `%s`", parser_tokval(parser));
break;

20
tests/framemacro.qc Normal file
View file

@ -0,0 +1,20 @@
$frame frame1 frame2
float time;
entity self;
.float frame;
.float nextthink;
.void() think;
// Mixing syntax, = is optional.
void frame1_func_mixed_no_assign() [$frame1, frame2_func_mixed_no_assign] {}
void frame2_func_mixed_no_assign() [$frame2, frame2_func_mixed_no_assign] {}
void frame1_func_mixed() =[$frame1, frame2_func_mixed] {}
void frame2_func_mixed() =[$frame2, frame2_func_mixed] {}
void() frame1_func_old =[$frame1, frame2_func_old] {}
void() frame2_func_old =[$frame2, frame2_func_old] {}

4
tests/framemacro.tmpl Normal file
View file

@ -0,0 +1,4 @@
I: framemacro.qc
D: test frame macros
T: -compile
C: -std=gmqcc