mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.0340: Vim9: function and partial types not tested
Problem: Vim9: function and partial types not tested. Solution: Support more for partial, add tests.
This commit is contained in:
@@ -60,7 +60,10 @@ def Test_assignment()
|
|||||||
if has('float')
|
if has('float')
|
||||||
let float1: float = 3.4
|
let float1: float = 3.4
|
||||||
endif
|
endif
|
||||||
let party: partial = funcref('Test_syntax')
|
let funky1: func
|
||||||
|
let funky2: func = function('len')
|
||||||
|
let party1: partial
|
||||||
|
let party2: partial = funcref('Test_syntax')
|
||||||
|
|
||||||
g:newvar = 'new'
|
g:newvar = 'new'
|
||||||
assert_equal('new', g:newvar)
|
assert_equal('new', g:newvar)
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
340,
|
||||||
/**/
|
/**/
|
||||||
339,
|
339,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -215,6 +215,7 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
channel_T *channel;
|
channel_T *channel;
|
||||||
job_T *job;
|
job_T *job;
|
||||||
|
partial_T *partial;
|
||||||
jump_T jump;
|
jump_T jump;
|
||||||
forloop_T forloop;
|
forloop_T forloop;
|
||||||
try_T try;
|
try_T try;
|
||||||
|
@@ -705,6 +705,23 @@ generate_PUSHFUNC(cctx_T *cctx, char_u *name)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generate an ISN_PUSHPARTIAL instruction with partial "part".
|
||||||
|
* Consumes "name".
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
generate_PUSHPARTIAL(cctx_T *cctx, partial_T *part)
|
||||||
|
{
|
||||||
|
isn_T *isn;
|
||||||
|
|
||||||
|
if ((isn = generate_instr_type(cctx, ISN_PUSHPARTIAL,
|
||||||
|
&t_partial_any)) == NULL)
|
||||||
|
return FAIL;
|
||||||
|
isn->isn_arg.partial = part;
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate an ISN_STORE instruction.
|
* Generate an ISN_STORE instruction.
|
||||||
*/
|
*/
|
||||||
@@ -3605,8 +3622,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
|||||||
generate_PUSHFUNC(cctx, NULL);
|
generate_PUSHFUNC(cctx, NULL);
|
||||||
break;
|
break;
|
||||||
case VAR_PARTIAL:
|
case VAR_PARTIAL:
|
||||||
// generate_PUSHPARTIAL(cctx, NULL);
|
generate_PUSHPARTIAL(cctx, NULL);
|
||||||
emsg("Partial type not supported yet");
|
|
||||||
break;
|
break;
|
||||||
case VAR_LIST:
|
case VAR_LIST:
|
||||||
generate_NEWLIST(cctx, 0);
|
generate_NEWLIST(cctx, 0);
|
||||||
@@ -5228,7 +5244,7 @@ delete_instr(isn_T *isn)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ISN_PUSHPARTIAL:
|
case ISN_PUSHPARTIAL:
|
||||||
// TODO
|
partial_unref(isn->isn_arg.partial);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ISN_PUSHJOB:
|
case ISN_PUSHJOB:
|
||||||
|
@@ -873,10 +873,17 @@ call_def_function(
|
|||||||
break;
|
break;
|
||||||
case ISN_PUSHFUNC:
|
case ISN_PUSHFUNC:
|
||||||
tv->v_type = VAR_FUNC;
|
tv->v_type = VAR_FUNC;
|
||||||
tv->vval.v_string = vim_strsave(iptr->isn_arg.string);
|
if (iptr->isn_arg.string == NULL)
|
||||||
|
tv->vval.v_string = NULL;
|
||||||
|
else
|
||||||
|
tv->vval.v_string =
|
||||||
|
vim_strsave(iptr->isn_arg.string);
|
||||||
break;
|
break;
|
||||||
case ISN_PUSHPARTIAL:
|
case ISN_PUSHPARTIAL:
|
||||||
tv->v_type = VAR_UNKNOWN;
|
tv->v_type = VAR_PARTIAL;
|
||||||
|
tv->vval.v_partial = iptr->isn_arg.partial;
|
||||||
|
if (tv->vval.v_partial != NULL)
|
||||||
|
++tv->vval.v_partial->pt_refcount;
|
||||||
break;
|
break;
|
||||||
case ISN_PUSHCHANNEL:
|
case ISN_PUSHCHANNEL:
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
@@ -1874,11 +1881,20 @@ ex_disassemble(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ISN_PUSHFUNC:
|
case ISN_PUSHFUNC:
|
||||||
smsg("%4d PUSHFUNC \"%s\"", current, iptr->isn_arg.string);
|
{
|
||||||
|
char *name = (char *)iptr->isn_arg.string;
|
||||||
|
|
||||||
|
smsg("%4d PUSHFUNC \"%s\"", current,
|
||||||
|
name == NULL ? "[none]" : name);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ISN_PUSHPARTIAL:
|
case ISN_PUSHPARTIAL:
|
||||||
// TODO
|
{
|
||||||
smsg("%4d PUSHPARTIAL", current);
|
partial_T *part = iptr->isn_arg.partial;
|
||||||
|
|
||||||
|
smsg("%4d PUSHPARTIAL \"%s\"", current,
|
||||||
|
part == NULL ? "[none]" : (char *)partial_name(part));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ISN_PUSHCHANNEL:
|
case ISN_PUSHCHANNEL:
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
|
Reference in New Issue
Block a user