mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Manage deprecation warnings about keyword argument
This commit is contained in:
parent
9bf9de3d9d
commit
7aa8a78674
2 changed files with 5 additions and 0 deletions
|
@ -1160,6 +1160,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
||||||
|
|
||||||
def capture_warning_warn
|
def capture_warning_warn
|
||||||
verbose = $VERBOSE
|
verbose = $VERBOSE
|
||||||
|
deprecated = Warning[:deprecated]
|
||||||
warning = []
|
warning = []
|
||||||
|
|
||||||
::Warning.class_eval do
|
::Warning.class_eval do
|
||||||
|
@ -1172,11 +1173,13 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
||||||
end
|
end
|
||||||
|
|
||||||
$VERBOSE = true
|
$VERBOSE = true
|
||||||
|
Warning[:deprecated] = true
|
||||||
yield
|
yield
|
||||||
|
|
||||||
return warning
|
return warning
|
||||||
ensure
|
ensure
|
||||||
$VERBOSE = verbose
|
$VERBOSE = verbose
|
||||||
|
Warning[:deprecated] = deprecated
|
||||||
|
|
||||||
::Warning.class_eval do
|
::Warning.class_eval do
|
||||||
remove_method :warn
|
remove_method :warn
|
||||||
|
|
|
@ -597,6 +597,8 @@ static st_table *caller_to_callees = 0;
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_warn_check(const rb_execution_context_t * const ec, const rb_iseq_t *const iseq)
|
rb_warn_check(const rb_execution_context_t * const ec, const rb_iseq_t *const iseq)
|
||||||
{
|
{
|
||||||
|
if (!rb_warning_category_enabled_p(RB_WARN_CATEGORY_DEPRECATED)) return 1;
|
||||||
|
|
||||||
if (!iseq) return 0;
|
if (!iseq) return 0;
|
||||||
|
|
||||||
const st_data_t callee = (st_data_t)(iseq->body->iseq_unique_id * 2);
|
const st_data_t callee = (st_data_t)(iseq->body->iseq_unique_id * 2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue