diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-15 15:40:10 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-15 15:40:10 +0000 |
commit | 13f618f1ed08ebe182c3bf2e4948fd3be2a2be3d (patch) | |
tree | 4e9d7b92591cd0a37d795ec8b7b60c24a5786767 /variable.c | |
parent | ac9d6faafea77f24ce0de1d6c10c122cf6adb45a (diff) |
merge revision(s) 55005: [Backport #12382]
* 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/branches/ruby_2_3@55425 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 1f8506e784..1a18c379fd 100644 --- a/variable.c +++ b/variable.c @@ -2209,6 +2209,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) { @@ -2226,15 +2240,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; |