aboutsummaryrefslogtreecommitdiffstats
path: root/variable.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-15 01:57:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-15 01:57:28 +0000
commit4e2d5e645af563b3a2fbaea7ecdb2cb1150cc834 (patch)
tree5c8e1ef5ecb2b18d112ae5992f59470b0a2e116e /variable.c
parent1e30933a132ad22f5d0aaaedf5b0d0e57216eae8 (diff)
downloadruby-4e2d5e645af563b3a2fbaea7ecdb2cb1150cc834.tar.gz
vm_insnhelper.c: deprecated constant in class
* vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even in the class context. [ruby-core:75505] [Bug #12382] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/variable.c b/variable.c
index 9c3ce2d182..db26268cfa 100644
--- a/variable.c
+++ b/variable.c
@@ -2221,6 +2221,20 @@ rb_autoload_p(VALUE mod, ID id)
return (ele = check_autoload_data(load)) ? ele->feature : Qnil;
}
+void
+rb_const_warn_if_deprecated(const rb_const_entry_t *ce, VALUE klass, ID id)
+{
+ if (RB_CONST_DEPRECATED_P(ce)) {
+ if (klass == rb_cObject) {
+ rb_warn("constant ::%"PRIsVALUE" is deprecated", QUOTE_ID(id));
+ }
+ else {
+ rb_warn("constant %"PRIsVALUE"::%"PRIsVALUE" is deprecated",
+ rb_class_name(klass), QUOTE_ID(id));
+ }
+ }
+}
+
static VALUE
rb_const_get_0(VALUE klass, ID id, int exclude, int recurse, int visibility)
{
@@ -2238,15 +2252,7 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse, int visibility)
rb_name_err_raise("private constant %2$s::%1$s referenced",
klass, ID2SYM(id));
}
- if (RB_CONST_DEPRECATED_P(ce)) {
- if (klass == rb_cObject) {
- rb_warn("constant ::%"PRIsVALUE" is deprecated", QUOTE_ID(id));
- }
- else {
- rb_warn("constant %"PRIsVALUE"::%"PRIsVALUE" is deprecated",
- rb_class_name(klass), QUOTE_ID(id));
- }
- }
+ rb_const_warn_if_deprecated(ce, klass, id);
value = ce->value;
if (value == Qundef) {
if (am == tmp) break;