summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-31 20:44:56 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-31 20:44:56 +0000
commit1611735b293128f8638f68b21d66e34817eb8f86 (patch)
tree85258c0710cbdc203dd7135da8310d1858447f20 /vm_method.c
parent45458752d3f54ac81661d93aa55b8b5805f78138 (diff)
* 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
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/vm_method.c b/vm_method.c
index 7cdb783..2e8c5d7 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;
}