0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.0687: "export def" does not work in a nested block

Problem:    "export def" does not work in a nested block.
Solution:   Do not handle "export" with a separate function but in the same
            command stack. (closes #11304)
This commit is contained in:
Bram Moolenaar
2022-10-07 17:26:22 +01:00
parent 8d8b9758ce
commit 5ab300195b
5 changed files with 59 additions and 53 deletions

View File

@@ -246,49 +246,13 @@ ex_incdec(exarg_T *eap)
}
/*
* ":export let Name: type"
* ":export const Name: type"
* ":export def Name(..."
* ":export class Name ..."
* ":export cmd"
*/
void
ex_export(exarg_T *eap)
ex_export(exarg_T *eap UNUSED)
{
int prev_did_emsg = did_emsg;
if (!in_vim9script())
{
emsg(_(e_export_can_only_be_used_in_vim9script));
return;
}
eap->cmd = eap->arg;
(void)find_ex_command(eap, NULL, lookup_scriptitem, NULL);
switch (eap->cmdidx)
{
case CMD_var:
case CMD_final:
case CMD_const:
case CMD_def:
case CMD_function:
// case CMD_class:
is_export = TRUE;
do_cmdline(eap->cmd, eap->getline, eap->cookie,
DOCMD_VERBOSE + DOCMD_NOWAIT);
// The command will reset "is_export" when exporting an item.
if (is_export)
{
if (did_emsg == prev_did_emsg)
emsg(_(e_export_with_invalid_argument));
is_export = FALSE;
}
break;
default:
if (did_emsg == prev_did_emsg)
emsg(_(e_invalid_command_after_export));
break;
}
// can only get here when "export" wasn't caught in do_cmdline()
emsg(_(e_export_can_only_be_used_in_vim9script));
}
/*