Mercurial > vim
comparison src/vim9execute.c @ 25605:6f13d9ea0d04 v8.2.3339
patch 8.2.3339: Vim9: cannot lock a member in a local dict
Commit: https://github.com/vim/vim/commit/aacc966c5d0ed91e33ed32b08f17cf4df3ca1394
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 13 19:40:51 2021 +0200
patch 8.2.3339: Vim9: cannot lock a member in a local dict
Problem: Vim9: cannot lock a member in a local dict.
Solution: Get the local dict from the stack and pass it to get_lval().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 13 Aug 2021 19:45:03 +0200 |
parents | ea69398b40d1 |
children | f8bcd21e6e24 |
comparison
equal
deleted
inserted
replaced
25604:5ad1d3061d62 | 25605:6f13d9ea0d04 |
---|---|
1394 } | 1394 } |
1395 ++ufunc->uf_refcount; | 1395 ++ufunc->uf_refcount; |
1396 return OK; | 1396 return OK; |
1397 } | 1397 } |
1398 | 1398 |
1399 /* | |
1400 * Execute iptr->isn_arg.string as an Ex command. | |
1401 */ | |
1402 static int | |
1403 exec_command(isn_T *iptr) | |
1404 { | |
1405 source_cookie_T cookie; | |
1406 | |
1407 SOURCING_LNUM = iptr->isn_lnum; | |
1408 // Pass getsourceline to get an error for a missing ":end" | |
1409 // command. | |
1410 CLEAR_FIELD(cookie); | |
1411 cookie.sourcing_lnum = iptr->isn_lnum - 1; | |
1412 if (do_cmdline(iptr->isn_arg.string, | |
1413 getsourceline, &cookie, | |
1414 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED) == FAIL | |
1415 || did_emsg) | |
1416 return FAIL; | |
1417 return OK; | |
1418 } | |
1419 | |
1399 // used for v_instr of typval of VAR_INSTR | 1420 // used for v_instr of typval of VAR_INSTR |
1400 struct instr_S { | 1421 struct instr_S { |
1401 ectx_T *instr_ectx; | 1422 ectx_T *instr_ectx; |
1402 isn_T *instr_instr; | 1423 isn_T *instr_instr; |
1403 }; | 1424 }; |
1635 iptr = &ectx->ec_instr[ectx->ec_iidx++]; | 1656 iptr = &ectx->ec_instr[ectx->ec_iidx++]; |
1636 switch (iptr->isn_type) | 1657 switch (iptr->isn_type) |
1637 { | 1658 { |
1638 // execute Ex command line | 1659 // execute Ex command line |
1639 case ISN_EXEC: | 1660 case ISN_EXEC: |
1640 { | 1661 if (exec_command(iptr) == FAIL) |
1641 source_cookie_T cookie; | 1662 goto on_error; |
1642 | |
1643 SOURCING_LNUM = iptr->isn_lnum; | |
1644 // Pass getsourceline to get an error for a missing ":end" | |
1645 // command. | |
1646 CLEAR_FIELD(cookie); | |
1647 cookie.sourcing_lnum = iptr->isn_lnum - 1; | |
1648 if (do_cmdline(iptr->isn_arg.string, | |
1649 getsourceline, &cookie, | |
1650 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED) | |
1651 == FAIL | |
1652 || did_emsg) | |
1653 goto on_error; | |
1654 } | |
1655 break; | 1663 break; |
1656 | 1664 |
1657 // execute Ex command line split at NL characters. | 1665 // execute Ex command line split at NL characters. |
1658 case ISN_EXEC_SPLIT: | 1666 case ISN_EXEC_SPLIT: |
1659 { | 1667 { |
2878 break; | 2886 break; |
2879 case ISN_UNLETENV: | 2887 case ISN_UNLETENV: |
2880 vim_unsetenv(iptr->isn_arg.unlet.ul_name); | 2888 vim_unsetenv(iptr->isn_arg.unlet.ul_name); |
2881 break; | 2889 break; |
2882 | 2890 |
2891 case ISN_LOCKUNLOCK: | |
2892 { | |
2893 typval_T *lval_root_save = lval_root; | |
2894 int res; | |
2895 | |
2896 // Stack has the local variable, argument the whole :lock | |
2897 // or :unlock command, like ISN_EXEC. | |
2898 --ectx->ec_stack.ga_len; | |
2899 lval_root = STACK_TV_BOT(0); | |
2900 res = exec_command(iptr); | |
2901 clear_tv(lval_root); | |
2902 lval_root = lval_root_save; | |
2903 if (res == FAIL) | |
2904 goto on_error; | |
2905 } | |
2906 break; | |
2907 | |
2883 case ISN_LOCKCONST: | 2908 case ISN_LOCKCONST: |
2884 item_lock(STACK_TV_BOT(-1), 100, TRUE, TRUE); | 2909 item_lock(STACK_TV_BOT(-1), 100, TRUE, TRUE); |
2885 break; | 2910 break; |
2886 | 2911 |
2887 // create a list from items on the stack; uses a single allocation | 2912 // create a list from items on the stack; uses a single allocation |
5241 case ISN_UNLETINDEX: | 5266 case ISN_UNLETINDEX: |
5242 smsg("%s%4d UNLETINDEX", pfx, current); | 5267 smsg("%s%4d UNLETINDEX", pfx, current); |
5243 break; | 5268 break; |
5244 case ISN_UNLETRANGE: | 5269 case ISN_UNLETRANGE: |
5245 smsg("%s%4d UNLETRANGE", pfx, current); | 5270 smsg("%s%4d UNLETRANGE", pfx, current); |
5271 break; | |
5272 case ISN_LOCKUNLOCK: | |
5273 smsg("%s%4d LOCKUNLOCK %s", pfx, current, iptr->isn_arg.string); | |
5246 break; | 5274 break; |
5247 case ISN_LOCKCONST: | 5275 case ISN_LOCKCONST: |
5248 smsg("%s%4d LOCKCONST", pfx, current); | 5276 smsg("%s%4d LOCKCONST", pfx, current); |
5249 break; | 5277 break; |
5250 case ISN_NEWLIST: | 5278 case ISN_NEWLIST: |