]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4972: Vim9: compilation fails when using dict member when skipping v8.2.4972
authorBram Moolenaar <Bram@vim.org>
Tue, 17 May 2022 14:03:33 +0000 (15:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 17 May 2022 14:03:33 +0000 (15:03 +0100)
Problem:    Vim9: compilation fails when using dict member when skipping.
Solution:   Do not generate ISN_USEDICT when skipping. (closes #10433)

src/testdir/test_vim9_expr.vim
src/version.c
src/vim9expr.c

index e43eba73abb43d7ed6c05cdb7c4adfd222360bae..401ab076b0baca29e08e5e67c5d7ab4dac5c4892 100644 (file)
@@ -452,6 +452,12 @@ def Test_expr3()
       g:vals = []
       assert_equal(false, g:Record(1) && g:Record(true) && g:Record(0))
       assert_equal([1, true, 0], g:vals)
+
+      var failed = false
+      if false && g:a == g:b.c
+        failed = true
+      endif
+      assert_false(failed)
   END
   v9.CheckDefAndScriptSuccess(lines)
 enddef
index 10804ecaa96292d2f4f658d25209b95013da8499..873b17bfd96e91ed152677dd0b2a46197ecf62de 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4972,
 /**/
     4971,
 /**/
index 3375478d03fb98902b13d284097da3bc56805f6d..eaea089f98e712af9b0b872264758bb8e812ba69 100644 (file)
@@ -2102,7 +2102,8 @@ compile_subscript(
 
     // Turn "dict.Func" into a partial for "Func" bound to "dict".
     // This needs to be done at runtime to be able to check the type.
-    if (keeping_dict && generate_instr(cctx, ISN_USEDICT) == NULL)
+    if (keeping_dict && cctx->ctx_skip != SKIP_YES
+                                 && generate_instr(cctx, ISN_USEDICT) == NULL)
        return FAIL;
 
     return OK;