diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-22 11:31:13 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-22 11:31:13 +0000 |
commit | f3b132faac3a6a777fb624b1a4c7bcb95c3eb625 (patch) | |
tree | 96da08d54bd2605c76160109382ee6d18fd7d06c /object.c | |
parent | 7815cbd7d0699ab0b9e50998882b7981acca8e07 (diff) | |
download | ruby-f3b132faac3a6a777fb624b1a4c7bcb95c3eb625.tar.gz |
object.c: no nested symbol
* object.c (rb_mod_const_get): symbol cannot be nested constant name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1901,6 +1901,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) rb_encoding *enc; const char *pbeg, *p, *path, *pend; ID id; + int nestable = 1; if (argc == 1) { name = argv[0]; @@ -1912,6 +1913,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) if (SYMBOL_P(name)) { name = rb_sym_to_s(name); + nestable = 0; } name = rb_check_string_type(name); @@ -1933,6 +1935,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) } if (p + 2 < pend && p[0] == ':' && p[1] == ':') { + if (!nestable) goto wrong_name; mod = rb_cObject; p += 2; pbeg = p; @@ -1949,6 +1952,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) id = rb_check_id_cstr(pbeg, len = p-pbeg, enc); if (p < pend && p[0] == ':') { + if (!nestable) goto wrong_name; if (p + 2 >= pend || p[1] != ':') goto wrong_name; p += 2; pbeg = p; |