diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-12-24 07:41:37 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-12-24 07:41:37 +0900 |
| commit | 39191cd9fadfea4940298cbcac2533597f76aa71 (patch) | |
| tree | f7d6aa6f4f01960c3f465d0fcc31108f9e849450 /mrbgems/mruby-compiler/core/parse.y | |
| parent | 3b59c95ead70a779c6894f9975228f0443ad488d (diff) | |
| download | mruby-39191cd9fadfea4940298cbcac2533597f76aa71.tar.gz mruby-39191cd9fadfea4940298cbcac2533597f76aa71.zip | |
parse.y: allow arguments start with `_` to appear multiple times; fix #5604
Diffstat (limited to 'mrbgems/mruby-compiler/core/parse.y')
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index d5778279f..2a8d3a060 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -302,8 +302,12 @@ local_add_f(parser_state *p, mrb_sym sym) node *n = p->locals->car; while (n) { if (sym(n->car) == sym) { - yyerror(p, "duplicated argument name"); - return; + mrb_int len; + const char* name = mrb_sym_name_len(p->mrb, sym, &len); + if (len > 0 && name[0] != '_') { + yyerror(p, "duplicated argument name"); + return; + } } n = n->cdr; } |
