* eval.c (rb_mod_refine, mod_using, top_using): don't show
warnings because Refinements are no longer experimental. [ruby-core:55993] [Feature #8632] * test/ruby/test_refinement.rb: related test. * NEWS: fixes for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b30a172385
commit
1c7f9073b0
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Wed Jul 31 18:24:02 2013 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_mod_refine, mod_using, top_using): don't show
|
||||||
|
warnings because Refinements are no longer experimental.
|
||||||
|
[ruby-core:55993] [Feature #8632]
|
||||||
|
|
||||||
|
* test/ruby/test_refinement.rb: related test.
|
||||||
|
|
||||||
|
* NEWS: fixes for the above change.
|
||||||
|
|
||||||
Wed Jul 31 17:55:55 2013 Shota Fukumori <her@sorah.jp>
|
Wed Jul 31 17:55:55 2013 Shota Fukumori <her@sorah.jp>
|
||||||
|
|
||||||
* lib/uri/common.rb (URI.decode_www_form_component):
|
* lib/uri/common.rb (URI.decode_www_form_component):
|
||||||
|
7
NEWS
7
NEWS
@ -30,6 +30,8 @@ with all sufficient information, see the ChangeLog file.
|
|||||||
* New methods:
|
* New methods:
|
||||||
* Module#using, which activates refinements of the specified module only
|
* Module#using, which activates refinements of the specified module only
|
||||||
in the current class or module definition.
|
in the current class or module definition.
|
||||||
|
* extended methods:
|
||||||
|
* Module#refine is no longer experimental.
|
||||||
|
|
||||||
* Mutex
|
* Mutex
|
||||||
* misc
|
* misc
|
||||||
@ -48,8 +50,9 @@ with all sufficient information, see the ChangeLog file.
|
|||||||
|
|
||||||
* toplevel
|
* toplevel
|
||||||
* extended methods:
|
* extended methods:
|
||||||
* main.using activates refinements in the ancestors of the argument
|
* main.using is no longer experimental. The method activates refinements
|
||||||
module to support refinement inheritance by Module#include.
|
in the ancestors of the argument module to support refinement
|
||||||
|
inheritance by Module#include.
|
||||||
|
|
||||||
=== Core classes compatibility issues (excluding feature bug fixes)
|
=== Core classes compatibility issues (excluding feature bug fixes)
|
||||||
|
|
||||||
|
14
eval.c
14
eval.c
@ -1046,17 +1046,6 @@ rb_mod_prepend(int argc, VALUE *argv, VALUE module)
|
|||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
warn_refinements_once()
|
|
||||||
{
|
|
||||||
static int warned = 0;
|
|
||||||
|
|
||||||
if (warned)
|
|
||||||
return;
|
|
||||||
rb_warn("Refinements are experimental, and the behavior may change in future versions of Ruby!");
|
|
||||||
warned = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
hidden_identity_hash_new()
|
hidden_identity_hash_new()
|
||||||
{
|
{
|
||||||
@ -1213,7 +1202,6 @@ rb_mod_refine(VALUE module, VALUE klass)
|
|||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_block_t *block = rb_vm_control_frame_block_ptr(th->cfp);
|
rb_block_t *block = rb_vm_control_frame_block_ptr(th->cfp);
|
||||||
|
|
||||||
warn_refinements_once();
|
|
||||||
if (!block) {
|
if (!block) {
|
||||||
rb_raise(rb_eArgError, "no block given");
|
rb_raise(rb_eArgError, "no block given");
|
||||||
}
|
}
|
||||||
@ -1265,7 +1253,6 @@ mod_using(VALUE self, VALUE module)
|
|||||||
NODE *cref = rb_vm_cref();
|
NODE *cref = rb_vm_cref();
|
||||||
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
|
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
|
||||||
|
|
||||||
warn_refinements_once();
|
|
||||||
if (prev_frame_func()) {
|
if (prev_frame_func()) {
|
||||||
rb_raise(rb_eRuntimeError,
|
rb_raise(rb_eRuntimeError,
|
||||||
"Module#using is not permitted in methods");
|
"Module#using is not permitted in methods");
|
||||||
@ -1405,7 +1392,6 @@ top_using(VALUE self, VALUE module)
|
|||||||
NODE *cref = rb_vm_cref();
|
NODE *cref = rb_vm_cref();
|
||||||
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
|
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
|
||||||
|
|
||||||
warn_refinements_once();
|
|
||||||
if (cref->nd_next || (prev_cfp && prev_cfp->me)) {
|
if (cref->nd_next || (prev_cfp && prev_cfp->me)) {
|
||||||
rb_raise(rb_eRuntimeError,
|
rb_raise(rb_eRuntimeError,
|
||||||
"main.using is permitted only at toplevel");
|
"main.using is permitted only at toplevel");
|
||||||
|
@ -395,7 +395,7 @@ class TestRefinement < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_main_using
|
def test_main_using
|
||||||
assert_in_out_err([], <<-INPUT, %w(:C :M), /Refinements are experimental/)
|
assert_in_out_err([], <<-INPUT, %w(:C :M), [])
|
||||||
class C
|
class C
|
||||||
def foo
|
def foo
|
||||||
:C
|
:C
|
||||||
@ -461,7 +461,7 @@ class TestRefinement < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_using_method_cache
|
def test_using_method_cache
|
||||||
assert_in_out_err([], <<-INPUT, %w(:M1 :M2), /Refinements are experimental/)
|
assert_in_out_err([], <<-INPUT, %w(:M1 :M2), [])
|
||||||
class C
|
class C
|
||||||
def foo
|
def foo
|
||||||
"original"
|
"original"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user