To: vim_dev@googlegroups.com Subject: Patch 9.0.0224 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0224 Problem: Using NULL pointer when skipping compiled code. Solution: Check for skipping. Files: src/vim9compile.c, src/testdir/test_vim9_script.vim *** ../vim-9.0.0223/src/vim9compile.c 2022-08-16 19:34:40.863551410 +0100 --- src/vim9compile.c 2022-08-17 15:54:42.456682402 +0100 *************** *** 1165,1175 **** generate_LOADV(cctx, name + 2); break; case dest_local: ! if (lvar->lv_from_outer > 0) ! generate_LOADOUTER(cctx, lvar->lv_idx, lvar->lv_from_outer, type); ! else ! generate_LOAD(cctx, ISN_LOAD, lvar->lv_idx, NULL, type); break; case dest_expr: // list or dict value should already be on the stack. --- 1165,1178 ---- generate_LOADV(cctx, name + 2); break; case dest_local: ! if (cctx->ctx_skip != SKIP_YES) ! { ! if (lvar->lv_from_outer > 0) ! generate_LOADOUTER(cctx, lvar->lv_idx, lvar->lv_from_outer, type); ! else ! generate_LOAD(cctx, ISN_LOAD, lvar->lv_idx, NULL, type); ! } break; case dest_expr: // list or dict value should already be on the stack. *************** *** 1952,1957 **** --- 1955,1963 ---- } } + if (cctx->ctx_skip == SKIP_YES) + return OK; + // Load the dict or list. On the stack we then have: // - value (for assignment, not for :unlet) // - index *** ../vim-9.0.0223/src/testdir/test_vim9_script.vim 2022-08-06 18:12:02.966750593 +0100 --- src/testdir/test_vim9_script.vim 2022-08-17 15:44:09.330431145 +0100 *************** *** 2097,2102 **** --- 2097,2115 ---- v9.CheckDefAndScriptSuccess(lines) enddef + def Test_skipped_redir() + var lines =<< trim END + def T() + if 0 + redir =>l[0] + redir END + endif + enddef + defcompile + END + v9.CheckScriptSuccess(lines) + enddef + def Test_for_loop() var lines =<< trim END var result = '' *** ../vim-9.0.0223/src/version.c 2022-08-17 12:09:41.748067732 +0100 --- src/version.c 2022-08-17 15:39:52.775547458 +0100 *************** *** 733,734 **** --- 733,736 ---- { /* Add new patch number below this line */ + /**/ + 224, /**/ -- Q: How many hardware engineers does it take to change a lightbulb? A: None. We'll fix it in software. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///