delfunc! g:Func
enddef
+def Test_continues_with_silent_error()
+ var lines =<< trim END
+ vim9script
+ g:result = 'none'
+ def Func()
+ silent! g:result += 3
+ g:result = 'yes'
+ enddef
+ # error is silenced, function does not abort
+ Func()
+ assert_equal('yes', g:result)
+ unlet g:result
+ END
+ CheckScriptSuccess(lines)
+enddef
+
def Test_abort_even_with_silent()
var lines =<< trim END
vim9script
eval {-> ''}() .. '' .. {}['X']
g:result = 'yes'
enddef
- sil! Func()
+ silent! Func()
assert_equal('none', g:result)
unlet g:result
END
CheckScriptSuccess(lines)
enddef
+def Test_cmdmod_silent_restored()
+ var lines =<< trim END
+ vim9script
+ def Func()
+ g:result = 'none'
+ silent! g:result += 3
+ g:result = 'none'
+ g:result += 3
+ enddef
+ Func()
+ END
+ # can't use CheckScriptFailure, it ignores the :silent!
+ var fname = 'Xdefsilent'
+ writefile(lines, fname)
+ var caught = 'no'
+ try
+ exe 'source ' .. fname
+ catch /E1030:/
+ caught = 'yes'
+ assert_match('Func, line 4', v:throwpoint)
+ endtry
+ assert_equal('yes', caught)
+ delete(fname)
+enddef
+
def Test_dict_member_with_silent()
var lines =<< trim END
vim9script
static int
generate_undo_cmdmods(cctx_T *cctx)
{
- isn_T *isn;
-
- if (cctx->ctx_has_cmdmod)
- {
- if ((isn = generate_instr(cctx, ISN_CMDMOD_REV)) == NULL)
- return FAIL;
- }
-
+ if (cctx->ctx_has_cmdmod && generate_instr(cctx, ISN_CMDMOD_REV) == NULL)
+ return FAIL;
return OK;
}
line = compile_assignment(ea.cmd, &ea, CMD_SIZE, &cctx);
if (line == NULL || line == ea.cmd)
goto erret;
- continue;
+ goto nextline;
}
}
}
if (line == NULL)
goto erret;
if (line != ea.cmd)
- continue;
+ goto nextline;
}
}
if (cctx.ctx_skip == SKIP_YES)
{
line += STRLEN(line);
- continue;
+ goto nextline;
}
// Expression or function call.