]> granicus.if.org Git - vim/commitdiff
patch 9.0.0174: no error for using "#{ comment" in a compiled function v9.0.0174
authorBram Moolenaar <Bram@vim.org>
Mon, 8 Aug 2022 20:43:11 +0000 (21:43 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 8 Aug 2022 20:43:11 +0000 (21:43 +0100)
Problem:    No error for using "#{ comment" in a compiled function.
Solution:   Make error checking for "#{" consistent. (closes #10855)

src/testdir/test_vim9_func.vim
src/version.c
src/vim9compile.c

index 2714fa1ccfd2f6cf56f29c89b451ca9c91e38b73..d67dd55b6ee2a9e23c7fa6364675e2ccf4b88f88 100644 (file)
@@ -74,6 +74,10 @@ def TestCompilingErrorInTry()
   delete('Xdir', 'rf')
 enddef
 
+def Test_comment_error()
+  v9.CheckDefFailure(['#{ comment'], 'E1170:')
+enddef
+
 def Test_compile_error_in_called_function()
   var lines =<< trim END
       vim9script
index 507feaa49e6c1dcb27a057ca5fd9de6d07cdfbe9..840a1eb67280fd1c1b9549b9d74cc697ed6851c1 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    174,
 /**/
     173,
 /**/
index c6316367e730c3913d9187e66294367309eec29e..98fc84c58a4cbf8b2299724492db9e57d94a08c2 100644 (file)
@@ -2899,7 +2899,9 @@ compile_def_function(
 
        if (*ea.cmd == '#')
        {
-           // "#" starts a comment
+           // "#" starts a comment, but "#{" is an error
+           if (vim9_bad_comment(ea.cmd))
+               goto erret;
            line = (char_u *)"";
            continue;
        }