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

ruby-changes:60087

From: Nobuyoshi <ko1@a...>
Date: Sun, 16 Feb 2020 14:13:50 +0900 (JST)
Subject: [ruby-changes:60087] 0bfa479c52 (master): Split the optimizable range item conditions

https://git.ruby-lang.org/ruby.git/commit/?id=0bfa479c52

From 0bfa479c52963b95a47ceab3d453f21b646366a2 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 16 Feb 2020 13:47:18 +0900
Subject: Split the optimizable range item conditions


diff --git a/compile.c b/compile.c
index 5800a6e..ace7a46 100644
--- a/compile.c
+++ b/compile.c
@@ -5180,7 +5180,15 @@ compile_named_capture_assign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE https://github.com/ruby/ruby/blob/trunk/compile.c#L5180
 static int
 optimizable_range_item_p(const NODE *n)
 {
-    return (n && nd_type(n) == NODE_LIT && RB_INTEGER_TYPE_P(n->nd_lit)) || (n && nd_type(n) == NODE_NIL);
+    if (!n) return FALSE;
+    switch (nd_type(n)) {
+      case NODE_LIT:
+        return RB_INTEGER_TYPE_P(n->nd_lit);
+      case NODE_NIL:
+        return TRUE;
+      default:
+        return FALSE;
+    }
 }
 
 static int
-- 
cgit v0.10.2


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

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