diff options
author | Bram Moolenaar <Bram@vim.org> | 2023-01-12 17:06:27 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-12 17:06:27 +0000 |
commit | a86655af84f1596f0f3ef22813724fe06f1e4809 (patch) | |
tree | bbf962d3a9b0597e34be6cecc9657241bb3346f3 /src/evalvars.c | |
parent | a94bd9d9396183eb7781f8d6a5a0e6e97442e9ed (diff) |
patch 9.0.1185: using class from imported script not testedv9.0.1185
Problem: Using class from imported script not tested.
Solution: Add tests. Implement what is missing.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index c2cb61c37a..e473e48763 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -3105,6 +3105,31 @@ eval_variable( } /* + * Get the value of internal variable "name", also handling "import.name". + * Return OK or FAIL. If OK is returned "rettv" must be cleared. + */ + int +eval_variable_import( + char_u *name, + typval_T *rettv) +{ + char_u *s = name; + while (ASCII_ISALNUM(*s) || *s == '_') + ++s; + int len = (int)(s - name); + + if (eval_variable(name, len, 0, rettv, NULL, EVAL_VAR_IMPORT) == FAIL) + return FAIL; + if (rettv->v_type == VAR_ANY && *s == '.') + { + int sid = rettv->vval.v_number; + return eval_variable(s + 1, 0, sid, rettv, NULL, 0); + } + return OK; +} + + +/* * Check if variable "name[len]" is a local variable or an argument. * If so, "*eval_lavars_used" is set to TRUE. */ |