summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-10 21:32:02 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-10 21:32:02 +0000
commitc0cdff2c0fe1fdf841e673b0dcd14b43c9da3ac2 (patch)
tree4fe12e9135ea9fe05cb05d48fd0d2e409892653d /variable.c
parentd14b60fff0cc5d10b4573172d343411035e01ead (diff)
Revert r34538.
* backport 33935,33936,33987 (fix private constant) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/variable.c b/variable.c
index 03bc6b95d6..ed6f3debd9 100644
--- a/variable.c
+++ b/variable.c
@@ -1952,22 +1952,13 @@ set_const_visibility(VALUE mod, int argc, VALUE *argv, rb_const_flag_t flag)
"Insecure: can't change constant visibility");
}
- if (argc == 0) {
- rb_warning("%s with no argument is just ignored", rb_id2name(rb_frame_callee()));
- }
-
for (i = 0; i < argc; i++) {
- VALUE val = argv[i];
- id = rb_to_id(&val);
- if (RCLASS_CONST_TBL(mod) &&
- st_lookup(RCLASS_CONST_TBL(mod), (st_data_t)id, &v)) {
+ id = rb_to_id(argv[i]);
+ if (RCLASS_CONST_TBL(mod) && st_lookup(RCLASS_CONST_TBL(mod), (st_data_t)id, &v)) {
((rb_const_entry_t*)v)->flag = flag;
+ return;
}
- else {
- if ( i > 0 )
- rb_clear_cache_by_class(mod);
- rb_name_error(id, "constant %s::%s not defined", rb_class2name(mod), rb_id2name(id));
- }
+ rb_name_error(id, "constant %s::%s not defined", rb_class2name(mod), rb_id2name(id));
}
rb_clear_cache_by_class(mod);
}