From d15e56dab03f2295dd1d9ecc2e22c6f0ce53e0e3 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 26 Dec 2019 19:27:14 +0900 Subject: Prohibit assignment to numbered parameters. It is stricter than CRuby but confusing anyway. --- mrbgems/mruby-compiler/core/parse.y | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mrbgems/mruby-compiler') diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 45c6229da..f8db486a5 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -1952,6 +1952,10 @@ lhs : variable backref_error(p, $1); $$ = 0; } + | tNUMPARAM + { + yyerror(p, "can't assign to numbered parameter"); + } ; cname : tIDENTIFIER @@ -3275,6 +3279,10 @@ var_lhs : variable { assignable(p, $1); } + | tNUMPARAM + { + yyerror(p, "can't assign to numbered parameter"); + } ; var_ref : variable -- cgit v1.2.3