From aa9422e7b76e1134a30e02512ec9f52daa3253dc Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 31 May 2015 20:44:56 +0000 Subject: * eval_intern.h, vm_method.c: move macros to functions. * SCOPE_TEST(f) -> rb_frame_visibility_test(flag). * SCOPE_CHECK(f) -> rb_frame_visibility_check(flag). * SCOPE_SET(f) -> rb_frame_visibility_set(flag). * load.c (load_ext): use it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_method.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'vm_method.c') diff --git a/vm_method.c b/vm_method.c index 7cdb7836c0..2e8c5d721b 100644 --- a/vm_method.c +++ b/vm_method.c @@ -908,6 +908,24 @@ rb_method_boundp(VALUE klass, ID id, int ex) extern ID rb_check_attr_id(ID id); +static int +rb_frame_visibility_test(rb_method_flag_t flag) +{ + return CREF_VISI(rb_vm_cref()) & flag; +} + +static int +rb_frame_visibility_check(rb_method_flag_t flag) +{ + return CREF_VISI(rb_vm_cref()) == flag; +} + +void +rb_frame_visibility_set(rb_method_flag_t flag) +{ + CREF_VISI_SET(rb_vm_cref(), flag); +} + void rb_attr(VALUE klass, ID id, int read, int write, int ex) { @@ -919,13 +937,13 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex) noex = NOEX_PUBLIC; } else { - if (SCOPE_TEST(NOEX_PRIVATE)) { + if (rb_frame_visibility_test(NOEX_PRIVATE)) { noex = NOEX_PRIVATE; - if (SCOPE_CHECK(NOEX_MODFUNC)) { + if (rb_frame_visibility_check(NOEX_MODFUNC)) { rb_warning("attribute accessor as module_function"); } } - else if (SCOPE_TEST(NOEX_PROTECTED)) { + else if (rb_frame_visibility_test(NOEX_PROTECTED)) { noex = NOEX_PROTECTED; } else { @@ -1437,7 +1455,7 @@ static VALUE set_visibility(int argc, const VALUE *argv, VALUE module, rb_method_flag_t ex) { if (argc == 0) { - SCOPE_SET(ex); + rb_frame_visibility_set(ex); } else { set_method_visibility(module, argc, argv, ex); @@ -1638,7 +1656,7 @@ rb_mod_modfunc(int argc, VALUE *argv, VALUE module) } if (argc == 0) { - SCOPE_SET(NOEX_MODFUNC); + rb_frame_visibility_set(NOEX_MODFUNC); return module; } -- cgit v1.2.3