forked from aniani/vim
patch 9.0.1053: default constructor arguments are not optional
Problem: Default constructor arguments are not optional. Solution: Use "= v:none" to make constructor arguments optional.
This commit is contained in:
@@ -2068,7 +2068,7 @@ handle_debug(isn_T *iptr, ectx_T *ectx)
|
||||
}
|
||||
|
||||
/*
|
||||
* Store a value in a list, dict or blob variable.
|
||||
* Store a value in a list, dict, blob or object variable.
|
||||
* Returns OK, FAIL or NOTDONE (uncatchable error).
|
||||
*/
|
||||
static int
|
||||
@@ -2177,9 +2177,9 @@ execute_storeindex(isn_T *iptr, ectx_T *ectx)
|
||||
{
|
||||
long lidx = (long)tv_idx->vval.v_number;
|
||||
blob_T *blob = tv_dest->vval.v_blob;
|
||||
varnumber_T nr;
|
||||
int error = FALSE;
|
||||
int len;
|
||||
varnumber_T nr;
|
||||
int error = FALSE;
|
||||
int len;
|
||||
|
||||
if (blob == NULL)
|
||||
{
|
||||
@@ -2209,6 +2209,7 @@ execute_storeindex(isn_T *iptr, ectx_T *ectx)
|
||||
long idx = (long)tv_idx->vval.v_number;
|
||||
object_T *obj = tv_dest->vval.v_object;
|
||||
typval_T *otv = (typval_T *)(obj + 1);
|
||||
clear_tv(&otv[idx]);
|
||||
otv[idx] = *tv;
|
||||
}
|
||||
else
|
||||
@@ -4293,10 +4294,12 @@ exec_instructions(ectx_T *ectx)
|
||||
// Jump if an argument with a default value was already set and not
|
||||
// v:none.
|
||||
case ISN_JUMP_IF_ARG_SET:
|
||||
case ISN_JUMP_IF_ARG_NOT_SET:
|
||||
tv = STACK_TV_VAR(iptr->isn_arg.jumparg.jump_arg_off);
|
||||
if (tv->v_type != VAR_UNKNOWN
|
||||
&& !(tv->v_type == VAR_SPECIAL
|
||||
&& tv->vval.v_number == VVAL_NONE))
|
||||
int arg_set = tv->v_type != VAR_UNKNOWN
|
||||
&& !(tv->v_type == VAR_SPECIAL
|
||||
&& tv->vval.v_number == VVAL_NONE);
|
||||
if (iptr->isn_type == ISN_JUMP_IF_ARG_SET ? arg_set : !arg_set)
|
||||
ectx->ec_iidx = iptr->isn_arg.jumparg.jump_where;
|
||||
break;
|
||||
|
||||
@@ -6633,6 +6636,12 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
|
||||
iptr->isn_arg.jump.jump_where);
|
||||
break;
|
||||
|
||||
case ISN_JUMP_IF_ARG_NOT_SET:
|
||||
smsg("%s%4d JUMP_IF_ARG_NOT_SET arg[%d] -> %d", pfx, current,
|
||||
iptr->isn_arg.jumparg.jump_arg_off + STACK_FRAME_SIZE,
|
||||
iptr->isn_arg.jump.jump_where);
|
||||
break;
|
||||
|
||||
case ISN_FOR:
|
||||
{
|
||||
forloop_T *forloop = &iptr->isn_arg.forloop;
|
||||
|
Reference in New Issue
Block a user