]> granicus.if.org Git - vim/commitdiff
patch 8.2.1427: Vim9: cannot use a range with marks in :def function v8.2.1427
authorBram Moolenaar <Bram@vim.org>
Wed, 12 Aug 2020 13:48:55 +0000 (15:48 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 12 Aug 2020 13:48:55 +0000 (15:48 +0200)
Problem:    Vim9: cannot use a range with marks in :def function.
Solution:   Parse range after colon. (closes #6686)

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

index 5d9447d8ca11a5c16a9904d46a5ccd7210d1a48c..3c7724df112b1a8b8fc56130e26acfea8bf60de4 100644 (file)
@@ -83,20 +83,37 @@ enddef
 
 def Test_disassemble_exec_expr()
   let res = execute('disass s:EditExpand')
-  assert_match('<SNR>\d*_EditExpand.*' ..
-        ' let filename = "file".*' ..
-        '\d PUSHS "file".*' ..
-        '\d STORE $0.*' ..
-        ' let filenr = 123.*' ..
-        '\d STORE 123 in $1.*' ..
-        ' edit the`=filename``=filenr`.txt.*' ..
-        '\d PUSHS "edit the".*' ..
-        '\d LOAD $0.*' ..
-        '\d LOAD $1.*' ..
-        '\d 2STRING stack\[-1\].*' ..
-        '\d PUSHS ".txt".*' ..
-        '\d EXECCONCAT 4.*' ..
-        '\d PUSHNR 0.*' ..
+  assert_match('<SNR>\d*_EditExpand\_s*' ..
+        ' let filename = "file"\_s*' ..
+        '\d PUSHS "file"\_s*' ..
+        '\d STORE $0\_s*' ..
+        ' let filenr = 123\_s*' ..
+        '\d STORE 123 in $1\_s*' ..
+        ' edit the`=filename``=filenr`.txt\_s*' ..
+        '\d PUSHS "edit the"\_s*' ..
+        '\d LOAD $0\_s*' ..
+        '\d LOAD $1\_s*' ..
+        '\d 2STRING stack\[-1\]\_s*' ..
+        '\d\+ PUSHS ".txt"\_s*' ..
+        '\d\+ EXECCONCAT 4\_s*' ..
+        '\d\+ PUSHNR 0\_s*' ..
+        '\d\+ RETURN',
+        res)
+enddef
+
+def s:YankRange()
+  norm! m[jjm]
+  :'[,']yank
+enddef
+
+def Test_disassemble_yank_range()
+  let res = execute('disass s:YankRange')
+  assert_match('<SNR>\d*_YankRange.*' ..
+        ' norm! m\[jjm\]\_s*' ..
+        '\d EXEC   norm! m\[jjm\]\_s*' ..
+        '  :''\[,''\]yank\_s*' ..
+        '\d EXEC   :''\[,''\]yank\_s*' ..
+        '\d PUSHNR 0\_s*' ..
         '\d RETURN',
         res)
 enddef
index 6edd5ec2e89a5eda800594cd4d90e9a9e897c8b1..63c9c3d30b2425d323421d193b994243026b7ad4 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1427,
 /**/
     1426,
 /**/
index 88108f4982bd65cf84503b53a297a54ae587f89a..dfcff508fa6db5db3186126688e9bcfce2727d32 100644 (file)
@@ -6567,7 +6567,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
         * 'text'->func() should not be confused with 'a mark
         */
        cmd = ea.cmd;
-       if (*cmd != '\'')
+       if (*cmd != '\'' || starts_with_colon)
        {
            ea.cmd = skip_range(ea.cmd, NULL);
            if (ea.cmd > cmd && !starts_with_colon)