ruby-changes:59091
From: Yusuke <ko1@a...>
Date: Thu, 5 Dec 2019 20:50:41 +0900 (JST)
Subject: [ruby-changes:59091] 199bd851e4 (master): parse.y: suppress "set but not used" warnings on ripper.y
https://git.ruby-lang.org/ruby.git/commit/?id=199bd851e4 From 199bd851e40438380b2e0f57662a212200e3ba1a Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 5 Dec 2019 14:51:07 +0900 Subject: parse.y: suppress "set but not used" warnings on ripper.y diff --git a/parse.y b/parse.y index 3d762c2..7de84ee 100644 --- a/parse.y +++ b/parse.y @@ -11713,18 +11713,17 @@ new_bodystmt(struct parser_params *p, NODE *head, NODE *rescue, NODE *rescue_els https://github.com/ruby/ruby/blob/trunk/parse.y#L11713 static void warn_unused_var(struct parser_params *p, struct local_vars *local) { - int i, cnt; - ID *v, *u; + int cnt; if (!local->used) return; - v = local->vars->tbl; - u = local->used->tbl; cnt = local->used->pos; if (cnt != local->vars->pos) { rb_parser_fatal(p, "local->used->pos != local->vars->pos"); } #ifndef RIPPER - for (i = 0; i < cnt; ++i) { + ID *v = local->vars->tbl; + ID *u = local->used->tbl; + for (int 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])); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/