mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* eval_jump.c (rb_f_catch): Resotre cfp if catched thrown object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									37d1059f49
								
							
						
					
					
						commit
						a0350e5964
					
				
					 2 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -105,6 +105,7 @@ rb_f_catch(int argc, VALUE *argv)
 | 
			
		|||
    int state;
 | 
			
		||||
    VALUE val = Qnil;		/* OK */
 | 
			
		||||
    rb_thread_t *th = GET_THREAD();
 | 
			
		||||
    rb_control_frame_t *saved_cfp = th->cfp;
 | 
			
		||||
 | 
			
		||||
    rb_scan_args(argc, argv, "01", &tag);
 | 
			
		||||
    if (argc == 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -118,6 +119,7 @@ rb_f_catch(int argc, VALUE *argv)
 | 
			
		|||
	val = rb_yield_0(1, &tag);
 | 
			
		||||
    }
 | 
			
		||||
    else if (state == TAG_THROW && RNODE(th->errinfo)->u1.value == tag) {
 | 
			
		||||
	th->cfp = saved_cfp;
 | 
			
		||||
	val = th->tag->retval;
 | 
			
		||||
	th->errinfo = Qnil;
 | 
			
		||||
	state = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue