diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-15 01:57:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-15 01:57:28 +0000 |
commit | 5cb5692ac8758420ddb7b5bdae337f2338d91b26 (patch) | |
tree | 5c8e1ef5ecb2b18d112ae5992f59470b0a2e116e /variable.c | |
parent | 6d4fb98e59e74bb23329314482ef8012bf90aa92 (diff) | |
download | ruby-5cb5692ac8758420ddb7b5bdae337f2338d91b26.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.c | 24 |
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; |