vm_insnhelper.c: fix indentation

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2012-10-27 23:22:10 +00:00
parent 2731767b5d
commit 5dc9855a4f

View File

@ -2057,72 +2057,72 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq,
* => {|a, b|} => a, b = [1, 2] * => {|a, b|} => a, b = [1, 2]
*/ */
arg0 = argv[0]; arg0 = argv[0];
if (!(iseq->arg_simple & 0x02) && /* exclude {|a|} */ if (!(iseq->arg_simple & 0x02) && /* exclude {|a|} */
(m + iseq->arg_opts + iseq->arg_post_len) > 0 && /* this process is meaningful */ (m + iseq->arg_opts + iseq->arg_post_len) > 0 && /* this process is meaningful */
argc == 1 && !NIL_P(ary = rb_check_array_type(arg0))) { /* rhs is only an array */ argc == 1 && !NIL_P(ary = rb_check_array_type(arg0))) { /* rhs is only an array */
th->mark_stack_len = argc = RARRAY_LENINT(ary); th->mark_stack_len = argc = RARRAY_LENINT(ary);
CHECK_STACK_OVERFLOW(th->cfp, argc); CHECK_STACK_OVERFLOW(th->cfp, argc);
MEMCPY(argv, RARRAY_PTR(ary), VALUE, argc); MEMCPY(argv, RARRAY_PTR(ary), VALUE, argc);
} }
else { else {
argv[0] = arg0; argv[0] = arg0;
} }
for (i=argc; i<m; i++) { for (i=argc; i<m; i++) {
argv[i] = Qnil; argv[i] = Qnil;
} }
if (iseq->arg_rest == -1 && iseq->arg_opts == 0) { if (iseq->arg_rest == -1 && iseq->arg_opts == 0) {
const int arg_size = iseq->arg_size; const int arg_size = iseq->arg_size;
if (arg_size < argc) { if (arg_size < argc) {
/* /*
* yield 1, 2 * yield 1, 2
* => {|a|} # truncate * => {|a|} # truncate
*/ */
th->mark_stack_len = argc = arg_size; th->mark_stack_len = argc = arg_size;
} }
} }
else { else {
int r = iseq->arg_rest; int r = iseq->arg_rest;
if (iseq->arg_post_len || if (iseq->arg_post_len ||
iseq->arg_opts) { /* TODO: implement simple version for (iseq->arg_post_len==0 && iseq->arg_opts > 0) */ iseq->arg_opts) { /* TODO: implement simple version for (iseq->arg_post_len==0 && iseq->arg_opts > 0) */
opt_pc = vm_yield_setup_block_args_complex(th, iseq, argc, argv); opt_pc = vm_yield_setup_block_args_complex(th, iseq, argc, argv);
} }
else { else {
if (argc < r) { if (argc < r) {
/* yield 1 /* yield 1
* => {|a, b, *r|} * => {|a, b, *r|}
*/ */
for (i=argc; i<r; i++) { for (i=argc; i<r; i++) {
argv[i] = Qnil; argv[i] = Qnil;
} }
argv[r] = rb_ary_new(); argv[r] = rb_ary_new();
} }
else { else {
argv[r] = rb_ary_new4(argc-r, &argv[r]); argv[r] = rb_ary_new4(argc-r, &argv[r]);
} }
} }
th->mark_stack_len = iseq->arg_size; th->mark_stack_len = iseq->arg_size;
} }
/* {|&b|} */ /* {|&b|} */
if (iseq->arg_block != -1) { if (iseq->arg_block != -1) {
VALUE procval = Qnil; VALUE procval = Qnil;
if (blockptr) { if (blockptr) {
if (blockptr->proc == 0) { if (blockptr->proc == 0) {
procval = rb_vm_make_proc(th, blockptr, rb_cProc); procval = rb_vm_make_proc(th, blockptr, rb_cProc);
} }
else { else {
procval = blockptr->proc; procval = blockptr->proc;
} }
} }
argv[iseq->arg_block] = procval; argv[iseq->arg_block] = procval;
} }
th->mark_stack_len = 0; th->mark_stack_len = 0;