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

ruby-changes:33619

From: nobu <ko1@a...>
Date: Thu, 24 Apr 2014 11:21:43 +0900 (JST)
Subject: [ruby-changes:33619] nobu:r45700 (trunk): parse.y: check for symbol

nobu	2014-04-24 11:21:38 +0900 (Thu, 24 Apr 2014)

  New Revision: 45700

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

  Log:
    parse.y: check for symbol
    
    * parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for
      non-symbol values, for the time being.

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45699)
+++ ChangeLog	(revision 45700)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Apr 24 11:21:37 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for
+	  non-symbol values, for the time being.
+
 Thu Apr 24 05:50:13 2014  NARUSE, Yui  <naruse@r...>
 
 	* parse.y (dsym_node_gen): like r45492, call rb_gc_resurrect().
Index: parse.y
===================================================================
--- parse.y	(revision 45699)
+++ parse.y	(revision 45700)
@@ -10774,9 +10774,12 @@ rb_sym2id(VALUE x) https://github.com/ruby/ruby/blob/trunk/parse.y#L10774
     if (STATIC_SYM_P(x)) {
 	return RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT);
     }
-    else {
+    else if (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) == T_SYMBOL) {
 	return rb_pin_dynamic_symbol(x);
     }
+    else {
+	return 0;
+    }
 }
 
 ID
@@ -10785,9 +10788,12 @@ rb_sym2id_without_pindown(VALUE x) https://github.com/ruby/ruby/blob/trunk/parse.y#L10788
     if (STATIC_SYM_P(x)) {
 	return RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT);
     }
-    else {
+    else if (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) == T_SYMBOL) {
 	return (ID)x;
     }
+    else {
+	return 0;
+    }
 }
 
 VALUE

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

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