From: Bram Moolenaar Date: Thu, 12 Jan 2023 20:04:51 +0000 (+0000) Subject: patch 9.0.1186: imported class does not work when used twice in a line X-Git-Tag: v9.0.1186 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4059400993ff380414dce9b577eff0f8c86b7725;p=thirdparty%2Fvim.git patch 9.0.1186: imported class does not work when used twice in a line Problem: Imported class does not work when used twice in a line. Solution: Fix the type parsing. --- diff --git a/src/evalvars.c b/src/evalvars.c index e473e48763..8061a5096d 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -3122,8 +3122,12 @@ eval_variable_import( return FAIL; if (rettv->v_type == VAR_ANY && *s == '.') { + char_u *ns = s + 1; + s = ns; + while (ASCII_ISALNUM(*s) || *s == '_') + ++s; int sid = rettv->vval.v_number; - return eval_variable(s + 1, 0, sid, rettv, NULL, 0); + return eval_variable(ns, (int)(s - ns), sid, rettv, NULL, 0); } return OK; } diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index cf7a6c1ce2..c6c583a545 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -992,6 +992,10 @@ def Test_class_import() a = animal.Animal.new('fish', 'Eric') assert_equal('fish', a.kind) assert_equal('Eric', a.name) + + var b: animal.Animal = animal.Animal.new('cat', 'Garfield') + assert_equal('cat', b.kind) + assert_equal('Garfield', b.name) END v9.CheckScriptSuccess(lines) enddef diff --git a/src/version.c b/src/version.c index a0fc017a03..f702b36a34 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1186, /**/ 1185, /**/