Mercurial > vim
comparison src/vim9expr.c @ 27043:15f40772e10a v8.2.4050
patch 8.2.4050: Vim9: need to prefix every item in an autoload script
Commit: https://github.com/vim/vim/commit/dc4451df61a6aa12a0661817b7094fb32f09e11d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 9 21:36:37 2022 +0000
patch 8.2.4050: Vim9: need to prefix every item in an autoload script
Problem: Vim9: need to prefix every item in an autoload script.
Solution: First step in supporting "vim9script autoload" and "import
autoload".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 09 Jan 2022 22:45:04 +0100 |
parents | fc19375787dd |
children | 1e2a6c6c7e42 |
comparison
equal
deleted
inserted
replaced
27042:8fc14d120630 | 27043:15f40772e10a |
---|---|
264 generate_VIM9SCRIPT(cctx, ISN_LOADSCRIPT, | 264 generate_VIM9SCRIPT(cctx, ISN_LOADSCRIPT, |
265 current_sctx.sc_sid, idx, sv->sv_type); | 265 current_sctx.sc_sid, idx, sv->sv_type); |
266 return OK; | 266 return OK; |
267 } | 267 } |
268 | 268 |
269 import = end == NULL ? NULL : find_imported(name, 0, cctx); | 269 import = end == NULL ? NULL : find_imported(name, 0, FALSE, cctx); |
270 if (import != NULL) | 270 if (import != NULL) |
271 { | 271 { |
272 char_u *p = skipwhite(*end); | 272 char_u *p = skipwhite(*end); |
273 char_u *exp_name; | 273 char_u *exp_name; |
274 int cc; | 274 int cc; |
275 ufunc_T *ufunc; | 275 ufunc_T *ufunc; |
276 type_T *type; | 276 type_T *type; |
277 | 277 |
278 // TODO: if this is an autoload import do something else. | |
278 // Need to lookup the member. | 279 // Need to lookup the member. |
279 if (*p != '.') | 280 if (*p != '.') |
280 { | 281 { |
281 semsg(_(e_expected_dot_after_name_str), start); | 282 semsg(_(e_expected_dot_after_name_str), start); |
282 return FAIL; | 283 return FAIL; |
472 else | 473 else |
473 { | 474 { |
474 // "var" can be script-local even without using "s:" if it | 475 // "var" can be script-local even without using "s:" if it |
475 // already exists in a Vim9 script or when it's imported. | 476 // already exists in a Vim9 script or when it's imported. |
476 if (script_var_exists(*arg, len, cctx) == OK | 477 if (script_var_exists(*arg, len, cctx) == OK |
477 || find_imported(name, 0, cctx) != NULL) | 478 || find_imported(name, 0, FALSE, cctx) != NULL) |
478 res = compile_load_scriptvar(cctx, name, *arg, &end, FALSE); | 479 res = compile_load_scriptvar(cctx, name, *arg, &end, FALSE); |
479 | 480 |
480 // When evaluating an expression and the name starts with an | 481 // When evaluating an expression and the name starts with an |
481 // uppercase letter it can be a user defined function. | 482 // uppercase letter it can be a user defined function. |
482 // generate_funcref() will fail if the function can't be found. | 483 // generate_funcref() will fail if the function can't be found. |