[前][次][番号順一覧][スレッド一覧]

ruby-changes:59060

From: Jeremy <ko1@a...>
Date: Wed, 4 Dec 2019 10:04:48 +0900 (JST)
Subject: [ruby-changes:59060] 447d583536 (master): Silence incorrect assigned but unused variable warnings in ripper

https://git.ruby-lang.org/ruby.git/commit/?id=447d583536

From 447d583536274a2489efc8792653ad35d6f7128a Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Tue, 27 Aug 2019 11:48:50 -0700
Subject: 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]

diff --git a/parse.y b/parse.y
index 15c9b41..3d762c2 100644
--- a/parse.y
+++ b/parse.y
@@ -11723,11 +11723,13 @@ warn_unused_var(struct parser_params *p, struct local_vars *local) https://github.com/ruby/ruby/blob/trunk/parse.y#L11723
     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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]