From: Bram Moolenaar Date: Thu, 26 Jan 2023 20:36:56 +0000 (+0000) Subject: patch 9.0.1248: cannot export an interface X-Git-Tag: v9.0.1248 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53f54e49b7152e93d09ff77406f7eb63b3b5f732;p=vim patch 9.0.1248: cannot export an interface Problem: Cannot export an interface. (Ernie Rael) Solution: Add the EX_EXPORT flag to :interface. (closes #11884) --- diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 8f8efe7cc..7e127221d 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -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, diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index 389213680..5edd511a3 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -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() diff --git a/src/version.c b/src/version.c index 79f021b96..52502b525 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1248, /**/ 1247, /**/