To: vim_dev@googlegroups.com Subject: Patch 8.0.0345 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0345 Problem: islocked('d.changedtick') does not work. Solution: Make it work. Files: src/buffer.c, src/eval.c, src/evalfunc.c, src/vim.h, src/testdir/test_changedtick.vim *** ../vim-8.0.0344/src/buffer.c 2017-02-19 13:54:57.996966935 +0100 --- src/buffer.c 2017-02-21 20:30:48.544718101 +0100 *************** *** 884,890 **** if (di != NULL) { ! di->di_flags |= DI_FLAGS_LOCK | DI_FLAGS_FIX | DI_FLAGS_RO; di->di_tv.v_type = VAR_NUMBER; di->di_tv.v_lock = VAR_FIXED; di->di_tv.vval.v_number = 0; --- 884,890 ---- if (di != NULL) { ! di->di_flags |= DI_FLAGS_FIX | DI_FLAGS_RO; di->di_tv.v_type = VAR_NUMBER; di->di_tv.v_lock = VAR_FIXED; di->di_tv.vval.v_number = 0; *** ../vim-8.0.0344/src/eval.c 2017-02-20 23:07:00.478656212 +0100 --- src/eval.c 2017-02-21 20:41:26.052528271 +0100 *************** *** 1811,1816 **** --- 1811,1817 ---- * * flags: * GLV_QUIET: do not give error messages + * GLV_READ_ONLY: will not change the variable * GLV_NO_AUTOLOAD: do not use script autoloading * * Returns a pointer to just after the name, including indexes. *************** *** 2078,2084 **** break; } /* existing variable, need to check if it can be changed */ ! else if (var_check_ro(lp->ll_di->di_flags, name, FALSE)) { clear_tv(&var1); return NULL; --- 2079,2086 ---- break; } /* existing variable, need to check if it can be changed */ ! else if ((flags & GLV_READ_ONLY) == 0 ! && var_check_ro(lp->ll_di->di_flags, name, FALSE)) { clear_tv(&var1); return NULL; *** ../vim-8.0.0344/src/evalfunc.c 2017-02-17 16:31:16.921294136 +0100 --- src/evalfunc.c 2017-02-21 20:41:40.428433096 +0100 *************** *** 6561,6567 **** rettv->vval.v_number = -1; end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, ! GLV_NO_AUTOLOAD, FNE_CHECK_START); if (end != NULL && lv.ll_name != NULL) { if (*end != NUL) --- 6561,6567 ---- rettv->vval.v_number = -1; end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, ! GLV_NO_AUTOLOAD | GLV_READ_ONLY, FNE_CHECK_START); if (end != NULL && lv.ll_name != NULL) { if (*end != NUL) *** ../vim-8.0.0344/src/vim.h 2017-02-01 13:14:11.026177020 +0100 --- src/vim.h 2017-02-21 20:40:35.408862969 +0100 *************** *** 2474,2483 **** --- 2474,2485 ---- #define TFN_QUIET 2 /* no error messages */ #define TFN_NO_AUTOLOAD 4 /* do not use script autoloading */ #define TFN_NO_DEREF 8 /* do not dereference a Funcref */ + #define TFN_READ_ONLY 16 /* will not change the var */ /* Values for get_lval() flags argument: */ #define GLV_QUIET TFN_QUIET /* no error messages */ #define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD /* do not use script autoloading */ + #define GLV_READ_ONLY TFN_READ_ONLY /* will not change the var */ #define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not be freed. */ *** ../vim-8.0.0344/src/testdir/test_changedtick.vim 2017-02-20 22:35:29.013423395 +0100 --- src/testdir/test_changedtick.vim 2017-02-21 20:39:05.941451793 +0100 *************** *** 32,37 **** --- 32,43 ---- call assert_equal(v + 1, getbufvar(bnr, 'changedtick')) endfunc + func Test_changedtick_islocked() + call assert_equal(0, islocked('b:changedtick')) + let d = b: + call assert_equal(0, islocked('d.changedtick')) + endfunc + func Test_changedtick_fixed() call assert_fails('let b:changedtick = 4', 'E46:') call assert_fails('let b:["changedtick"] = 4', 'E46:') *** ../vim-8.0.0344/src/version.c 2017-02-20 23:07:00.478656212 +0100 --- src/version.c 2017-02-21 20:45:50.126895362 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 345, /**/ -- No engineer can take a shower without wondering if some sort of Teflon coating would make showering unnecessary. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///