]> granicus.if.org Git - vim/commitdiff
patch 8.2.3746: cannot disassemble function starting with "debug" or "profile" v8.2.3746
authorBram Moolenaar <Bram@vim.org>
Sun, 5 Dec 2021 17:20:24 +0000 (17:20 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 5 Dec 2021 17:20:24 +0000 (17:20 +0000)
Problem:    Cannot disassemble function starting with "debug" or "profile".
Solution:   Check for white space following. (closes #9273)

src/testdir/test_vim9_script.vim
src/version.c
src/vim9execute.c

index 40833c51c640ff856f5cfa75ebfd7feb8f88da89..4d83a4e8fbf97c58ef4bff40cfd0124855154fde 100644 (file)
@@ -3988,6 +3988,41 @@ def Test_vim9_autoload()
   &rtp = save_rtp
 enddef
 
+" test disassembling an auto-loaded function starting with "debug"
+def Test_vim9_autoload_disass()
+  mkdir('Xdir/autoload', 'p')
+  var save_rtp = &rtp
+  exe 'set rtp^=' .. getcwd() .. '/Xdir'
+
+  var lines =<< trim END
+     vim9script
+     def debugit#test(): string
+       return 'debug'
+     enddef
+  END
+  writefile(lines, 'Xdir/autoload/debugit.vim')
+
+  lines =<< trim END
+     vim9script
+     def profileit#test(): string
+       return 'profile'
+     enddef
+  END
+  writefile(lines, 'Xdir/autoload/profileit.vim')
+
+  lines =<< trim END
+    vim9script
+    assert_equal('debug', debugit#test())
+    disass debugit#test
+    assert_equal('profile', profileit#test())
+    disass profileit#test
+  END
+  CheckScriptSuccess(lines)
+
+  delete('Xdir', 'rf')
+  &rtp = save_rtp
+enddef
+
 " test using a vim9script that is auto-loaded from an autocmd
 def Test_vim9_aucmd_autoload()
   var lines =<< trim END
index 54baf7b167bc2d4cd5fe03b124c3903fbdc7efcb..0d00f207d172c61d1af191cd18cf70a90d51e797 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3746,
 /**/
     3745,
 /**/
index 2908e55c71eeef06e27613b0451c24d080910e87..adfb9207ccbab697f367304fcd3016ae3dd549e3 100644 (file)
@@ -5904,12 +5904,12 @@ ex_disassemble(exarg_T *eap)
     int                is_global = FALSE;
     compiletype_T compile_type = CT_NONE;
 
-    if (STRNCMP(arg, "profile", 7) == 0)
+    if (STRNCMP(arg, "profile", 7) == 0 && VIM_ISWHITE(arg[7]))
     {
        compile_type = CT_PROFILE;
        arg = skipwhite(arg + 7);
     }
-    else if (STRNCMP(arg, "debug", 5) == 0)
+    else if (STRNCMP(arg, "debug", 5) == 0 && VIM_ISWHITE(arg[5]))
     {
        compile_type = CT_DEBUG;
        arg = skipwhite(arg + 5);