Mercurial > vim
comparison src/evalvars.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 | c9474ae175f4 |
children | 140102677c12 |
comparison
equal
deleted
inserted
replaced
27042:8fc14d120630 | 27043:15f40772e10a |
---|---|
2681 { | 2681 { |
2682 imported_T *import = NULL; | 2682 imported_T *import = NULL; |
2683 char_u *p = STRNCMP(name, "s:", 2) == 0 ? name + 2 : name; | 2683 char_u *p = STRNCMP(name, "s:", 2) == 0 ? name + 2 : name; |
2684 | 2684 |
2685 if (sid == 0) | 2685 if (sid == 0) |
2686 import = find_imported(p, 0, NULL); | 2686 import = find_imported(p, 0, TRUE, NULL); |
2687 | 2687 |
2688 // imported variable from another script | 2688 // imported variable from another script |
2689 if (import != NULL || sid != 0) | 2689 if (import != NULL || sid != 0) |
2690 { | 2690 { |
2691 if ((flags & EVAL_VAR_IMPORT) == 0) | 2691 if ((flags & EVAL_VAR_IMPORT) == 0) |
3013 | 3013 |
3014 hi = hash_find(ht, p); | 3014 hi = hash_find(ht, p); |
3015 res = HASHITEM_EMPTY(hi) ? FAIL : OK; | 3015 res = HASHITEM_EMPTY(hi) ? FAIL : OK; |
3016 | 3016 |
3017 // if not script-local, then perhaps imported | 3017 // if not script-local, then perhaps imported |
3018 if (res == FAIL && find_imported(p, 0, NULL) != NULL) | 3018 if (res == FAIL && find_imported(p, 0, FALSE, NULL) != NULL) |
3019 res = OK; | 3019 res = OK; |
3020 if (p != buffer) | 3020 if (p != buffer) |
3021 vim_free(p); | 3021 vim_free(p); |
3022 | 3022 |
3023 // Find a function, so that a following "->" works. | 3023 // Find a function, so that a following "->" works. |
3386 | 3386 |
3387 di = find_var_in_ht(ht, 0, varname, TRUE); | 3387 di = find_var_in_ht(ht, 0, varname, TRUE); |
3388 | 3388 |
3389 if (di == NULL && var_in_vim9script) | 3389 if (di == NULL && var_in_vim9script) |
3390 { | 3390 { |
3391 imported_T *import = find_imported(varname, 0, NULL); | 3391 imported_T *import = find_imported(varname, 0, FALSE, NULL); |
3392 | 3392 |
3393 if (import != NULL) | 3393 if (import != NULL) |
3394 { | 3394 { |
3395 // imported name space cannot be used | 3395 // imported name space cannot be used |
3396 if ((flags & ASSIGN_NO_DECL) == 0) | 3396 if ((flags & ASSIGN_NO_DECL) == 0) |