]> granicus.if.org Git - vim/commitdiff
patch 9.0.1248: cannot export an interface v9.0.1248
authorBram Moolenaar <Bram@vim.org>
Thu, 26 Jan 2023 20:36:56 +0000 (20:36 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 26 Jan 2023 20:36:56 +0000 (20:36 +0000)
Problem:    Cannot export an interface. (Ernie Rael)
Solution:   Add the EX_EXPORT flag to :interface. (closes #11884)

src/ex_cmds.h
src/testdir/test_vim9_class.vim
src/version.c

index 8f8efe7cc8ed75386963af985c5fc667af3fcb60..7e127221d7882289573cec737d7c42294ba20a91 100644 (file)
@@ -758,7 +758,7 @@ EXCMD(CMD_intro,    "intro",        ex_intro,
        EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
        ADDR_NONE),
 EXCMD(CMD_interface,   "interface",    ex_class,
-       EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
+       EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
        ADDR_NONE),
 EXCMD(CMD_isearch,     "isearch",      ex_findpat,
        EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK,
index 389213680b8c2ca4c4da33c615303c381c6d8288..5edd511a3cb593fc38c7aafc51d020715a3f9db7 100644 (file)
@@ -822,6 +822,29 @@ def Test_interface_basics()
       endinterface
   END
   v9.CheckScriptFailure(lines, 'E1345: Not a valid command in an interface: return 5')
+
+  lines =<< trim END
+      vim9script
+      export interface EnterExit
+          def Enter(): void
+          def Exit(): void
+      endinterface
+  END
+  writefile(lines, 'XdefIntf.vim', 'D')
+
+  lines =<< trim END
+      vim9script
+      import './XdefIntf.vim' as defIntf
+      export def With(ee: defIntf.EnterExit, F: func)
+          ee.Enter()
+          try
+              F()
+          finally
+              ee.Exit()
+          endtry
+      enddef
+  END
+  v9.CheckScriptSuccess(lines)
 enddef
 
 def Test_class_implements_interface()
index 79f021b9661e98f4c52fe422faa1b69de7617fee..52502b525c44139f3f9dd435e6e6f2733c1512f5 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1248,
 /**/
     1247,
 /**/