0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.0.1249: cannot export an abstract class

Problem:    Cannot export an abstract class. (Ernie Rael)
Solution:   Add the EX_EXPORT flag to :abstract. (closes #11884)
This commit is contained in:
Bram Moolenaar 2023-01-27 13:16:19 +00:00
parent 53f54e49b7
commit 657aea7fc4
5 changed files with 38 additions and 2 deletions

View File

@ -3442,4 +3442,6 @@ EXTERN char e_using_super_not_in_child_class[]
INIT(= N_("E1358: Using \"super\" not in a child class"));
EXTERN char e_cannot_define_new_function_in_abstract_class[]
INIT(= N_("E1359: Cannot define a \"new\" function in an abstract class"));
EXTERN char e_invalid_command_str_expected_str[]
INIT(= N_("E476: Invalid command: %s, expected %s"));
#endif

View File

@ -128,7 +128,7 @@ EXCMD(CMD_aboveleft, "aboveleft", ex_wrongmodifier,
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM,
ADDR_NONE),
EXCMD(CMD_abstract, "abstract", 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_all, "all", ex_all,
EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR,

View File

@ -164,6 +164,24 @@ def Test_class_basic()
v9.CheckScriptSuccess(lines)
enddef
def Test_class_interface_wrong_end()
var lines =<< trim END
vim9script
abstract class SomeName
this.member = 'text'
endinterface
END
v9.CheckScriptFailure(lines, 'E476: Invalid command: endinterface, expected endclass')
lines =<< trim END
vim9script
export interface AnotherName
this.member: string
endclass
END
v9.CheckScriptFailure(lines, 'E476: Invalid command: endclass, expected endinterface')
enddef
def Test_class_member_initializer()
var lines =<< trim END
vim9script
@ -845,6 +863,20 @@ def Test_interface_basics()
enddef
END
v9.CheckScriptSuccess(lines)
var imported =<< trim END
vim9script
export abstract class EnterExit
def Enter(): void
enddef
def Exit(): void
enddef
endclass
END
writefile(imported, 'XdefIntf2.vim', 'D')
lines[1] = " import './XdefIntf2.vim' as defIntf"
v9.CheckScriptSuccess(lines)
enddef
def Test_class_implements_interface()

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1249,
/**/
1248,
/**/

View File

@ -423,7 +423,7 @@ early_ret:
char *wrong_name = is_class ? "endinterface" : "endclass";
if (checkforcmd(&p, wrong_name, is_class ? 5 : 4))
{
semsg(_(e_invalid_command_str), line);
semsg(_(e_invalid_command_str_expected_str), line, end_name);
break;
}