Compare commits

...

4 Commits

Author SHA1 Message Date
Bram Moolenaar
e5492609b3 patch 8.2.2192: Codecov on github actions fails
Problem:    Codecov on github actions fails.
Solution:   Revert to codecov script. (Ozaki Kiichi, closes #7529)
2020-12-22 19:05:33 +01:00
Bram Moolenaar
58a52f215a patch 8.2.2191: Vim9: using wrong name with lambda in nested function
Problem:    Vim9: using wrong name with lambda in nested function.
Solution:   Copy the lambda name earlier. (closes #7525)
2020-12-22 18:56:55 +01:00
Bram Moolenaar
077a42318c patch 8.2.2190: Vim9: crash when compiled with EXITFREE
Problem:    Vim9: crash when compiled with EXITFREE.
Solution:   Check that df_ufunc is not NULL.
2020-12-22 18:33:27 +01:00
Bram Moolenaar
032a2d050b patch 8.2.2189: cannot repeat a command that uses the small delete register
Problem:    Cannot repeat a command that uses the small delete register.
Solution:   Store the register name instead of the contents. (Christian
            Brabandt, closes #7527)
2020-12-22 17:59:35 +01:00
8 changed files with 101 additions and 23 deletions

View File

@@ -214,11 +214,9 @@ jobs:
- name: Codecov
if: matrix.coverage && success()
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
fail_ci_if_error: true
working-directory: ${{ env.SRCDIR }}
run: |
cd "${SRCDIR}"
bash <(curl -s https://codecov.io/bash) -F "${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}"
- name: ASan logs
if: contains(matrix.extra, 'asan') && !cancelled()

View File

@@ -9,7 +9,7 @@ SRC_ALL = \
.lgtm.yml \
.travis.yml \
.cirrus.yml \
.github/workflows/ci-windows.yaml \
.github/workflows/ci.yml \
.github/workflows/codeql-analysis.yml \
.github/CODEOWNERS \
appveyor.yml \

View File

@@ -9,7 +9,7 @@
/*
* ops.c: implementation of various operators: op_shift, op_delete, op_tilde,
* op_change, op_yank, do_put, do_join
* op_change, op_yank, do_join
*/
#include "vim.h"

View File

@@ -809,7 +809,14 @@ insert_reg(
{
for (i = 0; i < y_current->y_size; ++i)
{
stuffescaped(y_current->y_array[i], literally);
if (regname == '-')
{
AppendCharToRedobuff(Ctrl_R);
AppendCharToRedobuff(regname);
do_put(regname, NULL, BACKWARD, 1L, PUT_CURSEND);
}
else
stuffescaped(y_current->y_array[i], literally);
// Insert a newline between lines and after last line if
// y_type is MLINE.
if (y_current->y_type == MLINE || i < y_current->y_size - 1)

View File

@@ -698,4 +698,15 @@ func Test_ve_blockpaste()
bwipe!
endfunc
func Test_insert_small_delete()
new
call setline(1, ['foo foobar bar'])
call cursor(1,1)
exe ":norm! ciw'\<C-R>-'"
call assert_equal(getline(1), "'foo' foobar bar")
exe ":norm! w.w."
call assert_equal(getline(1), "'foo' 'foobar' 'bar'")
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -301,6 +301,19 @@ def Test_nested_global_function()
CheckScriptFailure(lines, "E122:")
delfunc g:Inner
lines =<< trim END
vim9script
def Outer()
def g:Inner()
echo map([1, 2, 3], {_, v -> v + 1})
enddef
g:Inner()
enddef
Outer()
END
CheckScriptSuccess(lines)
delfunc g:Inner
lines =<< trim END
vim9script
def Func()
@@ -2011,5 +2024,27 @@ def Test_opfunc()
nunmap <F3>
enddef
" this was crashing on exit
def Test_nested_lambda_in_closure()
var lines =<< trim END
vim9script
def Outer()
def g:Inner()
echo map([1, 2, 3], {_, v -> v + 1})
enddef
g:Inner()
enddef
defcompile
writefile(['Done'], 'XnestedDone')
quit
END
if !RunVim([], lines, '--clean')
return
endif
assert_equal(['Done'], readfile('XnestedDone'))
delete('XnestedDone')
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker

View File

@@ -750,6 +750,14 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2192,
/**/
2191,
/**/
2190,
/**/
2189,
/**/
2188,
/**/

View File

@@ -1428,20 +1428,27 @@ generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc)
/*
* Generate an ISN_NEWFUNC instruction.
* "lambda_name" and "func_name" must be in allocated memory and will be
* consumed.
*/
static int
generate_NEWFUNC(cctx_T *cctx, char_u *lambda_name, char_u *func_name)
{
isn_T *isn;
char_u *name;
RETURN_OK_IF_SKIP(cctx);
name = vim_strsave(lambda_name);
if (name == NULL)
return FAIL;
if (cctx->ctx_skip == SKIP_YES)
{
vim_free(lambda_name);
vim_free(func_name);
return OK;
}
if ((isn = generate_instr(cctx, ISN_NEWFUNC)) == NULL)
{
vim_free(lambda_name);
vim_free(func_name);
return FAIL;
isn->isn_arg.newfunc.nf_lambda = name;
}
isn->isn_arg.newfunc.nf_lambda = lambda_name;
isn->isn_arg.newfunc.nf_global = func_name;
return OK;
@@ -4840,7 +4847,7 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
char_u *name_end = to_name_end(eap->arg, TRUE);
char_u *lambda_name;
ufunc_T *ufunc;
int r;
int r = FAIL;
if (eap->forceit)
{
@@ -4883,16 +4890,21 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
eap->cookie = cctx;
eap->skip = cctx->ctx_skip == SKIP_YES;
eap->forceit = FALSE;
lambda_name = get_lambda_name();
lambda_name = vim_strsave(get_lambda_name());
if (lambda_name == NULL)
return NULL;
ufunc = define_function(eap, lambda_name);
if (ufunc == NULL)
return eap->skip ? (char_u *)"" : NULL;
{
r = eap->skip ? OK : FAIL;
goto theend;
}
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
&& compile_def_function(ufunc, TRUE, cctx) == FAIL)
{
func_ptr_unref(ufunc);
return NULL;
goto theend;
}
if (is_global)
@@ -4903,7 +4915,10 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
if (func_name == NULL)
r = FAIL;
else
{
r = generate_NEWFUNC(cctx, lambda_name, func_name);
lambda_name = NULL;
}
}
else
{
@@ -4913,9 +4928,9 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
int block_depth = cctx->ctx_ufunc->uf_block_depth;
if (lvar == NULL)
return NULL;
goto theend;
if (generate_FUNCREF(cctx, ufunc) == FAIL)
return NULL;
goto theend;
r = generate_STORE(cctx, ISN_STORE, lvar->lv_idx, NULL);
// copy over the block scope IDs
@@ -4930,8 +4945,11 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
}
}
}
// TODO: warning for trailing text?
r = OK;
theend:
vim_free(lambda_name);
return r == FAIL ? NULL : (char_u *)"";
}
@@ -8081,9 +8099,10 @@ delete_instr(isn_T *isn)
{
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
+ isn->isn_arg.funcref.fr_func;
ufunc_T *ufunc = dfunc->df_ufunc;
if (func_name_refcount(dfunc->df_ufunc->uf_name))
func_ptr_unref(dfunc->df_ufunc);
if (ufunc != NULL && func_name_refcount(ufunc->uf_name))
func_ptr_unref(ufunc);
}
break;