From: Dale Weiler Date: Thu, 8 Jul 2021 02:58:13 +0000 (-0400) Subject: fixed mixing of old and new framemacro syntax X-Git-Tag: xonotic-v0.8.5~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=663723f00aaa92a15f77bfd7f357ef78b052517d;p=xonotic%2Fgmqcc.git fixed mixing of old and new framemacro syntax --- diff --git a/parser.cpp b/parser.cpp index 57fc7e2..0ca7843 100644 --- a/parser.cpp +++ b/parser.cpp @@ -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; diff --git a/tests/framemacro.qc b/tests/framemacro.qc new file mode 100644 index 0000000..1baf076 --- /dev/null +++ b/tests/framemacro.qc @@ -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] {} + + + diff --git a/tests/framemacro.tmpl b/tests/framemacro.tmpl new file mode 100644 index 0000000..ee80044 --- /dev/null +++ b/tests/framemacro.tmpl @@ -0,0 +1,4 @@ +I: framemacro.qc +D: test frame macros +T: -compile +C: -std=gmqcc \ No newline at end of file