mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	compile.c: set true and false directly
* compile.c (iseq_set_arguments): directly set true and false default values not only nil to keyword arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									a81979ec55
								
							
						
					
					
						commit
						ab9319d886
					
				
					 1 changed files with 16 additions and 6 deletions
				
			
		
							
								
								
									
										22
									
								
								compile.c
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								compile.c
									
										
									
									
									
								
							|  | @ -1240,14 +1240,21 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args) | |||
| 		    ++rkw; | ||||
| 		} | ||||
| 		else { | ||||
| 		    if (nd_type(val_node) == NODE_LIT) { | ||||
| 		    switch (nd_type(val_node)) { | ||||
| 		      case NODE_LIT: | ||||
| 			dv = val_node->nd_lit; | ||||
| 			iseq_add_mark_object(iseq, dv); | ||||
| 		    } | ||||
| 		    else if (nd_type(val_node) == NODE_NIL) { | ||||
| 			break; | ||||
| 		      case NODE_NIL: | ||||
| 			dv = Qnil; | ||||
| 		    } | ||||
| 		    else { | ||||
| 			break; | ||||
| 		      case NODE_TRUE: | ||||
| 			dv = Qtrue; | ||||
| 			break; | ||||
| 		      case NODE_FALSE: | ||||
| 			dv = Qfalse; | ||||
| 			break; | ||||
| 		      default: | ||||
| 			COMPILE_POPED(optargs, "kwarg", node); /* nd_type(node) == NODE_KW_ARG */ | ||||
| 			dv = complex_mark; | ||||
| 		    } | ||||
|  | @ -5358,7 +5365,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) | |||
| 		/* required argument. do nothing */ | ||||
| 		rb_bug("unreachable"); | ||||
| 	    } | ||||
| 	    else if (nd_type(default_value) == NODE_LIT) { | ||||
| 	    else if (nd_type(default_value) == NODE_LIT || | ||||
| 		     nd_type(default_value) == NODE_NIL || | ||||
| 		     nd_type(default_value) == NODE_TRUE || | ||||
| 		     nd_type(default_value) == NODE_FALSE) { | ||||
| 		rb_bug("unreachable"); | ||||
| 	    } | ||||
| 	    else { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 nobu
						nobu