mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.0321: Vim9: ":execute" does not work yet
Problem: Vim9: ":execute" does not work yet. Solution: Add ISN_EXECUTE. (closes #5699) Also make :echo work with more than one argument.
This commit is contained in:
@@ -1116,6 +1116,21 @@ generate_ECHO(cctx_T *cctx, int with_white, int count)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate an ISN_EXECUTE instruction.
|
||||
*/
|
||||
static int
|
||||
generate_EXECUTE(cctx_T *cctx, int count)
|
||||
{
|
||||
isn_T *isn;
|
||||
|
||||
if ((isn = generate_instr_drop(cctx, ISN_EXECUTE, count)) == NULL)
|
||||
return FAIL;
|
||||
isn->isn_arg.number = count;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int
|
||||
generate_EXEC(cctx_T *cctx, char_u *line)
|
||||
{
|
||||
@@ -4671,14 +4686,40 @@ compile_echo(char_u *arg, int with_white, cctx_T *cctx)
|
||||
char_u *p = arg;
|
||||
int count = 0;
|
||||
|
||||
// for ()
|
||||
for (;;)
|
||||
{
|
||||
if (compile_expr1(&p, cctx) == FAIL)
|
||||
return NULL;
|
||||
++count;
|
||||
p = skipwhite(p);
|
||||
if (ends_excmd(*p))
|
||||
break;
|
||||
}
|
||||
|
||||
generate_ECHO(cctx, with_white, count);
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* compile "execute expr"
|
||||
*/
|
||||
static char_u *
|
||||
compile_execute(char_u *arg, cctx_T *cctx)
|
||||
{
|
||||
char_u *p = arg;
|
||||
int count = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (compile_expr1(&p, cctx) == FAIL)
|
||||
return NULL;
|
||||
++count;
|
||||
p = skipwhite(p);
|
||||
if (ends_excmd(*p))
|
||||
break;
|
||||
}
|
||||
|
||||
generate_EXECUTE(cctx, count);
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -5017,12 +5058,14 @@ compile_def_function(ufunc_T *ufunc, int set_return_type)
|
||||
case CMD_echon:
|
||||
line = compile_echo(p, FALSE, &cctx);
|
||||
break;
|
||||
case CMD_execute:
|
||||
line = compile_execute(p, &cctx);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not recognized, execute with do_cmdline_cmd().
|
||||
// TODO:
|
||||
// CMD_echomsg
|
||||
// CMD_execute
|
||||
// etc.
|
||||
generate_EXEC(&cctx, line);
|
||||
line = (char_u *)"";
|
||||
@@ -5150,6 +5193,7 @@ delete_instr(isn_T *isn)
|
||||
case ISN_DCALL:
|
||||
case ISN_DROP:
|
||||
case ISN_ECHO:
|
||||
case ISN_EXECUTE:
|
||||
case ISN_ENDTRY:
|
||||
case ISN_FOR:
|
||||
case ISN_FUNCREF:
|
||||
|
Reference in New Issue
Block a user