mirror of
				https://github.com/vim/vim.git
				synced 2025-10-30 09:47:20 -04:00 
			
		
		
		
	patch 9.0.0799: in compiled function ->() on next line not recognized
Problem:    In compiled function ->() on next line not recognized.
Solution:   Also check for "(". (closes #11405)
			
			
This commit is contained in:
		| @@ -82,6 +82,23 @@ func Test_lambda_vim9cmd_linebreak() | |||||||
|   call v9.CheckDefAndScriptSuccess(lines) |   call v9.CheckDefAndScriptSuccess(lines) | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
|  | def Test_lamba_compiled_linebreak() | ||||||
|  |   var lines =<< trim END | ||||||
|  |       vim9script | ||||||
|  |  | ||||||
|  |       def Echo(what: any) | ||||||
|  |         assert_equal('hello world', what) | ||||||
|  |       enddef | ||||||
|  |       def That() | ||||||
|  |         printf("hello ") | ||||||
|  |           ->((x) => x .. "world")() | ||||||
|  |           ->Echo() | ||||||
|  |       enddef | ||||||
|  |       That() | ||||||
|  |   END | ||||||
|  |   v9.CheckScriptSuccess(lines) | ||||||
|  | enddef | ||||||
|  |  | ||||||
| func Test_lambda_with_partial() | func Test_lambda_with_partial() | ||||||
|   let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two']) |   let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two']) | ||||||
|   call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three')) |   call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three')) | ||||||
|   | |||||||
| @@ -695,6 +695,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     799, | ||||||
| /**/ | /**/ | ||||||
|     798, |     798, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
| @@ -1788,12 +1788,13 @@ compile_subscript( | |||||||
| 	{ | 	{ | ||||||
| 	    char_u *next = peek_next_line_from_context(cctx); | 	    char_u *next = peek_next_line_from_context(cctx); | ||||||
|  |  | ||||||
| 	    // If a following line starts with "->{" or "->X" advance to that | 	    // If a following line starts with "->{", "->(" or "->X" advance to | ||||||
| 	    // line, so that a line break before "->" is allowed. | 	    // that line, so that a line break before "->" is allowed. | ||||||
| 	    // Also if a following line starts with ".x". | 	    // Also if a following line starts with ".x". | ||||||
| 	    if (next != NULL && | 	    if (next != NULL && | ||||||
| 		    ((next[0] == '-' && next[1] == '>' | 		    ((next[0] == '-' && next[1] == '>' | ||||||
| 				 && (next[2] == '{' | 				 && (next[2] == '{' | ||||||
|  | 				       || next[2] == '(' | ||||||
| 				       || ASCII_ISALPHA(*skipwhite(next + 2)))) | 				       || ASCII_ISALPHA(*skipwhite(next + 2)))) | ||||||
| 		    || (next[0] == '.' && eval_isdictc(next[1])))) | 		    || (next[0] == '.' && eval_isdictc(next[1])))) | ||||||
| 	    { | 	    { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user