mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-patch:9.1.0301: Vim9: heredoc start may be recognized in string (#28266)
Problem:  Vim9: heredoc start may be recognized in string.
Solution: Don't skip to closing bracket for invalid list assignment.
          (zeertzjq)
closes: vim/vim#14472
1817ccdb10
			
			
This commit is contained in:
		| @@ -2578,13 +2578,11 @@ void ex_function(exarg_T *eap) | |||||||
|       if (checkforcmd(&arg, "let", 2)) { |       if (checkforcmd(&arg, "let", 2)) { | ||||||
|         int var_count = 0; |         int var_count = 0; | ||||||
|         int semicolon = 0; |         int semicolon = 0; | ||||||
|         const char *argend = skip_var_list(arg, &var_count, &semicolon, true); |         arg = (char *)skip_var_list(arg, &var_count, &semicolon, true); | ||||||
|         if (argend == NULL) { |         if (arg != NULL) { | ||||||
|           // Invalid list assignment: skip to closing bracket. |           arg = skipwhite(arg); | ||||||
|           argend = find_name_end(arg, NULL, NULL, FNE_INCL_BR); |  | ||||||
|         } |         } | ||||||
|         arg = skipwhite(argend); |         if (arg != NULL && strncmp(arg, "=<<", 3) == 0) { | ||||||
|         if (arg[0] == '=' && arg[1] == '<' && arg[2] == '<') { |  | ||||||
|           p = skipwhite(arg + 3); |           p = skipwhite(arg + 3); | ||||||
|           while (true) { |           while (true) { | ||||||
|             if (strncmp(p, "trim", 4) == 0) { |             if (strncmp(p, "trim", 4) == 0) { | ||||||
|   | |||||||
| @@ -409,11 +409,17 @@ func Test_let_heredoc_fails() | |||||||
|     call assert_report('Caught exception: ' .. v:exception) |     call assert_report('Caught exception: ' .. v:exception) | ||||||
|   endtry |   endtry | ||||||
|  |  | ||||||
|  |   try | ||||||
|  |     let [] =<< trim TEXT | ||||||
|  |     TEXT | ||||||
|  |     call assert_report('No exception thrown') | ||||||
|  |   catch /E475:/ | ||||||
|  |   catch | ||||||
|  |     call assert_report('Caught exception: ' .. v:exception) | ||||||
|  |   endtry | ||||||
|  |  | ||||||
|   try |   try | ||||||
|     let [a b c] =<< trim TEXT |     let [a b c] =<< trim TEXT | ||||||
|       change |  | ||||||
|       insert |  | ||||||
|       append |  | ||||||
|     TEXT |     TEXT | ||||||
|     call assert_report('No exception thrown') |     call assert_report('No exception thrown') | ||||||
|   catch /E475:/ |   catch /E475:/ | ||||||
| @@ -423,9 +429,6 @@ func Test_let_heredoc_fails() | |||||||
|  |  | ||||||
|   try |   try | ||||||
|     let [a; b; c] =<< trim TEXT |     let [a; b; c] =<< trim TEXT | ||||||
|       change |  | ||||||
|       insert |  | ||||||
|       append |  | ||||||
|     TEXT |     TEXT | ||||||
|     call assert_report('No exception thrown') |     call assert_report('No exception thrown') | ||||||
|   catch /E452:/ |   catch /E452:/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 zeertzjq
					zeertzjq