comparison src/scriptfile.c @ 28447:6f753a8125f0 v8.2.4748

patch 8.2.4748: cannot use an imported function in a mapping Commit: https://github.com/vim/vim/commit/8944551534b311a2d25acf6e8db235c6d906256c Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 14 12:58:23 2022 +0100 patch 8.2.4748: cannot use an imported function in a mapping Problem: Cannot use an imported function in a mapping. Solution: Recognize <SID>name.Func.
author Bram Moolenaar <Bram@vim.org>
date Thu, 14 Apr 2022 14:00:05 +0200
parents 2655935b5ccc
children 80ed5ad30d28
comparison
equal deleted inserted replaced
28446:224455817fac 28447:6f753a8125f0
115 --exestack.ga_len; 115 --exestack.ga_len;
116 return ((estack_T *)exestack.ga_data) + exestack.ga_len; 116 return ((estack_T *)exestack.ga_data) + exestack.ga_len;
117 } 117 }
118 118
119 /* 119 /*
120 * Get the current value for <sfile> in allocated memory. 120 * Get the current value for "which" in allocated memory.
121 * "which" is ESTACK_SFILE for <sfile>, ESTACK_STACK for <stack> or 121 * "which" is ESTACK_SFILE for <sfile>, ESTACK_STACK for <stack> or
122 * ESTACK_SCRIPT for <script>. 122 * ESTACK_SCRIPT for <script>.
123 */ 123 */
124 char_u * 124 char_u *
125 estack_sfile(estack_arg_T which UNUSED) 125 estack_sfile(estack_arg_T which UNUSED)
2466 char_u *scriptname, *tofree; 2466 char_u *scriptname, *tofree;
2467 int ret = FALSE; 2467 int ret = FALSE;
2468 int i; 2468 int i;
2469 int ret_sid; 2469 int ret_sid;
2470 2470
2471 // If the name starts with "<SNR>123_" then "123" is the script ID.
2472 if (name[0] == K_SPECIAL && name[1] == KS_EXTRA && name[2] == KE_SNR)
2473 {
2474 p = name + 3;
2475 ret_sid = (int)getdigits(&p);
2476 if (*p == '_' && SCRIPT_ID_VALID(ret_sid))
2477 {
2478 may_load_script(ret_sid, &ret);
2479 return ret;
2480 }
2481 }
2482
2471 // If there is no '#' after name[0] there is no package name. 2483 // If there is no '#' after name[0] there is no package name.
2472 p = vim_strchr(name, AUTOLOAD_CHAR); 2484 p = vim_strchr(name, AUTOLOAD_CHAR);
2473 if (p == NULL || p == name) 2485 if (p == NULL || p == name)
2474 return FALSE; 2486 return FALSE;
2475 2487