diff src/eval.c @ 28129:dd2ed5345f20 v8.2.4589

patch 8.2.4589: cannot index the g: dictionary Commit: https://github.com/vim/vim/commit/2e17fef225a58f478dc24ab1aaa20390c9abce57 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Mar 18 19:44:48 2022 +0000 patch 8.2.4589: cannot index the g: dictionary Problem: Cannot index the g: dictionary. Solution: Recognize using "g:[key]". (closes https://github.com/vim/vim/issues/9969)
author Bram Moolenaar <Bram@vim.org>
date Fri, 18 Mar 2022 20:45:04 +0100
parents 57ea74314c1b
children f34afadbef47
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -929,7 +929,8 @@ get_lval(
 	if (vim9script)
 	{
 	    // "a: type" is declaring variable "a" with a type, not "a:".
-	    if (p == name + 2 && p[-1] == ':')
+	    // However, "g:[key]" is indexing a dictionary.
+	    if (p == name + 2 && p[-1] == ':' && *p != '[')
 	    {
 		--p;
 		lp->ll_name_end = p;