comparison src/vim9expr.c @ 27191:63f8dbcf6a74 v8.2.4124

patch 8.2.4124: Vim9: method in compiled function may not see script item Commit: https://github.com/vim/vim/commit/6389baa6691fde4ca56ec6243ed83322543df300 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 17 20:50:40 2022 +0000 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 https://github.com/vim/vim/issues/9496)
author Bram Moolenaar <Bram@vim.org>
date Mon, 17 Jan 2022 22:00:03 +0100
parents 6af18c69c59d
children facb54d20a50
comparison
equal deleted inserted replaced
27190:19849ccc38a0 27191:63f8dbcf6a74
1730 if (compile_parenthesis(arg, cctx, ppconst) == FAIL) 1730 if (compile_parenthesis(arg, cctx, ppconst) == FAIL)
1731 return FAIL; 1731 return FAIL;
1732 } 1732 }
1733 else 1733 else
1734 { 1734 {
1735 int fail;
1736 int save_len = cctx->ctx_ufunc->uf_lines.ga_len;
1737
1735 *paren = NUL; 1738 *paren = NUL;
1736 if (compile_expr8(arg, cctx, ppconst) == FAIL 1739 // do not look in the next line
1737 || *skipwhite(*arg) != NUL) 1740 cctx->ctx_ufunc->uf_lines.ga_len = 1;
1741 fail = compile_expr8(arg, cctx, ppconst) == FAIL
1742 || *skipwhite(*arg) != NUL;
1743 *paren = '(';
1744 cctx->ctx_ufunc->uf_lines.ga_len = save_len;
1745 if (fail)
1738 { 1746 {
1739 *paren = '(';
1740 semsg(_(e_invalid_expression_str), pstart); 1747 semsg(_(e_invalid_expression_str), pstart);
1741 return FAIL; 1748 return FAIL;
1742 } 1749 }
1743 *paren = '(';
1744 } 1750 }
1745
1746 // Remember the next instruction index, where the instructions
1747 // for arguments are being written.
1748 expr_isn_end = cctx->ctx_instr.ga_len;
1749 1751
1750 // Compile the arguments. 1752 // Compile the arguments.
1751 if (**arg != '(') 1753 if (**arg != '(')
1752 { 1754 {
1753 if (*skipwhite(*arg) == '(') 1755 if (*skipwhite(*arg) == '(')
1754 emsg(_(e_no_white_space_allowed_before_parenthesis)); 1756 emsg(_(e_no_white_space_allowed_before_parenthesis));
1755 else 1757 else
1756 semsg(_(e_missing_parenthesis_str), *arg); 1758 semsg(_(e_missing_parenthesis_str), *arg);
1757 return FAIL; 1759 return FAIL;
1758 } 1760 }
1761
1762 // Remember the next instruction index, where the instructions
1763 // for arguments are being written.
1764 expr_isn_end = cctx->ctx_instr.ga_len;
1765
1759 *arg = skipwhite(*arg + 1); 1766 *arg = skipwhite(*arg + 1);
1760 if (compile_arguments(arg, cctx, &argcount, FALSE) == FAIL) 1767 if (compile_arguments(arg, cctx, &argcount, FALSE) == FAIL)
1761 return FAIL; 1768 return FAIL;
1762 1769
1763 // Move the instructions for the arguments to before the 1770 // Move the instructions for the arguments to before the