Mercurial > vim
comparison src/evalvars.c @ 22942:4759d13193fb v8.2.2018
patch 8.2.2018: Vim9: script variable not found from lambda
Commit: https://github.com/vim/vim/commit/2ea95b61f4bec9b71cf916eebe8d11abc76617a0
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 19 21:47:56 2020 +0100
patch 8.2.2018: Vim9: script variable not found from lambda
Problem: Vim9: script variable not found from lambda.
Solution: In a lambda also check the script hashtab for a variable without a
scope. (closes #7329)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 19 Nov 2020 22:00:05 +0100 |
parents | 3e0f909ca1f2 |
children | ad674a98058a |
comparison
equal
deleted
inserted
replaced
22941:2aa5ad6cb21c | 22942:4759d13193fb |
---|---|
2626 ret = find_var_in_ht(ht, *name, varname, no_autoload || htp != NULL); | 2626 ret = find_var_in_ht(ht, *name, varname, no_autoload || htp != NULL); |
2627 if (ret != NULL) | 2627 if (ret != NULL) |
2628 return ret; | 2628 return ret; |
2629 | 2629 |
2630 // Search in parent scope for lambda | 2630 // Search in parent scope for lambda |
2631 return find_var_in_scoped_ht(name, no_autoload || htp != NULL); | 2631 ret = find_var_in_scoped_ht(name, no_autoload || htp != NULL); |
2632 if (ret != NULL) | |
2633 return ret; | |
2634 | |
2635 // in Vim9 script items without a scope can be script-local | |
2636 if (in_vim9script() && name[0] != NUL && name[1] != ':') | |
2637 { | |
2638 ht = get_script_local_ht(); | |
2639 if (ht != NULL) | |
2640 { | |
2641 ret = find_var_in_ht(ht, *name, varname, | |
2642 no_autoload || htp != NULL); | |
2643 if (ret != NULL) | |
2644 { | |
2645 if (htp != NULL) | |
2646 *htp = ht; | |
2647 return ret; | |
2648 } | |
2649 } | |
2650 } | |
2651 | |
2652 return NULL; | |
2632 } | 2653 } |
2633 | 2654 |
2634 /* | 2655 /* |
2635 * Find variable "varname" in hashtab "ht" with name "htname". | 2656 * Find variable "varname" in hashtab "ht" with name "htname". |
2636 * When "varname" is empty returns curwin/curtab/etc vars dictionary. | 2657 * When "varname" is empty returns curwin/curtab/etc vars dictionary. |