comparison src/vim9instr.c @ 27376:1a6421c5be20 v8.2.4216

patch 8.2.4216: Vim9: cannot use a function from an autoload import directly Commit: https://github.com/vim/vim/commit/06b77229ca704d00c4f138ed0377556e54d5851f Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 25 15:51:56 2022 +0000 patch 8.2.4216: Vim9: cannot use a function from an autoload import directly Problem: Vim9: cannot use a function from an autoload import directly. Solution: Add the AUTOLOAD instruction to figure out at runtime. (closes #9620)
author Bram Moolenaar <Bram@vim.org>
date Tue, 25 Jan 2022 17:00:06 +0100
parents 9a9c34c84cd4
children 4c1bdee75bed
comparison
equal deleted inserted replaced
27375:90523078c8e2 27376:1a6421c5be20
738 STRCPY(funcname + 2, name); 738 STRCPY(funcname + 2, name);
739 } 739 }
740 } 740 }
741 741
742 isn->isn_arg.string = funcname; 742 isn->isn_arg.string = funcname;
743 return OK;
744 }
745
746 /*
747 * Generate an ISN_AUTOLOAD instruction.
748 */
749 int
750 generate_AUTOLOAD(cctx_T *cctx, char_u *name, type_T *type)
751 {
752 isn_T *isn;
753
754 RETURN_OK_IF_SKIP(cctx);
755 if ((isn = generate_instr_type(cctx, ISN_AUTOLOAD, type)) == NULL)
756 return FAIL;
757 isn->isn_arg.string = vim_strsave(name);
758 if (isn->isn_arg.string == NULL)
759 return FAIL;
743 return OK; 760 return OK;
744 } 761 }
745 762
746 /* 763 /*
747 * Generate an ISN_GETITEM instruction with "index". 764 * Generate an ISN_GETITEM instruction with "index".
1927 void 1944 void
1928 delete_instr(isn_T *isn) 1945 delete_instr(isn_T *isn)
1929 { 1946 {
1930 switch (isn->isn_type) 1947 switch (isn->isn_type)
1931 { 1948 {
1949 case ISN_AUTOLOAD:
1932 case ISN_DEF: 1950 case ISN_DEF:
1933 case ISN_EXEC: 1951 case ISN_EXEC:
1934 case ISN_EXECRANGE: 1952 case ISN_EXECRANGE:
1935 case ISN_EXEC_SPLIT: 1953 case ISN_EXEC_SPLIT:
1936 case ISN_LEGACY_EVAL: 1954 case ISN_LEGACY_EVAL: