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

ruby-changes:56597

From: Nobuyoshi <ko1@a...>
Date: Fri, 19 Jul 2019 07:58:11 +0900 (JST)
Subject: [ruby-changes:56597] Nobuyoshi Nakada: fd461dea06 (master): Ripper#validate_object: check if the object is hidden

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

From fd461dea06b1a56eca9d1c662c3dc0c416c9e495 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 19 Jul 2019 07:55:40 +0900
Subject: Ripper#validate_object: check if the object is hidden


diff --git a/parse.y b/parse.y
index 315c09f..46c263f 100644
--- a/parse.y
+++ b/parse.y
@@ -12487,7 +12487,7 @@ ripper_validate_object(VALUE self, VALUE x) https://github.com/ruby/ruby/blob/trunk/parse.y#L12487
     if (x == Qtrue) return x;
     if (x == Qnil) return x;
     if (x == Qundef)
-        rb_raise(rb_eArgError, "Qundef given");
+	rb_raise(rb_eArgError, "Qundef given");
     if (FIXNUM_P(x)) return x;
     if (SYMBOL_P(x)) return x;
     switch (BUILTIN_TYPE(x)) {
@@ -12498,15 +12498,20 @@ ripper_validate_object(VALUE self, VALUE x) https://github.com/ruby/ruby/blob/trunk/parse.y#L12498
       case T_FLOAT:
       case T_COMPLEX:
       case T_RATIONAL:
-        return x;
+	break;
       case T_NODE:
 	if (nd_type((NODE *)x) != NODE_RIPPER) {
 	    rb_raise(rb_eArgError, "NODE given: %p", (void *)x);
 	}
-	return ((NODE *)x)->nd_rval;
+	x = ((NODE *)x)->nd_rval;
+	break;
       default:
-        rb_raise(rb_eArgError, "wrong type of ruby object: %p (%s)",
-                 (void *)x, rb_obj_classname(x));
+	rb_raise(rb_eArgError, "wrong type of ruby object: %p (%s)",
+		 (void *)x, rb_obj_classname(x));
+    }
+    if (!RBASIC_CLASS(x)) {
+	rb_raise(rb_eArgError, "hidden ruby object: %p (%s)",
+		 (void *)x, rb_builtin_type_name(TYPE(x)));
     }
     return x;
 }
-- 
cgit v0.10.2


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

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