Mercurial > vim
comparison src/vim9execute.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 | fabe722b24e9 |
children | 52ef65c0637f |
comparison
equal
deleted
inserted
replaced
28446:224455817fac | 28447:6f753a8125f0 |
---|---|
1656 || did_emsg) | 1656 || did_emsg) |
1657 return FAIL; | 1657 return FAIL; |
1658 return OK; | 1658 return OK; |
1659 } | 1659 } |
1660 | 1660 |
1661 /* | |
1662 * If script "sid" is not loaded yet then load it now. | |
1663 * Caller must make sure "sid" is a valid script ID. | |
1664 * "loaded" is set to TRUE if the script had to be loaded. | |
1665 * Returns FAIL if loading fails, OK if already loaded or loaded now. | |
1666 */ | |
1667 int | |
1668 may_load_script(int sid, int *loaded) | |
1669 { | |
1670 scriptitem_T *si = SCRIPT_ITEM(sid); | |
1671 | |
1672 if (si->sn_state == SN_STATE_NOT_LOADED) | |
1673 { | |
1674 *loaded = TRUE; | |
1675 if (do_source(si->sn_name, FALSE, DOSO_NONE, NULL) == FAIL) | |
1676 { | |
1677 semsg(_(e_cant_open_file_str), si->sn_name); | |
1678 return FAIL; | |
1679 } | |
1680 } | |
1681 return OK; | |
1682 } | |
1683 | |
1661 // used for v_instr of typval of VAR_INSTR | 1684 // used for v_instr of typval of VAR_INSTR |
1662 struct instr_S { | 1685 struct instr_S { |
1663 ectx_T *instr_ectx; | 1686 ectx_T *instr_ectx; |
1664 isn_T *instr_instr; | 1687 isn_T *instr_instr; |
1665 }; | 1688 }; |
2630 } | 2653 } |
2631 break; | 2654 break; |
2632 | 2655 |
2633 case ISN_SOURCE: | 2656 case ISN_SOURCE: |
2634 { | 2657 { |
2635 scriptitem_T *si = SCRIPT_ITEM(iptr->isn_arg.number); | 2658 int notused; |
2636 | 2659 SOURCING_LNUM = iptr->isn_lnum; |
2637 if (si->sn_state == SN_STATE_NOT_LOADED) | 2660 if (may_load_script((int)iptr->isn_arg.number, ¬used) |
2638 { | |
2639 SOURCING_LNUM = iptr->isn_lnum; | |
2640 if (do_source(si->sn_name, FALSE, DOSO_NONE, NULL) | |
2641 == FAIL) | 2661 == FAIL) |
2642 { | 2662 goto on_error; |
2643 semsg(_(e_cant_open_file_str), si->sn_name); | |
2644 goto on_error; | |
2645 } | |
2646 } | |
2647 } | 2663 } |
2648 break; | 2664 break; |
2649 | 2665 |
2650 // execute :substitute with an expression | 2666 // execute :substitute with an expression |
2651 case ISN_SUBSTITUTE: | 2667 case ISN_SUBSTITUTE: |