1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* method.h: constify rb_cref_t::scope_visi;

* eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix.

* vm_method.c: ditto.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2015-11-13 17:20:11 +00:00
parent 6687b34876
commit dd4cec36ca
4 changed files with 20 additions and 8 deletions

View file

@ -1,3 +1,11 @@
Sat Nov 14 02:19:16 2015 Koichi Sasada <ko1@atdot.net>
* method.h: constify rb_cref_t::scope_visi;
* eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix.
* vm_method.c: ditto.
Sat Nov 14 01:53:52 2015 Naohisa Goto <ngotogenome@gmail.com> Sat Nov 14 01:53:52 2015 Naohisa Goto <ngotogenome@gmail.com>
* pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for * pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for

View file

@ -216,7 +216,7 @@ static inline void
CREF_SCOPE_VISI_COPY(rb_cref_t *dst_cref, const rb_cref_t *src_cref) CREF_SCOPE_VISI_COPY(rb_cref_t *dst_cref, const rb_cref_t *src_cref)
{ {
const rb_scope_visibility_t *src = &src_cref->scope_visi; const rb_scope_visibility_t *src = &src_cref->scope_visi;
rb_scope_visibility_t *dst = &dst_cref->scope_visi; rb_scope_visibility_t *dst = (rb_scope_visibility_t *)&dst_cref->scope_visi; /* OK for const cast */
dst->method_visi = src->method_visi; dst->method_visi = src->method_visi;
dst->module_func = src->module_func; dst->module_func = src->module_func;

View file

@ -42,7 +42,7 @@ typedef struct rb_cref_struct {
const VALUE refinements; const VALUE refinements;
const VALUE klass; const VALUE klass;
struct rb_cref_struct * const next; struct rb_cref_struct * const next;
rb_scope_visibility_t scope_visi; const rb_scope_visibility_t scope_visi;
} rb_cref_t; } rb_cref_t;
/* method data type */ /* method data type */

View file

@ -1048,20 +1048,24 @@ rb_scope_module_func_check(void)
return CREF_SCOPE_VISI(rb_vm_cref())->module_func; return CREF_SCOPE_VISI(rb_vm_cref())->module_func;
} }
static void
vm_cref_set_visibility(rb_method_visibility_t method_visi, int module_func)
{
rb_scope_visibility_t *scope_visi = (rb_scope_visibility_t *)&rb_vm_cref()->scope_visi;
scope_visi->method_visi = method_visi;
scope_visi->module_func = module_func;
}
void void
rb_scope_visibility_set(rb_method_visibility_t visi) rb_scope_visibility_set(rb_method_visibility_t visi)
{ {
rb_scope_visibility_t *scope_visi = &rb_vm_cref()->scope_visi; vm_cref_set_visibility(visi, FALSE);
scope_visi->method_visi = visi;
scope_visi->module_func = FALSE;
} }
static void static void
rb_scope_module_func_set(void) rb_scope_module_func_set(void)
{ {
rb_scope_visibility_t *scope_visi = &rb_vm_cref()->scope_visi; vm_cref_set_visibility(METHOD_VISI_PRIVATE, TRUE);
scope_visi->method_visi = METHOD_VISI_PRIVATE;
scope_visi->module_func = TRUE;
} }
void void