@@ -354,49 +354,47 @@ string replace_macro_args(const char* line) {
354
354
if (depth > 0 && !inmacro) asar_throw_error (0 , error_type_line, error_id_invalid_depth_resolve, " macro parameter" , " macro parameter" , depth, in_macro_def-1 );
355
355
in += depth+1 ;
356
356
357
- bool proper_variadic = false ;
357
+ bool is_variadic_arg = false ;
358
358
if (in[0 ] == ' .' && in[1 ] == ' .' && in[2 ] == ' .' && in[3 ] == ' [' )
359
359
{
360
360
if (end[-1 ] != ' ]' )
361
361
asar_throw_error (0 , error_type_block, error_id_unclosed_vararg);
362
362
363
- proper_variadic = true ;
363
+ is_variadic_arg = true ;
364
364
in += 4 ;
365
365
end--;
366
366
}
367
367
368
368
if (!inmacro) asar_throw_error (0 , error_type_block, error_id_macro_param_outside_macro);
369
+ if (is_variadic_arg && !current_macro->variadic ) asar_throw_error (0 , error_type_block, error_id_macro_not_varadic, " <...[math]>" );
369
370
// *end=0;
370
371
string param;
371
372
string temp (in, end-in);
372
373
resolvedefines (param, temp);
373
374
in = param.data ();
374
375
bool valid_named_param = confirmname (in);
375
- if (!valid_named_param && !current_macro->variadic ) asar_throw_error (0 , error_type_block, error_id_invalid_macro_param_name);
376
- bool found=false ;
377
- for (int j=0 ;current_macro->arguments [j]&&!proper_variadic;j++)
376
+ if (!is_variadic_arg)
378
377
{
379
- if (!strcmp (in, current_macro->arguments [j]))
378
+ if (!valid_named_param) asar_throw_error (0 , error_type_block, error_id_invalid_macro_param_name);
379
+ bool found=false ;
380
+ for (int j=0 ;current_macro->arguments [j];j++)
380
381
{
381
- found=true ;
382
- out+=current_macro_args[j];
383
- break ;
382
+ if (!strcmp (in, current_macro->arguments [j]))
383
+ {
384
+ found=true ;
385
+ out+=current_macro_args[j];
386
+ break ;
387
+ }
388
+ }
389
+ if (!found)
390
+ {
391
+ asar_throw_error (0 , error_type_block, error_id_macro_param_not_found, generate_macro_arg_string (in, depth).raw (), generate_macro_hint_string (in, current_macro, depth).raw ());
384
392
}
385
393
}
386
- if (!found)
394
+ else
387
395
{
388
396
snes_label ret;
389
- if (valid_named_param && !current_macro->variadic )
390
- {
391
- if (proper_variadic) asar_throw_error (0 , error_type_block, error_id_invalid_vararg, in);
392
- else asar_throw_error (0 , error_type_block, error_id_macro_param_not_found, generate_macro_arg_string (in, depth).raw (), generate_macro_hint_string (in, current_macro, depth).raw ());
393
- }
394
- if (current_macro->variadic && valid_named_param && !labelval (in, &ret, false ))
395
- {
396
- if (proper_variadic) asar_throw_error (0 , error_type_block, error_id_invalid_vararg, in);
397
- else asar_throw_error (0 , error_type_block, error_id_macro_param_not_found, generate_macro_arg_string (in, depth).raw (), generate_macro_hint_string (in, current_macro, depth).raw ());
398
- }
399
- if (!proper_variadic) asar_throw_warning (0 , warning_id_feature_deprecated, " '<math>' syntax for variadic macro parameters" , " Use '<...[math]>' instead." );
397
+ if (valid_named_param && !labelval (in, &ret, false )) asar_throw_error (0 , error_type_block, error_id_invalid_vararg, in);
400
398
int arg_num = getnum (in);
401
399
402
400
if (forwardlabel) asar_throw_error (0 , error_type_block, error_id_label_forward);
@@ -406,7 +404,7 @@ string replace_macro_args(const char* line) {
406
404
out+=current_macro_args[arg_num+current_macro->numargs -1 ];
407
405
}
408
406
in=end+1 ;
409
- if (proper_variadic ) in++;
407
+ if (is_variadic_arg ) in++;
410
408
}
411
409
else out+=*(in++);
412
410
}
0 commit comments