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

ruby-changes:30400

From: nobu <ko1@a...>
Date: Sat, 10 Aug 2013 09:12:13 +0900 (JST)
Subject: [ruby-changes:30400] nobu:r42479 (trunk): parse.y: check for attr

nobu	2013-08-10 09:12:05 +0900 (Sat, 10 Aug 2013)

  New Revision: 42479

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42479

  Log:
    parse.y: check for attr
    
    * parse.y (rb_id_attrset): check if the argument is valid type as an
      attribute.

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42478)
+++ ChangeLog	(revision 42479)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Aug 10 09:12:01 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (rb_id_attrset): check if the argument is valid type as an
+	  attribute.
+
 Sat Aug 10 05:44:08 2013  Zachary Scott  <e@z...>
 
 	* lib/rss/trackback.rb: [DOC] Hide RSS::Trackback from rdoc
Index: parse.y
===================================================================
--- parse.y	(revision 42478)
+++ parse.y	(revision 42479)
@@ -8766,9 +8766,31 @@ block_dup_check_gen(struct parser_params https://github.com/ruby/ruby/blob/trunk/parse.y#L8766
     }
 }
 
+static const char id_type_names[][9] = {
+    "LOCAL",
+    "INSTANCE",
+    "",				/* INSTANCE2 */
+    "GLOBAL",
+    "ATTRSET",
+    "CONST",
+    "CLASS",
+    "JUNK",
+};
+
 ID
 rb_id_attrset(ID id)
 {
+    if (!is_notop_id(id)) {
+	rb_bug("rb_id_attrset: operator ID - %"PRIdVALUE, (VALUE)id);
+    }
+    else {
+	int scope = (int)(id & ID_SCOPE_MASK);
+	if (scope != ID_LOCAL && scope != ID_CONST) {
+	    rb_bug("rb_id_attrset: %s ID - %"PRIdVALUE, id_type_names[scope],
+		   (VALUE)id);
+
+	}
+    }
     id &= ~ID_SCOPE_MASK;
     id |= ID_ATTRSET;
     return id;

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

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