[前][次][番号順一覧][スレッド一覧]

ruby-changes:48358

From: ko1 <ko1@a...>
Date: Fri, 27 Oct 2017 14:27:30 +0900 (JST)
Subject: [ruby-changes:48358] ko1:r60472 (trunk): remove duplicated definition.

ko1	2017-10-27 14:27:25 +0900 (Fri, 27 Oct 2017)

  New Revision: 60472

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60472

  Log:
    remove duplicated definition.
    
    * vm_insnhelper.c (vm_block_handler_to_proc): removed because it is same
      functionality of rb_vm_bh_to_procval(). Use rb_vm_bh_to_procval().

  Modified files:
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 60471)
+++ vm_insnhelper.c	(revision 60472)
@@ -2499,29 +2499,6 @@ block_proc_is_lambda(const VALUE procval https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2499
 }
 
 static VALUE
-vm_block_handler_to_proc(rb_thread_t *th, VALUE block_handler)
-{
-    VALUE blockarg = Qnil;
-
-    if (block_handler != VM_BLOCK_HANDLER_NONE) {
-	switch (vm_block_handler_type(block_handler)) {
-	  case block_handler_type_proc:
-	    blockarg = block_handler;
-	    break;
-	  case block_handler_type_symbol:
-	    blockarg = rb_sym_to_proc(block_handler);
-	    break;
-	  case block_handler_type_iseq:
-	  case block_handler_type_ifunc:
-	    blockarg = rb_vm_make_proc(th->ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc);
-	    break;
-	}
-    }
-
-    return blockarg;
-}
-
-static VALUE
 vm_yield_with_cfunc(rb_thread_t *th,
 		    const struct rb_captured_block *captured,
 		    VALUE self, int argc, const VALUE *argv, VALUE block_handler)
@@ -2542,7 +2519,7 @@ vm_yield_with_cfunc(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2519
 	arg = argv[0];
     }
 
-    blockarg = vm_block_handler_to_proc(th, block_handler);
+    blockarg = rb_vm_bh_to_procval(th->ec, block_handler);
 
     vm_push_frame(th->ec, (const rb_iseq_t *)captured->code.ifunc,
 		  VM_FRAME_MAGIC_IFUNC | VM_FRAME_FLAG_CFRAME,
@@ -2559,7 +2536,7 @@ vm_yield_with_cfunc(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2536
 static VALUE
 vm_yield_with_symbol(rb_thread_t *th,  VALUE symbol, int argc, const VALUE *argv, VALUE block_handler)
 {
-    return rb_sym_proc_call(SYM2ID(symbol), argc, argv, vm_block_handler_to_proc(th, block_handler));
+    return rb_sym_proc_call(SYM2ID(symbol), argc, argv, rb_vm_bh_to_procval(th->ec, block_handler));
 }
 
 static inline int

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]