* expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2b5bb8a087
commit
4b53f84326
10
compile.c
10
compile.c
@ -7144,29 +7144,29 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
|
|||||||
case NODE_DEFN:{
|
case NODE_DEFN:{
|
||||||
ID mid = node->nd_mid;
|
ID mid = node->nd_mid;
|
||||||
const rb_iseq_t *method_iseq = NEW_ISEQ(node->nd_defn,
|
const rb_iseq_t *method_iseq = NEW_ISEQ(node->nd_defn,
|
||||||
rb_id2str(mid),
|
rb_id2str(mid),
|
||||||
ISEQ_TYPE_METHOD, line);
|
ISEQ_TYPE_METHOD, line);
|
||||||
|
|
||||||
debugp_param("defn/iseq", rb_iseqw_new(method_iseq));
|
debugp_param("defn/iseq", rb_iseqw_new(method_iseq));
|
||||||
ADD_INSN2(ret, line, definemethod, ID2SYM(mid), method_iseq);
|
ADD_INSN2(ret, line, definemethod, ID2SYM(mid), method_iseq);
|
||||||
|
|
||||||
if (!popped) {
|
if (!popped) {
|
||||||
ADD_INSN1(ret, line, putobject, ID2SYM(mid));
|
ADD_INSN1(ret, line, putobject, ID2SYM(mid));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NODE_DEFS:{
|
case NODE_DEFS:{
|
||||||
ID mid = node->nd_mid;
|
ID mid = node->nd_mid;
|
||||||
const rb_iseq_t * singleton_method_iseq = NEW_ISEQ(node->nd_defn,
|
const rb_iseq_t * singleton_method_iseq = NEW_ISEQ(node->nd_defn,
|
||||||
rb_id2str(mid),
|
rb_id2str(mid),
|
||||||
ISEQ_TYPE_METHOD, line);
|
ISEQ_TYPE_METHOD, line);
|
||||||
|
|
||||||
debugp_param("defs/iseq", rb_iseqw_new(singleton_method_iseq));
|
debugp_param("defs/iseq", rb_iseqw_new(singleton_method_iseq));
|
||||||
CHECK(COMPILE(ret, "defs: recv", node->nd_recv));
|
CHECK(COMPILE(ret, "defs: recv", node->nd_recv));
|
||||||
ADD_INSN2(ret, line, definesmethod, ID2SYM(mid), singleton_method_iseq);
|
ADD_INSN2(ret, line, definesmethod, ID2SYM(mid), singleton_method_iseq);
|
||||||
|
|
||||||
if (!popped) {
|
if (!popped) {
|
||||||
ADD_INSN1(ret, line, putobject, ID2SYM(mid));
|
ADD_INSN1(ret, line, putobject, ID2SYM(mid));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1322,7 +1322,7 @@ eval_string_with_cref(VALUE self, VALUE src, rb_cref_t *cref, VALUE file, int li
|
|||||||
|
|
||||||
/* TODO: what the code checking? */
|
/* TODO: what the code checking? */
|
||||||
if (!cref && block.as.captured.code.val) {
|
if (!cref && block.as.captured.code.val) {
|
||||||
rb_cref_t *orig_cref = vm_get_cref(vm_block_ep(&block));
|
rb_cref_t *orig_cref = vm_get_cref(vm_block_ep(&block));
|
||||||
cref = vm_cref_dup(orig_cref);
|
cref = vm_cref_dup(orig_cref);
|
||||||
}
|
}
|
||||||
vm_set_eval_stack(ec, iseq, cref, &block);
|
vm_set_eval_stack(ec, iseq, cref, &block);
|
||||||
|
@ -773,7 +773,7 @@ vm_get_cref(const VALUE *ep)
|
|||||||
return cref;
|
return cref;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_bug("vm_get_cref: unreachable");
|
rb_bug("vm_get_cref: unreachable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,7 +906,7 @@ vm_get_ev_const(rb_execution_context_t *ec, VALUE orig_klass, ID id, int is_defi
|
|||||||
|
|
||||||
if (orig_klass == Qnil) {
|
if (orig_klass == Qnil) {
|
||||||
/* in current lexical scope */
|
/* in current lexical scope */
|
||||||
const rb_cref_t *root_cref = vm_get_cref(ec->cfp->ep);
|
const rb_cref_t *root_cref = vm_get_cref(ec->cfp->ep);
|
||||||
const rb_cref_t *cref;
|
const rb_cref_t *cref;
|
||||||
VALUE klass = Qnil;
|
VALUE klass = Qnil;
|
||||||
|
|
||||||
@ -2610,7 +2610,7 @@ vm_call_method_each_type(rb_execution_context_t *ec, rb_control_frame_t *cfp, st
|
|||||||
return vm_call_zsuper(ec, cfp, calling, ci, cc, RCLASS_ORIGIN(cc->me->defined_class));
|
return vm_call_zsuper(ec, cfp, calling, ci, cc, RCLASS_ORIGIN(cc->me->defined_class));
|
||||||
|
|
||||||
case VM_METHOD_TYPE_REFINED: {
|
case VM_METHOD_TYPE_REFINED: {
|
||||||
const rb_cref_t *cref = vm_get_cref(cfp->ep);
|
const rb_cref_t *cref = vm_get_cref(cfp->ep);
|
||||||
VALUE refinements = cref ? CREF_REFINEMENTS(cref) : Qnil;
|
VALUE refinements = cref ? CREF_REFINEMENTS(cref) : Qnil;
|
||||||
VALUE refinement;
|
VALUE refinement;
|
||||||
const rb_callable_method_entry_t *ref_me;
|
const rb_callable_method_entry_t *ref_me;
|
||||||
@ -3141,7 +3141,7 @@ vm_defined(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, rb_num_t op_
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DEFINED_CVAR: {
|
case DEFINED_CVAR: {
|
||||||
const rb_cref_t *cref = vm_get_cref(GET_EP());
|
const rb_cref_t *cref = vm_get_cref(GET_EP());
|
||||||
klass = vm_get_cvar_base(cref, GET_CFP());
|
klass = vm_get_cvar_base(cref, GET_CFP());
|
||||||
if (rb_cvar_defined(klass, SYM2ID(obj))) {
|
if (rb_cvar_defined(klass, SYM2ID(obj))) {
|
||||||
expr_type = DEFINED_CVAR;
|
expr_type = DEFINED_CVAR;
|
||||||
@ -3510,10 +3510,10 @@ vm_scope_visibility_get(const rb_execution_context_t *ec)
|
|||||||
const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp);
|
const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp);
|
||||||
|
|
||||||
if (!vm_env_cref_by_cref(cfp->ep)) {
|
if (!vm_env_cref_by_cref(cfp->ep)) {
|
||||||
return METHOD_VISI_PUBLIC;
|
return METHOD_VISI_PUBLIC;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return CREF_SCOPE_VISI(vm_ec_cref(ec))->method_visi;
|
return CREF_SCOPE_VISI(vm_ec_cref(ec))->method_visi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3523,10 +3523,10 @@ vm_scope_module_func_check(const rb_execution_context_t *ec)
|
|||||||
const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp);
|
const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp);
|
||||||
|
|
||||||
if (!vm_env_cref_by_cref(cfp->ep)) {
|
if (!vm_env_cref_by_cref(cfp->ep)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return CREF_SCOPE_VISI(vm_ec_cref(ec))->module_func;
|
return CREF_SCOPE_VISI(vm_ec_cref(ec))->module_func;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3538,23 +3538,23 @@ vm_define_method(const rb_execution_context_t *ec, VALUE obj, ID id, VALUE iseqv
|
|||||||
rb_cref_t *cref = vm_ec_cref(ec);
|
rb_cref_t *cref = vm_ec_cref(ec);
|
||||||
|
|
||||||
if (!is_singleton) {
|
if (!is_singleton) {
|
||||||
klass = CREF_CLASS(cref);
|
klass = CREF_CLASS(cref);
|
||||||
visi = vm_scope_visibility_get(ec);
|
visi = vm_scope_visibility_get(ec);
|
||||||
}
|
}
|
||||||
else { /* singleton */
|
else { /* singleton */
|
||||||
klass = rb_singleton_class(obj); /* class and frozen checked in this API */
|
klass = rb_singleton_class(obj); /* class and frozen checked in this API */
|
||||||
visi = METHOD_VISI_PUBLIC;
|
visi = METHOD_VISI_PUBLIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NIL_P(klass)) {
|
if (NIL_P(klass)) {
|
||||||
rb_raise(rb_eTypeError, "no class/module to add method");
|
rb_raise(rb_eTypeError, "no class/module to add method");
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_add_method_iseq(klass, id, (const rb_iseq_t *)iseqval, cref, visi);
|
rb_add_method_iseq(klass, id, (const rb_iseq_t *)iseqval, cref, visi);
|
||||||
|
|
||||||
if (!is_singleton && vm_scope_module_func_check(ec)) {
|
if (!is_singleton && vm_scope_module_func_check(ec)) {
|
||||||
klass = rb_singleton_class(klass);
|
klass = rb_singleton_class(klass);
|
||||||
rb_add_method_iseq(klass, id, (const rb_iseq_t *)iseqval, cref, METHOD_VISI_PUBLIC);
|
rb_add_method_iseq(klass, id, (const rb_iseq_t *)iseqval, cref, METHOD_VISI_PUBLIC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3727,7 +3727,7 @@ static int
|
|||||||
vm_ic_hit_p(IC ic, const VALUE *reg_ep)
|
vm_ic_hit_p(IC ic, const VALUE *reg_ep)
|
||||||
{
|
{
|
||||||
if (ic->ic_serial == GET_GLOBAL_CONSTANT_STATE()) {
|
if (ic->ic_serial == GET_GLOBAL_CONSTANT_STATE()) {
|
||||||
return (ic->ic_cref == NULL || ic->ic_cref == vm_get_cref(reg_ep));
|
return (ic->ic_cref == NULL || ic->ic_cref == vm_get_cref(reg_ep));
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1148,9 +1148,9 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex)
|
|||||||
visi = METHOD_VISI_PUBLIC;
|
visi = METHOD_VISI_PUBLIC;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (vm_scope_visibility_get(ec)) {
|
switch (vm_scope_visibility_get(ec)) {
|
||||||
case METHOD_VISI_PRIVATE:
|
case METHOD_VISI_PRIVATE:
|
||||||
if (vm_scope_module_func_check(ec)) {
|
if (vm_scope_module_func_check(ec)) {
|
||||||
rb_warning("attribute accessor as module_function");
|
rb_warning("attribute accessor as module_function");
|
||||||
}
|
}
|
||||||
visi = METHOD_VISI_PRIVATE;
|
visi = METHOD_VISI_PRIVATE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user