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

* vm_insnhelper.c (vm_call_method): check argument number to

attr_reader.  [ruby-core:15120]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-01-17 16:48:18 +00:00
parent 64239e2291
commit 08c319ee2a
2 changed files with 35 additions and 26 deletions

View file

@ -1,3 +1,8 @@
Fri Jan 18 01:48:06 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (vm_call_method): check argument number to
attr_reader. [ruby-core:15120]
Fri Jan 18 00:49:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_io_check_readable): flush tied write IO too.

View file

@ -495,45 +495,49 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp,
switch (nd_type(node)) {
case RUBY_VM_METHOD_NODE:{
vm_setup_method(th, cfp, num, blockptr, flag, (VALUE)node->nd_body, recv, klass);
return Qundef;
vm_setup_method(th, cfp, num, blockptr, flag, (VALUE)node->nd_body, recv, klass);
return Qundef;
}
case NODE_CFUNC:{
val = vm_call_cfunc(th, cfp, num, id, recv, mn->nd_clss, flag, node, blockptr);
break;
val = vm_call_cfunc(th, cfp, num, id, recv, mn->nd_clss, flag, node, blockptr);
break;
}
case NODE_ATTRSET:{
val = rb_ivar_set(recv, node->nd_vid, *(cfp->sp - 1));
cfp->sp -= 2;
break;
val = rb_ivar_set(recv, node->nd_vid, *(cfp->sp - 1));
cfp->sp -= 2;
break;
}
case NODE_IVAR:{
val = rb_ivar_get(recv, node->nd_vid);
cfp->sp -= 1;
break;
if (num != 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)",
num);
}
val = rb_attr_get(recv, node->nd_vid);
cfp->sp -= 1;
break;
}
case NODE_BMETHOD:{
VALUE *argv = cfp->sp - num;
val = vm_call_bmethod(th, id, node->nd_cval, recv, klass, num, argv, blockptr);
cfp->sp += - num - 1;
break;
VALUE *argv = cfp->sp - num;
val = vm_call_bmethod(th, id, node->nd_cval, recv, klass, num, argv, blockptr);
cfp->sp += - num - 1;
break;
}
case NODE_ZSUPER:{
klass = RCLASS_SUPER(mn->nd_clss);
mn = rb_method_node(klass, id);
klass = RCLASS_SUPER(mn->nd_clss);
mn = rb_method_node(klass, id);
if (mn != 0) {
goto normal_method_dispatch;
}
else {
goto start_method_dispatch;
}
if (mn != 0) {
goto normal_method_dispatch;
}
else {
goto start_method_dispatch;
}
}
default:{
printf("node: %s\n", ruby_node_name(nd_type(node)));
rb_bug("eval_invoke_method: unreachable");
/* unreachable */
break;
printf("node: %s\n", ruby_node_name(nd_type(node)));
rb_bug("eval_invoke_method: unreachable");
/* unreachable */
break;
}
}
}