From 823b053e6084cbb20cb8a55f0b3af073b4e3f2bd Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Thu, 31 Jul 2014 12:37:26 -0400 Subject: [PATCH] Fix T...name --- parser.c | 9 +++++---- tests/varargs.qc | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/parser.c b/parser.c index f95a231..c45f68e 100644 --- a/parser.c +++ b/parser.c @@ -4675,10 +4675,6 @@ static ast_value *parse_parameter_list(parser_t *parser, ast_value *var) } } } else { - if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_FTEQCC && param->name[0] == '<') { - parseerror(parser, "parameter name omitted"); - goto on_error; - } vec_push(params, param); if (param->expression.vtype >= TYPE_VARIANT) { char tname[1024]; /* typename is reserved in C++ */ @@ -4697,12 +4693,17 @@ static ast_value *parse_parameter_list(parser_t *parser, ast_value *var) } if (parser->tok == TOKEN_IDENT) { argcounter = util_strdup(parser_tokval(parser)); + ast_value_set_name(param, argcounter); if (!parser_next(parser) || parser->tok != ')') { parseerror(parser, "`...` must be the last parameter of a variadic function declaration"); goto on_error; } } } + if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_FTEQCC && param->name[0] == '<') { + parseerror(parser, "parameter name omitted"); + goto on_error; + } } } diff --git a/tests/varargs.qc b/tests/varargs.qc index eceec4a..4b0d806 100644 --- a/tests/varargs.qc +++ b/tests/varargs.qc @@ -1,4 +1,4 @@ -void nbva(float a, ...count) { +void nbva(float a, string...count) { print("You gave me ", ftos(count), " additional parameters\n"); print("First: ", ...(0, string), "\n"); print("You chose: ", ...(a, string), "\n"); -- 2.39.2