0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4124: Vim9: method in compiled function may not see script item

Problem:    Vim9: method in compiled function may not see script item.
Solution:   Make sure not to skip to the next line. (closes #9496)
This commit is contained in:
Bram Moolenaar
2022-01-17 20:50:40 +00:00
parent 15d1635e50
commit 6389baa669
3 changed files with 85 additions and 50 deletions

View File

@@ -1732,21 +1732,23 @@ compile_subscript(
}
else
{
int fail;
int save_len = cctx->ctx_ufunc->uf_lines.ga_len;
*paren = NUL;
if (compile_expr8(arg, cctx, ppconst) == FAIL
|| *skipwhite(*arg) != NUL)
// do not look in the next line
cctx->ctx_ufunc->uf_lines.ga_len = 1;
fail = compile_expr8(arg, cctx, ppconst) == FAIL
|| *skipwhite(*arg) != NUL;
*paren = '(';
cctx->ctx_ufunc->uf_lines.ga_len = save_len;
if (fail)
{
*paren = '(';
semsg(_(e_invalid_expression_str), pstart);
return FAIL;
}
*paren = '(';
}
// Remember the next instruction index, where the instructions
// for arguments are being written.
expr_isn_end = cctx->ctx_instr.ga_len;
// Compile the arguments.
if (**arg != '(')
{
@@ -1756,6 +1758,11 @@ compile_subscript(
semsg(_(e_missing_parenthesis_str), *arg);
return FAIL;
}
// Remember the next instruction index, where the instructions
// for arguments are being written.
expr_isn_end = cctx->ctx_instr.ga_len;
*arg = skipwhite(*arg + 1);
if (compile_arguments(arg, cctx, &argcount, FALSE) == FAIL)
return FAIL;