diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-29 13:56:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-29 13:56:33 +0000 |
commit | 771c8ed338ac77d3f75acf44cd711f80c80cbe71 (patch) | |
tree | 3849c4cb7589d00a49ccbe4e6d36e77e3390ed26 /ext | |
parent | 3dab183c8276c6d53c9ac4404967b18f4c10d166 (diff) | |
download | ruby-771c8ed338ac77d3f75acf44cd711f80c80cbe71.tar.gz |
parse.y: fix inconsistency with literals
* parse.y (rb_id_attrset): fix inconsistency with literals, allow
ID_ATTRSET and return it itself, but ID_JUNK cannot make ID_ATTRSET.
and raise a NameError instead of rb_bug() for invalid argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/-test-/symbol/type.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/-test-/symbol/type.c b/ext/-test-/symbol/type.c index 37406d3853..e0b2fff2f9 100644 --- a/ext/-test-/symbol/type.c +++ b/ext/-test-/symbol/type.c @@ -27,8 +27,17 @@ bug_sym_##type##_p(VALUE self, VALUE name) \ FOREACH_ID_TYPES(define_symbol_type_p) +static VALUE +bug_sym_attrset(VALUE self, VALUE name) +{ + ID id = rb_to_id(name); + id = rb_id_attrset(id); + return ID2SYM(id); +} + void Init_type(VALUE klass) { - FOREACH_ID_TYPES(declare_symbol_type_p) + FOREACH_ID_TYPES(declare_symbol_type_p); + rb_define_singleton_method(klass, "attrset", bug_sym_attrset, 1); } |