summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-08-27 11:48:50 -0700
committerJeremy Evans <code@jeremyevans.net>2019-12-04 03:04:22 +0200
commit447d583536274a2489efc8792653ad35d6f7128a (patch)
treeb8ea510802a207813830d4df9d5b14e72b33ad3c /parse.y
parenta91637c516779d9ecee5f323e211f0ed71eb06ad (diff)
downloadruby-447d583536274a2489efc8792653ad35d6f7128a.tar.gz
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]
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y2
1 files changed, 2 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 15c9b419d7..3d762c2164 100644
--- a/parse.y
+++ b/parse.y
@@ -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