comparison src/usercmd.c @ 23390:9a5f12b36273 v8.2.2238

patch 8.2.2238: Vim9: cannot load a Vim9 script without the +eval feature Commit: https://github.com/vim/vim/commit/9b8d62267f583d5dc042920adb1de046959ad11d Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 28 18:26:00 2020 +0100 patch 8.2.2238: Vim9: cannot load a Vim9 script without the +eval feature Problem: Vim9: cannot load a Vim9 script without the +eval feature. Solution: Support Vim9 script syntax without the +eval feature.
author Bram Moolenaar <Bram@vim.org>
date Mon, 28 Dec 2020 18:30:03 +0100
parents 8968ed4ba4ba
children 7334bf933510
comparison
equal deleted inserted replaced
23389:f67d856ae24e 23390:9a5f12b36273
19 long_u uc_argt; // The argument type 19 long_u uc_argt; // The argument type
20 char_u *uc_rep; // The command's replacement string 20 char_u *uc_rep; // The command's replacement string
21 long uc_def; // The default value for a range/count 21 long uc_def; // The default value for a range/count
22 int uc_compl; // completion type 22 int uc_compl; // completion type
23 cmd_addr_T uc_addr_type; // The command's address type 23 cmd_addr_T uc_addr_type; // The command's address type
24 sctx_T uc_script_ctx; // SCTX where the command was defined
24 # ifdef FEAT_EVAL 25 # ifdef FEAT_EVAL
25 sctx_T uc_script_ctx; // SCTX where the command was defined
26 char_u *uc_compl_arg; // completion argument if any 26 char_u *uc_compl_arg; // completion argument if any
27 # endif 27 # endif
28 } ucmd_T; 28 } ucmd_T;
29 29
30 // List of all user commands. 30 // List of all user commands.
952 952
953 cmd->uc_rep = rep_buf; 953 cmd->uc_rep = rep_buf;
954 cmd->uc_argt = argt; 954 cmd->uc_argt = argt;
955 cmd->uc_def = def; 955 cmd->uc_def = def;
956 cmd->uc_compl = compl; 956 cmd->uc_compl = compl;
957 cmd->uc_script_ctx = current_sctx;
957 #ifdef FEAT_EVAL 958 #ifdef FEAT_EVAL
958 cmd->uc_script_ctx = current_sctx;
959 cmd->uc_script_ctx.sc_lnum += SOURCING_LNUM; 959 cmd->uc_script_ctx.sc_lnum += SOURCING_LNUM;
960 cmd->uc_compl_arg = compl_arg; 960 cmd->uc_compl_arg = compl_arg;
961 #endif 961 #endif
962 cmd->uc_addr_type = addr_type; 962 cmd->uc_addr_type = addr_type;
963 963
1571 size_t len, totlen; 1571 size_t len, totlen;
1572 1572
1573 size_t split_len = 0; 1573 size_t split_len = 0;
1574 char_u *split_buf = NULL; 1574 char_u *split_buf = NULL;
1575 ucmd_T *cmd; 1575 ucmd_T *cmd;
1576 #ifdef FEAT_EVAL
1577 sctx_T save_current_sctx = current_sctx; 1576 sctx_T save_current_sctx = current_sctx;
1578 #endif
1579 1577
1580 if (eap->cmdidx == CMD_USER) 1578 if (eap->cmdidx == CMD_USER)
1581 cmd = USER_CMD(eap->useridx); 1579 cmd = USER_CMD(eap->useridx);
1582 else 1580 else
1583 cmd = USER_CMD_GA(&curbuf->b_ucmds, eap->useridx); 1581 cmd = USER_CMD_GA(&curbuf->b_ucmds, eap->useridx);
1672 vim_free(split_buf); 1670 vim_free(split_buf);
1673 return; 1671 return;
1674 } 1672 }
1675 } 1673 }
1676 1674
1675 current_sctx.sc_version = cmd->uc_script_ctx.sc_version;
1677 #ifdef FEAT_EVAL 1676 #ifdef FEAT_EVAL
1678 current_sctx.sc_sid = cmd->uc_script_ctx.sc_sid; 1677 current_sctx.sc_sid = cmd->uc_script_ctx.sc_sid;
1679 current_sctx.sc_version = cmd->uc_script_ctx.sc_version;
1680 #endif 1678 #endif
1681 (void)do_cmdline(buf, eap->getline, eap->cookie, 1679 (void)do_cmdline(buf, eap->getline, eap->cookie,
1682 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED); 1680 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
1683 #ifdef FEAT_EVAL
1684 current_sctx = save_current_sctx; 1681 current_sctx = save_current_sctx;
1685 #endif
1686 vim_free(buf); 1682 vim_free(buf);
1687 vim_free(split_buf); 1683 vim_free(split_buf);
1688 } 1684 }