1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Silence incorrect assigned but unused variable warnings in ripper

To only emit the warnings in correct cases would require tracking
local variable usage in ripper, which ripper currently does not do.

Fixes [Bug #15188]
This commit is contained in:
Jeremy Evans 2019-08-27 11:48:50 -07:00
parent a91637c516
commit 447d583536
Notes: git 2019-12-04 10:04:51 +09:00

View file

@ -11723,11 +11723,13 @@ warn_unused_var(struct parser_params *p, struct local_vars *local)
if (cnt != local->vars->pos) {
rb_parser_fatal(p, "local->used->pos != local->vars->pos");
}
#ifndef RIPPER
for (i = 0; i < cnt; ++i) {
if (!v[i] || (u[i] & LVAR_USED)) continue;
if (is_private_local_id(v[i])) continue;
rb_warn1L((int)u[i], "assigned but unused variable - %"PRIsWARN, rb_id2str(v[i]));
}
#endif
}
static void