mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	parse.y: fix labelarg
* parse.y (IS_BEG): include labeled argument state, which was EXPR_LABELARG. [ruby-dev:49221] [Bug #11456] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									0eca22904b
								
							
						
					
					
						commit
						0958af2ad4
					
				
					 3 changed files with 13 additions and 2 deletions
				
			
		|  | @ -1,3 +1,8 @@ | |||
| Tue Aug 18 17:19:21 2015  Nobuyoshi Nakada  <nobu@ruby-lang.org> | ||||
| 
 | ||||
| 	* parse.y (IS_BEG): include labeled argument state, which was | ||||
| 	  EXPR_LABELARG.  [ruby-dev:49221] [Bug #11456] | ||||
| 
 | ||||
| Tue Aug 18 16:16:21 2015  Nobuyoshi Nakada  <nobu@ruby-lang.org> | ||||
| 
 | ||||
| 	* include/ruby/ruby.h (RClass): define only in C, `__attribute__` | ||||
|  |  | |||
							
								
								
									
										4
									
								
								parse.y
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								parse.y
									
										
									
									
									
								
							|  | @ -7108,7 +7108,7 @@ parser_prepare(struct parser_params *parser) | |||
| 
 | ||||
| #define IS_ARG() IS_lex_state(EXPR_ARG_ANY) | ||||
| #define IS_END() IS_lex_state(EXPR_END_ANY) | ||||
| #define IS_BEG() IS_lex_state(EXPR_BEG_ANY) | ||||
| #define IS_BEG() (IS_lex_state(EXPR_BEG_ANY) || IS_lex_state_all(EXPR_ARG|EXPR_LABELED)) | ||||
| #define IS_SPCARG(c) (IS_ARG() && space_seen && !ISSPACE(c)) | ||||
| #define IS_LABEL_POSSIBLE() (\ | ||||
| 	(IS_lex_state(EXPR_LABEL|EXPR_ENDFN) && !cmd_state) || \ | ||||
|  | @ -8361,7 +8361,7 @@ parser_yylex(struct parser_params *parser) | |||
| 	return tSYMBEG; | ||||
| 
 | ||||
|       case '/': | ||||
| 	if (IS_lex_state(EXPR_BEG_ANY)) { | ||||
| 	if (IS_BEG()) { | ||||
| 	    lex_strterm = NEW_STRTERM(str_regexp, '/', 0); | ||||
| 	    return tREGEXP_BEG; | ||||
| 	} | ||||
|  |  | |||
|  | @ -310,6 +310,12 @@ WARN | |||
|     assert_valid_syntax("false ? raise do end : tap do end", bug10653) | ||||
|   end | ||||
| 
 | ||||
|   def test_paren_after_label | ||||
|     bug11456 = '[ruby-dev:49221] [Bug #11456]' | ||||
|     assert_valid_syntax("{foo: (1 rescue 0)}", bug11456) | ||||
|     assert_valid_syntax("{foo: /=/}", bug11456) | ||||
|   end | ||||
| 
 | ||||
|   def test_duplicated_arg | ||||
|     assert_syntax_error("def foo(a, a) end", /duplicated argument name/) | ||||
|     assert_nothing_raised { def foo(_, _) end } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 nobu
						nobu