0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.0345: islocked('d.changedtick') does not work

Problem:    islocked('d.changedtick') does not work.
Solution:   Make it work.
This commit is contained in:
Bram Moolenaar
2017-02-21 20:47:13 +01:00
parent 49439c4cdf
commit 3a25773772
6 changed files with 15 additions and 3 deletions

View File

@@ -884,7 +884,7 @@ init_changedtick(buf_T *buf)
if (di != NULL) if (di != NULL)
{ {
di->di_flags |= DI_FLAGS_LOCK | DI_FLAGS_FIX | DI_FLAGS_RO; di->di_flags |= DI_FLAGS_FIX | DI_FLAGS_RO;
di->di_tv.v_type = VAR_NUMBER; di->di_tv.v_type = VAR_NUMBER;
di->di_tv.v_lock = VAR_FIXED; di->di_tv.v_lock = VAR_FIXED;
di->di_tv.vval.v_number = 0; di->di_tv.vval.v_number = 0;

View File

@@ -1811,6 +1811,7 @@ ex_let_one(
* *
* flags: * flags:
* GLV_QUIET: do not give error messages * GLV_QUIET: do not give error messages
* GLV_READ_ONLY: will not change the variable
* GLV_NO_AUTOLOAD: do not use script autoloading * GLV_NO_AUTOLOAD: do not use script autoloading
* *
* Returns a pointer to just after the name, including indexes. * Returns a pointer to just after the name, including indexes.
@@ -2078,7 +2079,8 @@ get_lval(
break; break;
} }
/* existing variable, need to check if it can be changed */ /* existing variable, need to check if it can be changed */
else if (var_check_ro(lp->ll_di->di_flags, name, FALSE)) else if ((flags & GLV_READ_ONLY) == 0
&& var_check_ro(lp->ll_di->di_flags, name, FALSE))
{ {
clear_tv(&var1); clear_tv(&var1);
return NULL; return NULL;

View File

@@ -6561,7 +6561,7 @@ f_islocked(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = -1; rettv->vval.v_number = -1;
end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE,
GLV_NO_AUTOLOAD, FNE_CHECK_START); GLV_NO_AUTOLOAD | GLV_READ_ONLY, FNE_CHECK_START);
if (end != NULL && lv.ll_name != NULL) if (end != NULL && lv.ll_name != NULL)
{ {
if (*end != NUL) if (*end != NUL)

View File

@@ -32,6 +32,12 @@ func Test_changedtick_bdel()
call assert_equal(v + 1, getbufvar(bnr, 'changedtick')) call assert_equal(v + 1, getbufvar(bnr, 'changedtick'))
endfunc 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() func Test_changedtick_fixed()
call assert_fails('let b:changedtick = 4', 'E46:') call assert_fails('let b:changedtick = 4', 'E46:')
call assert_fails('let b:["changedtick"] = 4', 'E46:') call assert_fails('let b:["changedtick"] = 4', 'E46:')

View File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
345,
/**/ /**/
344, 344,
/**/ /**/

View File

@@ -2474,10 +2474,12 @@ typedef enum {
#define TFN_QUIET 2 /* no error messages */ #define TFN_QUIET 2 /* no error messages */
#define TFN_NO_AUTOLOAD 4 /* do not use script autoloading */ #define TFN_NO_AUTOLOAD 4 /* do not use script autoloading */
#define TFN_NO_DEREF 8 /* do not dereference a Funcref */ #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: */ /* Values for get_lval() flags argument: */
#define GLV_QUIET TFN_QUIET /* no error messages */ #define GLV_QUIET TFN_QUIET /* no error messages */
#define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD /* do not use script autoloading */ #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 #define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
be freed. */ be freed. */