Karsten Hopp 46abd1
To: vim_dev@googlegroups.com
Karsten Hopp 46abd1
Subject: Patch 7.4.149
Karsten Hopp 46abd1
Fcc: outbox
Karsten Hopp 46abd1
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 46abd1
Mime-Version: 1.0
Karsten Hopp 46abd1
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 46abd1
Content-Transfer-Encoding: 8bit
Karsten Hopp 46abd1
------------
Karsten Hopp 46abd1
Karsten Hopp 46abd1
Patch 7.4.149
Karsten Hopp 46abd1
Problem:    Get E685 error when assigning a function to an autoload variable.
Karsten Hopp 46abd1
	    (Yukihiro Nakadaira)
Karsten Hopp 46abd1
Solution:   Instead of having a global no_autoload variable, pass an autoload
Karsten Hopp 46abd1
	    flag down to where it is used. (ZyX)
Karsten Hopp 46abd1
Files:	    src/eval.c, src/testdir/test55.in, src/testdir/test55.ok,
Karsten Hopp 46abd1
	    src/testdir/test60.in, src/testdir/test60.ok,
Karsten Hopp 46abd1
	    src/testdir/sautest/autoload/footest.vim
Karsten Hopp 46abd1
Karsten Hopp 46abd1
Karsten Hopp 46abd1
*** ../vim-7.4.148/src/eval.c	2014-01-06 06:18:44.000000000 +0100
Karsten Hopp 46abd1
--- src/eval.c	2014-01-14 15:14:05.000000000 +0100
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 125,133 ****
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
  static hashtab_T	compat_hashtab;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
- /* When using exists() don't auto-load a script. */
Karsten Hopp 46abd1
- static int		no_autoload = FALSE;
Karsten Hopp 46abd1
- 
Karsten Hopp 46abd1
  /*
Karsten Hopp 46abd1
   * When recursively copying lists and dicts we need to remember which ones we
Karsten Hopp 46abd1
   * have done to avoid endless recursiveness.  This unique ID is used for that.
Karsten Hopp 46abd1
--- 125,130 ----
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 156,161 ****
Karsten Hopp 46abd1
--- 153,163 ----
Karsten Hopp 46abd1
  /* Values for trans_function_name() argument: */
Karsten Hopp 46abd1
  #define TFN_INT		1	/* internal function name OK */
Karsten Hopp 46abd1
  #define TFN_QUIET	2	/* no error messages */
Karsten Hopp 46abd1
+ #define TFN_NO_AUTOLOAD	4	/* do not use script autoloading */
Karsten Hopp 46abd1
+ 
Karsten Hopp 46abd1
+ /* Values for get_lval() flags argument: */
Karsten Hopp 46abd1
+ #define GLV_QUIET	TFN_QUIET	/* no error messages */
Karsten Hopp 46abd1
+ #define GLV_NO_AUTOLOAD	TFN_NO_AUTOLOAD	/* do not use script autoloading */
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
  /*
Karsten Hopp 46abd1
   * Structure to hold info for a user function.
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 390,396 ****
Karsten Hopp 46abd1
  static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg, int *first));
Karsten Hopp 46abd1
  static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op));
Karsten Hopp 46abd1
  static int check_changedtick __ARGS((char_u *arg));
Karsten Hopp 46abd1
! static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int quiet, int fne_flags));
Karsten Hopp 46abd1
  static void clear_lval __ARGS((lval_T *lp));
Karsten Hopp 46abd1
  static void set_var_lval __ARGS((lval_T *lp, char_u *endp, typval_T *rettv, int copy, char_u *op));
Karsten Hopp 46abd1
  static int tv_op __ARGS((typval_T *tv1, typval_T *tv2, char_u  *op));
Karsten Hopp 46abd1
--- 392,398 ----
Karsten Hopp 46abd1
  static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg, int *first));
Karsten Hopp 46abd1
  static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op));
Karsten Hopp 46abd1
  static int check_changedtick __ARGS((char_u *arg));
Karsten Hopp 46abd1
! static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int flags, int fne_flags));
Karsten Hopp 46abd1
  static void clear_lval __ARGS((lval_T *lp));
Karsten Hopp 46abd1
  static void set_var_lval __ARGS((lval_T *lp, char_u *endp, typval_T *rettv, int copy, char_u *op));
Karsten Hopp 46abd1
  static int tv_op __ARGS((typval_T *tv1, typval_T *tv2, char_u  *op));
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 770,776 ****
Karsten Hopp 46abd1
  static char_u * make_expanded_name __ARGS((char_u *in_start, char_u *expr_start, char_u *expr_end, char_u *in_end));
Karsten Hopp 46abd1
  static int eval_isnamec __ARGS((int c));
Karsten Hopp 46abd1
  static int eval_isnamec1 __ARGS((int c));
Karsten Hopp 46abd1
! static int get_var_tv __ARGS((char_u *name, int len, typval_T *rettv, int verbose));
Karsten Hopp 46abd1
  static int handle_subscript __ARGS((char_u **arg, typval_T *rettv, int evaluate, int verbose));
Karsten Hopp 46abd1
  static typval_T *alloc_tv __ARGS((void));
Karsten Hopp 46abd1
  static typval_T *alloc_string_tv __ARGS((char_u *string));
Karsten Hopp 46abd1
--- 772,778 ----
Karsten Hopp 46abd1
  static char_u * make_expanded_name __ARGS((char_u *in_start, char_u *expr_start, char_u *expr_end, char_u *in_end));
Karsten Hopp 46abd1
  static int eval_isnamec __ARGS((int c));
Karsten Hopp 46abd1
  static int eval_isnamec1 __ARGS((int c));
Karsten Hopp 46abd1
! static int get_var_tv __ARGS((char_u *name, int len, typval_T *rettv, int verbose, int no_autoload));
Karsten Hopp 46abd1
  static int handle_subscript __ARGS((char_u **arg, typval_T *rettv, int evaluate, int verbose));
Karsten Hopp 46abd1
  static typval_T *alloc_tv __ARGS((void));
Karsten Hopp 46abd1
  static typval_T *alloc_string_tv __ARGS((char_u *string));
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 781,788 ****
Karsten Hopp 46abd1
  static char_u *get_tv_string __ARGS((typval_T *varp));
Karsten Hopp 46abd1
  static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
Karsten Hopp 46abd1
  static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
Karsten Hopp 46abd1
! static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp));
Karsten Hopp 46abd1
! static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int writing));
Karsten Hopp 46abd1
  static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
Karsten Hopp 46abd1
  static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val));
Karsten Hopp 46abd1
  static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi));
Karsten Hopp 46abd1
--- 783,790 ----
Karsten Hopp 46abd1
  static char_u *get_tv_string __ARGS((typval_T *varp));
Karsten Hopp 46abd1
  static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
Karsten Hopp 46abd1
  static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
Karsten Hopp 46abd1
! static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp, int no_autoload));
Karsten Hopp 46abd1
! static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int no_autoload));
Karsten Hopp 46abd1
  static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
Karsten Hopp 46abd1
  static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val));
Karsten Hopp 46abd1
  static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi));
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 1059,1065 ****
Karsten Hopp 46abd1
      ga_init2(&redir_ga, (int)sizeof(char), 500);
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      /* Parse the variable name (can be a dict or list entry). */
Karsten Hopp 46abd1
!     redir_endp = get_lval(redir_varname, NULL, redir_lval, FALSE, FALSE, FALSE,
Karsten Hopp 46abd1
  							     FNE_CHECK_START);
Karsten Hopp 46abd1
      if (redir_endp == NULL || redir_lval->ll_name == NULL || *redir_endp != NUL)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
--- 1061,1067 ----
Karsten Hopp 46abd1
      ga_init2(&redir_ga, (int)sizeof(char), 500);
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      /* Parse the variable name (can be a dict or list entry). */
Karsten Hopp 46abd1
!     redir_endp = get_lval(redir_varname, NULL, redir_lval, FALSE, FALSE, 0,
Karsten Hopp 46abd1
  							     FNE_CHECK_START);
Karsten Hopp 46abd1
      if (redir_endp == NULL || redir_lval->ll_name == NULL || *redir_endp != NUL)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 1150,1156 ****
Karsten Hopp 46abd1
  	    /* Call get_lval() again, if it's inside a Dict or List it may
Karsten Hopp 46abd1
  	     * have changed. */
Karsten Hopp 46abd1
  	    redir_endp = get_lval(redir_varname, NULL, redir_lval,
Karsten Hopp 46abd1
! 					FALSE, FALSE, FALSE, FNE_CHECK_START);
Karsten Hopp 46abd1
  	    if (redir_endp != NULL && redir_lval->ll_name != NULL)
Karsten Hopp 46abd1
  		set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)".");
Karsten Hopp 46abd1
  	    clear_lval(redir_lval);
Karsten Hopp 46abd1
--- 1152,1158 ----
Karsten Hopp 46abd1
  	    /* Call get_lval() again, if it's inside a Dict or List it may
Karsten Hopp 46abd1
  	     * have changed. */
Karsten Hopp 46abd1
  	    redir_endp = get_lval(redir_varname, NULL, redir_lval,
Karsten Hopp 46abd1
! 					FALSE, FALSE, 0, FNE_CHECK_START);
Karsten Hopp 46abd1
  	    if (redir_endp != NULL && redir_lval->ll_name != NULL)
Karsten Hopp 46abd1
  		set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)".");
Karsten Hopp 46abd1
  	    clear_lval(redir_lval);
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 2239,2245 ****
Karsten Hopp 46abd1
  	    {
Karsten Hopp 46abd1
  		if (tofree != NULL)
Karsten Hopp 46abd1
  		    name = tofree;
Karsten Hopp 46abd1
! 		if (get_var_tv(name, len, &tv, TRUE) == FAIL)
Karsten Hopp 46abd1
  		    error = TRUE;
Karsten Hopp 46abd1
  		else
Karsten Hopp 46abd1
  		{
Karsten Hopp 46abd1
--- 2241,2247 ----
Karsten Hopp 46abd1
  	    {
Karsten Hopp 46abd1
  		if (tofree != NULL)
Karsten Hopp 46abd1
  		    name = tofree;
Karsten Hopp 46abd1
! 		if (get_var_tv(name, len, &tv, TRUE, FALSE) == FAIL)
Karsten Hopp 46abd1
  		    error = TRUE;
Karsten Hopp 46abd1
  		else
Karsten Hopp 46abd1
  		{
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 2474,2480 ****
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
  	lval_T	lv;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
! 	p = get_lval(arg, tv, &lv, FALSE, FALSE, FALSE, FNE_CHECK_START);
Karsten Hopp 46abd1
  	if (p != NULL && lv.ll_name != NULL)
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
  	    if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL)
Karsten Hopp 46abd1
--- 2476,2482 ----
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
  	lval_T	lv;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
! 	p = get_lval(arg, tv, &lv, FALSE, FALSE, 0, FNE_CHECK_START);
Karsten Hopp 46abd1
  	if (p != NULL && lv.ll_name != NULL)
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
  	    if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL)
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 2519,2536 ****
Karsten Hopp 46abd1
   * "unlet" is TRUE for ":unlet": slightly different behavior when something is
Karsten Hopp 46abd1
   * wrong; must end in space or cmd separator.
Karsten Hopp 46abd1
   *
Karsten Hopp 46abd1
   * Returns a pointer to just after the name, including indexes.
Karsten Hopp 46abd1
   * When an evaluation error occurs "lp->ll_name" is NULL;
Karsten Hopp 46abd1
   * Returns NULL for a parsing error.  Still need to free items in "lp"!
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static char_u *
Karsten Hopp 46abd1
! get_lval(name, rettv, lp, unlet, skip, quiet, fne_flags)
Karsten Hopp 46abd1
      char_u	*name;
Karsten Hopp 46abd1
      typval_T	*rettv;
Karsten Hopp 46abd1
      lval_T	*lp;
Karsten Hopp 46abd1
      int		unlet;
Karsten Hopp 46abd1
      int		skip;
Karsten Hopp 46abd1
!     int		quiet;	    /* don't give error messages */
Karsten Hopp 46abd1
      int		fne_flags;  /* flags for find_name_end() */
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      char_u	*p;
Karsten Hopp 46abd1
--- 2521,2542 ----
Karsten Hopp 46abd1
   * "unlet" is TRUE for ":unlet": slightly different behavior when something is
Karsten Hopp 46abd1
   * wrong; must end in space or cmd separator.
Karsten Hopp 46abd1
   *
Karsten Hopp 46abd1
+  * flags:
Karsten Hopp 46abd1
+  *  GLV_QUIET:       do not give error messages
Karsten Hopp 46abd1
+  *  GLV_NO_AUTOLOAD: do not use script autoloading
Karsten Hopp 46abd1
+  *
Karsten Hopp 46abd1
   * Returns a pointer to just after the name, including indexes.
Karsten Hopp 46abd1
   * When an evaluation error occurs "lp->ll_name" is NULL;
Karsten Hopp 46abd1
   * Returns NULL for a parsing error.  Still need to free items in "lp"!
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static char_u *
Karsten Hopp 46abd1
! get_lval(name, rettv, lp, unlet, skip, flags, fne_flags)
Karsten Hopp 46abd1
      char_u	*name;
Karsten Hopp 46abd1
      typval_T	*rettv;
Karsten Hopp 46abd1
      lval_T	*lp;
Karsten Hopp 46abd1
      int		unlet;
Karsten Hopp 46abd1
      int		skip;
Karsten Hopp 46abd1
!     int		flags;	    /* GLV_ values */
Karsten Hopp 46abd1
      int		fne_flags;  /* flags for find_name_end() */
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      char_u	*p;
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 2544,2549 ****
Karsten Hopp 46abd1
--- 2550,2556 ----
Karsten Hopp 46abd1
      char_u	*key = NULL;
Karsten Hopp 46abd1
      int		len;
Karsten Hopp 46abd1
      hashtab_T	*ht;
Karsten Hopp 46abd1
+     int		quiet = flags & GLV_QUIET;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      /* Clear everything in "lp". */
Karsten Hopp 46abd1
      vim_memset(lp, 0, sizeof(lval_T));
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 2591,2597 ****
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      cc = *p;
Karsten Hopp 46abd1
      *p = NUL;
Karsten Hopp 46abd1
!     v = find_var(lp->ll_name, &ht;;
Karsten Hopp 46abd1
      if (v == NULL && !quiet)
Karsten Hopp 46abd1
  	EMSG2(_(e_undefvar), lp->ll_name);
Karsten Hopp 46abd1
      *p = cc;
Karsten Hopp 46abd1
--- 2598,2604 ----
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      cc = *p;
Karsten Hopp 46abd1
      *p = NUL;
Karsten Hopp 46abd1
!     v = find_var(lp->ll_name, &ht, flags & GLV_NO_AUTOLOAD);
Karsten Hopp 46abd1
      if (v == NULL && !quiet)
Karsten Hopp 46abd1
  	EMSG2(_(e_undefvar), lp->ll_name);
Karsten Hopp 46abd1
      *p = cc;
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 2904,2910 ****
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
  		/* handle +=, -= and .= */
Karsten Hopp 46abd1
  		if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name),
Karsten Hopp 46abd1
! 							     &tv, TRUE) == OK)
Karsten Hopp 46abd1
  		{
Karsten Hopp 46abd1
  		    if (tv_op(&tv, rettv, op) == OK)
Karsten Hopp 46abd1
  			set_var(lp->ll_name, &tv, FALSE);
Karsten Hopp 46abd1
--- 2911,2917 ----
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
  		/* handle +=, -= and .= */
Karsten Hopp 46abd1
  		if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name),
Karsten Hopp 46abd1
! 						      &tv, TRUE, FALSE) == OK)
Karsten Hopp 46abd1
  		{
Karsten Hopp 46abd1
  		    if (tv_op(&tv, rettv, op) == OK)
Karsten Hopp 46abd1
  			set_var(lp->ll_name, &tv, FALSE);
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 3556,3562 ****
Karsten Hopp 46abd1
      do
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
  	/* Parse the name and find the end. */
Karsten Hopp 46abd1
! 	name_end = get_lval(arg, NULL, &lv, TRUE, eap->skip || error, FALSE,
Karsten Hopp 46abd1
  							     FNE_CHECK_START);
Karsten Hopp 46abd1
  	if (lv.ll_name == NULL)
Karsten Hopp 46abd1
  	    error = TRUE;	    /* error but continue parsing */
Karsten Hopp 46abd1
--- 3563,3569 ----
Karsten Hopp 46abd1
      do
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
  	/* Parse the name and find the end. */
Karsten Hopp 46abd1
! 	name_end = get_lval(arg, NULL, &lv, TRUE, eap->skip || error, 0,
Karsten Hopp 46abd1
  							     FNE_CHECK_START);
Karsten Hopp 46abd1
  	if (lv.ll_name == NULL)
Karsten Hopp 46abd1
  	    error = TRUE;	    /* error but continue parsing */
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 3709,3715 ****
Karsten Hopp 46abd1
  	    ret = FAIL;
Karsten Hopp 46abd1
  	else
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
! 	    di = find_var(lp->ll_name, NULL);
Karsten Hopp 46abd1
  	    if (di == NULL)
Karsten Hopp 46abd1
  		ret = FAIL;
Karsten Hopp 46abd1
  	    else
Karsten Hopp 46abd1
--- 3716,3722 ----
Karsten Hopp 46abd1
  	    ret = FAIL;
Karsten Hopp 46abd1
  	else
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
! 	    di = find_var(lp->ll_name, NULL, TRUE);
Karsten Hopp 46abd1
  	    if (di == NULL)
Karsten Hopp 46abd1
  		ret = FAIL;
Karsten Hopp 46abd1
  	    else
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 5179,5185 ****
Karsten Hopp 46abd1
  		}
Karsten Hopp 46abd1
  	    }
Karsten Hopp 46abd1
  	    else if (evaluate)
Karsten Hopp 46abd1
! 		ret = get_var_tv(s, len, rettv, TRUE);
Karsten Hopp 46abd1
  	    else
Karsten Hopp 46abd1
  		ret = OK;
Karsten Hopp 46abd1
  	}
Karsten Hopp 46abd1
--- 5186,5192 ----
Karsten Hopp 46abd1
  		}
Karsten Hopp 46abd1
  	    }
Karsten Hopp 46abd1
  	    else if (evaluate)
Karsten Hopp 46abd1
! 		ret = get_var_tv(s, len, rettv, TRUE, FALSE);
Karsten Hopp 46abd1
  	    else
Karsten Hopp 46abd1
  		ret = OK;
Karsten Hopp 46abd1
  	}
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 8284,8290 ****
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      cc = name[*lenp];
Karsten Hopp 46abd1
      name[*lenp] = NUL;
Karsten Hopp 46abd1
!     v = find_var(name, NULL);
Karsten Hopp 46abd1
      name[*lenp] = cc;
Karsten Hopp 46abd1
      if (v != NULL && v->di_tv.v_type == VAR_FUNC)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
--- 8291,8297 ----
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      cc = name[*lenp];
Karsten Hopp 46abd1
      name[*lenp] = NUL;
Karsten Hopp 46abd1
!     v = find_var(name, NULL, FALSE);
Karsten Hopp 46abd1
      name[*lenp] = cc;
Karsten Hopp 46abd1
      if (v != NULL && v->di_tv.v_type == VAR_FUNC)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 10039,10046 ****
Karsten Hopp 46abd1
      int		n = FALSE;
Karsten Hopp 46abd1
      int		len = 0;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
-     no_autoload = TRUE;
Karsten Hopp 46abd1
- 
Karsten Hopp 46abd1
      p = get_tv_string(&argvars[0]);
Karsten Hopp 46abd1
      if (*p == '$')			/* environment variable */
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
--- 10046,10051 ----
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 10091,10097 ****
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
  	    if (tofree != NULL)
Karsten Hopp 46abd1
  		name = tofree;
Karsten Hopp 46abd1
! 	    n = (get_var_tv(name, len, &tv, FALSE) == OK);
Karsten Hopp 46abd1
  	    if (n)
Karsten Hopp 46abd1
  	    {
Karsten Hopp 46abd1
  		/* handle d.key, l[idx], f(expr) */
Karsten Hopp 46abd1
--- 10096,10102 ----
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
  	    if (tofree != NULL)
Karsten Hopp 46abd1
  		name = tofree;
Karsten Hopp 46abd1
! 	    n = (get_var_tv(name, len, &tv, FALSE, TRUE) == OK);
Karsten Hopp 46abd1
  	    if (n)
Karsten Hopp 46abd1
  	    {
Karsten Hopp 46abd1
  		/* handle d.key, l[idx], f(expr) */
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 10107,10114 ****
Karsten Hopp 46abd1
      }
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      rettv->vval.v_number = n;
Karsten Hopp 46abd1
- 
Karsten Hopp 46abd1
-     no_autoload = FALSE;
Karsten Hopp 46abd1
  }
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
  #ifdef FEAT_FLOAT
Karsten Hopp 46abd1
--- 10112,10117 ----
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 13344,13351 ****
Karsten Hopp 46abd1
      dictitem_T	*di;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      rettv->vval.v_number = -1;
Karsten Hopp 46abd1
!     end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, FALSE,
Karsten Hopp 46abd1
! 							     FNE_CHECK_START);
Karsten Hopp 46abd1
      if (end != NULL && lv.ll_name != NULL)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
  	if (*end != NUL)
Karsten Hopp 46abd1
--- 13347,13354 ----
Karsten Hopp 46abd1
      dictitem_T	*di;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      rettv->vval.v_number = -1;
Karsten Hopp 46abd1
!     end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE,
Karsten Hopp 46abd1
! 					GLV_NO_AUTOLOAD, FNE_CHECK_START);
Karsten Hopp 46abd1
      if (end != NULL && lv.ll_name != NULL)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
  	if (*end != NUL)
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 13358,13364 ****
Karsten Hopp 46abd1
  		    rettv->vval.v_number = 1;	    /* always locked */
Karsten Hopp 46abd1
  		else
Karsten Hopp 46abd1
  		{
Karsten Hopp 46abd1
! 		    di = find_var(lv.ll_name, NULL);
Karsten Hopp 46abd1
  		    if (di != NULL)
Karsten Hopp 46abd1
  		    {
Karsten Hopp 46abd1
  			/* Consider a variable locked when:
Karsten Hopp 46abd1
--- 13361,13367 ----
Karsten Hopp 46abd1
  		    rettv->vval.v_number = 1;	    /* always locked */
Karsten Hopp 46abd1
  		else
Karsten Hopp 46abd1
  		{
Karsten Hopp 46abd1
! 		    di = find_var(lv.ll_name, NULL, TRUE);
Karsten Hopp 46abd1
  		    if (di != NULL)
Karsten Hopp 46abd1
  		    {
Karsten Hopp 46abd1
  			/* Consider a variable locked when:
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 19774,19784 ****
Karsten Hopp 46abd1
   * Return OK or FAIL.
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static int
Karsten Hopp 46abd1
! get_var_tv(name, len, rettv, verbose)
Karsten Hopp 46abd1
      char_u	*name;
Karsten Hopp 46abd1
      int		len;		/* length of "name" */
Karsten Hopp 46abd1
      typval_T	*rettv;		/* NULL when only checking existence */
Karsten Hopp 46abd1
      int		verbose;	/* may give error message */
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      int		ret = OK;
Karsten Hopp 46abd1
      typval_T	*tv = NULL;
Karsten Hopp 46abd1
--- 19777,19788 ----
Karsten Hopp 46abd1
   * Return OK or FAIL.
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static int
Karsten Hopp 46abd1
! get_var_tv(name, len, rettv, verbose, no_autoload)
Karsten Hopp 46abd1
      char_u	*name;
Karsten Hopp 46abd1
      int		len;		/* length of "name" */
Karsten Hopp 46abd1
      typval_T	*rettv;		/* NULL when only checking existence */
Karsten Hopp 46abd1
      int		verbose;	/* may give error message */
Karsten Hopp 46abd1
+     int		no_autoload;	/* do not use script autoloading */
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      int		ret = OK;
Karsten Hopp 46abd1
      typval_T	*tv = NULL;
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 19805,19811 ****
Karsten Hopp 46abd1
       */
Karsten Hopp 46abd1
      else
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
! 	v = find_var(name, NULL);
Karsten Hopp 46abd1
  	if (v != NULL)
Karsten Hopp 46abd1
  	    tv = &v->di_tv;
Karsten Hopp 46abd1
      }
Karsten Hopp 46abd1
--- 19809,19815 ----
Karsten Hopp 46abd1
       */
Karsten Hopp 46abd1
      else
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
! 	v = find_var(name, NULL, no_autoload);
Karsten Hopp 46abd1
  	if (v != NULL)
Karsten Hopp 46abd1
  	    tv = &v->di_tv;
Karsten Hopp 46abd1
      }
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 20207,20215 ****
Karsten Hopp 46abd1
   * hashtab_T used.
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static dictitem_T *
Karsten Hopp 46abd1
! find_var(name, htp)
Karsten Hopp 46abd1
      char_u	*name;
Karsten Hopp 46abd1
      hashtab_T	**htp;
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      char_u	*varname;
Karsten Hopp 46abd1
      hashtab_T	*ht;
Karsten Hopp 46abd1
--- 20211,20220 ----
Karsten Hopp 46abd1
   * hashtab_T used.
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static dictitem_T *
Karsten Hopp 46abd1
! find_var(name, htp, no_autoload)
Karsten Hopp 46abd1
      char_u	*name;
Karsten Hopp 46abd1
      hashtab_T	**htp;
Karsten Hopp 46abd1
+     int		no_autoload;
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      char_u	*varname;
Karsten Hopp 46abd1
      hashtab_T	*ht;
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 20219,20225 ****
Karsten Hopp 46abd1
  	*htp = ht;
Karsten Hopp 46abd1
      if (ht == NULL)
Karsten Hopp 46abd1
  	return NULL;
Karsten Hopp 46abd1
!     return find_var_in_ht(ht, *name, varname, htp != NULL);
Karsten Hopp 46abd1
  }
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
  /*
Karsten Hopp 46abd1
--- 20224,20230 ----
Karsten Hopp 46abd1
  	*htp = ht;
Karsten Hopp 46abd1
      if (ht == NULL)
Karsten Hopp 46abd1
  	return NULL;
Karsten Hopp 46abd1
!     return find_var_in_ht(ht, *name, varname, no_autoload || htp != NULL);
Karsten Hopp 46abd1
  }
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
  /*
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 20227,20237 ****
Karsten Hopp 46abd1
   * Returns NULL if not found.
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static dictitem_T *
Karsten Hopp 46abd1
! find_var_in_ht(ht, htname, varname, writing)
Karsten Hopp 46abd1
      hashtab_T	*ht;
Karsten Hopp 46abd1
      int		htname;
Karsten Hopp 46abd1
      char_u	*varname;
Karsten Hopp 46abd1
!     int		writing;
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      hashitem_T	*hi;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
--- 20232,20242 ----
Karsten Hopp 46abd1
   * Returns NULL if not found.
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static dictitem_T *
Karsten Hopp 46abd1
! find_var_in_ht(ht, htname, varname, no_autoload)
Karsten Hopp 46abd1
      hashtab_T	*ht;
Karsten Hopp 46abd1
      int		htname;
Karsten Hopp 46abd1
      char_u	*varname;
Karsten Hopp 46abd1
!     int		no_autoload;
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      hashitem_T	*hi;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 20263,20269 ****
Karsten Hopp 46abd1
  	 * worked find the variable again.  Don't auto-load a script if it was
Karsten Hopp 46abd1
  	 * loaded already, otherwise it would be loaded every time when
Karsten Hopp 46abd1
  	 * checking if a function name is a Funcref variable. */
Karsten Hopp 46abd1
! 	if (ht == &globvarht && !writing)
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
  	    /* Note: script_autoload() may make "hi" invalid. It must either
Karsten Hopp 46abd1
  	     * be obtained again or not used. */
Karsten Hopp 46abd1
--- 20268,20274 ----
Karsten Hopp 46abd1
  	 * worked find the variable again.  Don't auto-load a script if it was
Karsten Hopp 46abd1
  	 * loaded already, otherwise it would be loaded every time when
Karsten Hopp 46abd1
  	 * checking if a function name is a Funcref variable. */
Karsten Hopp 46abd1
! 	if (ht == &globvarht && !no_autoload)
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
  	    /* Note: script_autoload() may make "hi" invalid. It must either
Karsten Hopp 46abd1
  	     * be obtained again or not used. */
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 20343,20349 ****
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      dictitem_T	*v;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
!     v = find_var(name, NULL);
Karsten Hopp 46abd1
      if (v == NULL)
Karsten Hopp 46abd1
  	return NULL;
Karsten Hopp 46abd1
      return get_tv_string(&v->di_tv);
Karsten Hopp 46abd1
--- 20348,20354 ----
Karsten Hopp 46abd1
  {
Karsten Hopp 46abd1
      dictitem_T	*v;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
!     v = find_var(name, NULL, FALSE);
Karsten Hopp 46abd1
      if (v == NULL)
Karsten Hopp 46abd1
  	return NULL;
Karsten Hopp 46abd1
      return get_tv_string(&v->di_tv);
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 21672,21678 ****
Karsten Hopp 46abd1
       */
Karsten Hopp 46abd1
      if (fudi.fd_dict == NULL)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
! 	v = find_var(name, &ht;;
Karsten Hopp 46abd1
  	if (v != NULL && v->di_tv.v_type == VAR_FUNC)
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
  	    emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
Karsten Hopp 46abd1
--- 21677,21683 ----
Karsten Hopp 46abd1
       */
Karsten Hopp 46abd1
      if (fudi.fd_dict == NULL)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
! 	v = find_var(name, &ht, FALSE);
Karsten Hopp 46abd1
  	if (v != NULL && v->di_tv.v_type == VAR_FUNC)
Karsten Hopp 46abd1
  	{
Karsten Hopp 46abd1
  	    emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 21830,21837 ****
Karsten Hopp 46abd1
   * Also handles a Funcref in a List or Dictionary.
Karsten Hopp 46abd1
   * Returns the function name in allocated memory, or NULL for failure.
Karsten Hopp 46abd1
   * flags:
Karsten Hopp 46abd1
!  * TFN_INT:   internal function name OK
Karsten Hopp 46abd1
!  * TFN_QUIET: be quiet
Karsten Hopp 46abd1
   * Advances "pp" to just after the function name (if no error).
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static char_u *
Karsten Hopp 46abd1
--- 21835,21843 ----
Karsten Hopp 46abd1
   * Also handles a Funcref in a List or Dictionary.
Karsten Hopp 46abd1
   * Returns the function name in allocated memory, or NULL for failure.
Karsten Hopp 46abd1
   * flags:
Karsten Hopp 46abd1
!  * TFN_INT:         internal function name OK
Karsten Hopp 46abd1
!  * TFN_QUIET:       be quiet
Karsten Hopp 46abd1
!  * TFN_NO_AUTOLOAD: do not use script autoloading
Karsten Hopp 46abd1
   * Advances "pp" to just after the function name (if no error).
Karsten Hopp 46abd1
   */
Karsten Hopp 46abd1
      static char_u *
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 21869,21875 ****
Karsten Hopp 46abd1
      if (lead > 2)
Karsten Hopp 46abd1
  	start += lead;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
!     end = get_lval(start, NULL, &lv, FALSE, skip, flags & TFN_QUIET,
Karsten Hopp 46abd1
  					      lead > 2 ? 0 : FNE_CHECK_START);
Karsten Hopp 46abd1
      if (end == start)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
--- 21875,21882 ----
Karsten Hopp 46abd1
      if (lead > 2)
Karsten Hopp 46abd1
  	start += lead;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
!     /* Note that TFN_ flags use the same values as GLV_ flags. */
Karsten Hopp 46abd1
!     end = get_lval(start, NULL, &lv, FALSE, skip, flags,
Karsten Hopp 46abd1
  					      lead > 2 ? 0 : FNE_CHECK_START);
Karsten Hopp 46abd1
      if (end == start)
Karsten Hopp 46abd1
      {
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 22146,22152 ****
Karsten Hopp 46abd1
      char_u  *p;
Karsten Hopp 46abd1
      int	    n = FALSE;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
!     p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL);
Karsten Hopp 46abd1
      nm = skipwhite(nm);
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      /* Only accept "funcname", "funcname ", "funcname (..." and
Karsten Hopp 46abd1
--- 22153,22160 ----
Karsten Hopp 46abd1
      char_u  *p;
Karsten Hopp 46abd1
      int	    n = FALSE;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
!     p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET|TFN_NO_AUTOLOAD,
Karsten Hopp 46abd1
! 			    NULL);
Karsten Hopp 46abd1
      nm = skipwhite(nm);
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      /* Only accept "funcname", "funcname ", "funcname (..." and
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 22393,22402 ****
Karsten Hopp 46abd1
      int		ret = FALSE;
Karsten Hopp 46abd1
      int		i;
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
-     /* Return quickly when autoload disabled. */
Karsten Hopp 46abd1
-     if (no_autoload)
Karsten Hopp 46abd1
- 	return FALSE;
Karsten Hopp 46abd1
- 
Karsten Hopp 46abd1
      /* If there is no '#' after name[0] there is no package name. */
Karsten Hopp 46abd1
      p = vim_strchr(name, AUTOLOAD_CHAR);
Karsten Hopp 46abd1
      if (p == NULL || p == name)
Karsten Hopp 46abd1
--- 22401,22406 ----
Karsten Hopp 46abd1
*** ../vim-7.4.148/src/testdir/test55.in	2013-03-07 14:33:12.000000000 +0100
Karsten Hopp 46abd1
--- src/testdir/test55.in	2014-01-14 14:48:10.000000000 +0100
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 282,287 ****
Karsten Hopp 46abd1
--- 282,294 ----
Karsten Hopp 46abd1
  :    $put =ps
Karsten Hopp 46abd1
  :  endfor
Karsten Hopp 46abd1
  :endfor
Karsten Hopp 46abd1
+ :" :lockvar/islocked() triggering script autoloading
Karsten Hopp 46abd1
+ :set rtp+=./sautest
Karsten Hopp 46abd1
+ :lockvar g:footest#x
Karsten Hopp 46abd1
+ :unlockvar g:footest#x
Karsten Hopp 46abd1
+ :$put ='locked g:footest#x:'.islocked('g:footest#x')
Karsten Hopp 46abd1
+ :$put ='exists g:footest#x:'.exists('g:footest#x')
Karsten Hopp 46abd1
+ :$put ='g:footest#x: '.g:footest#x
Karsten Hopp 46abd1
  :"
Karsten Hopp 46abd1
  :" a:000 function argument
Karsten Hopp 46abd1
  :" first the tests that should fail
Karsten Hopp 46abd1
*** ../vim-7.4.148/src/testdir/test55.ok	2012-08-29 16:51:15.000000000 +0200
Karsten Hopp 46abd1
--- src/testdir/test55.ok	2014-01-14 14:45:14.000000000 +0100
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 86,91 ****
Karsten Hopp 46abd1
--- 86,94 ----
Karsten Hopp 46abd1
  FFpFFpp
Karsten Hopp 46abd1
  0000-000
Karsten Hopp 46abd1
  ppppppp
Karsten Hopp 46abd1
+ locked g:footest#x:-1
Karsten Hopp 46abd1
+ exists g:footest#x:0
Karsten Hopp 46abd1
+ g:footest#x: 1
Karsten Hopp 46abd1
  caught a:000
Karsten Hopp 46abd1
  caught a:000[0]
Karsten Hopp 46abd1
  caught a:000[2]
Karsten Hopp 46abd1
*** ../vim-7.4.148/src/testdir/test60.in	2010-05-15 13:04:10.000000000 +0200
Karsten Hopp 46abd1
--- src/testdir/test60.in	2014-01-14 14:49:10.000000000 +0100
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 1,4 ****
Karsten Hopp 46abd1
! Tests for the exists() function.  vim: set ft=vim :
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
  STARTTEST
Karsten Hopp 46abd1
  :so small.vim
Karsten Hopp 46abd1
--- 1,4 ----
Karsten Hopp 46abd1
! Tests for the exists() function.  vim: set ft=vim ts=8 :
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
  STARTTEST
Karsten Hopp 46abd1
  :so small.vim
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 11,18 ****
Karsten Hopp 46abd1
  endfunction
Karsten Hopp 46abd1
  :function! TestExists()
Karsten Hopp 46abd1
      augroup myagroup
Karsten Hopp 46abd1
! 	autocmd! BufEnter *.my echo 'myfile edited'
Karsten Hopp 46abd1
      augroup END
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      let test_cases = []
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
--- 11,20 ----
Karsten Hopp 46abd1
  endfunction
Karsten Hopp 46abd1
  :function! TestExists()
Karsten Hopp 46abd1
      augroup myagroup
Karsten Hopp 46abd1
! 	autocmd! BufEnter       *.my     echo "myfile edited"
Karsten Hopp 46abd1
! 	autocmd! FuncUndefined  UndefFun exec "fu UndefFun()\nendfu"
Karsten Hopp 46abd1
      augroup END
Karsten Hopp 46abd1
+     set rtp+=./sautest
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      let test_cases = []
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 95,104 ****
Karsten Hopp 46abd1
      " Non-existing user defined function
Karsten Hopp 46abd1
      let test_cases += [['*MyxyzFunc', 0]]
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      redir! > test.out
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      for [test_case, result] in test_cases
Karsten Hopp 46abd1
!       	echo test_case . ": " . result
Karsten Hopp 46abd1
          call RunTest(test_case, result)
Karsten Hopp 46abd1
      endfor
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
--- 97,111 ----
Karsten Hopp 46abd1
      " Non-existing user defined function
Karsten Hopp 46abd1
      let test_cases += [['*MyxyzFunc', 0]]
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
+     " Function that may be created by FuncUndefined event
Karsten Hopp 46abd1
+     let test_cases += [['*UndefFun', 0]]
Karsten Hopp 46abd1
+     " Function that may be created by script autoloading
Karsten Hopp 46abd1
+     let test_cases += [['*footest#F', 0]]
Karsten Hopp 46abd1
+ 
Karsten Hopp 46abd1
      redir! > test.out
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      for [test_case, result] in test_cases
Karsten Hopp 46abd1
!         echo test_case . ": " . result
Karsten Hopp 46abd1
          call RunTest(test_case, result)
Karsten Hopp 46abd1
      endfor
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 207,212 ****
Karsten Hopp 46abd1
--- 214,227 ----
Karsten Hopp 46abd1
  	echo "FAILED"
Karsten Hopp 46abd1
      endif
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
+     " Non-existing autoload variable that may be autoloaded
Karsten Hopp 46abd1
+     echo 'footest#x: 0'
Karsten Hopp 46abd1
+     if !exists('footest#x')
Karsten Hopp 46abd1
+ 	echo "OK"
Karsten Hopp 46abd1
+     else
Karsten Hopp 46abd1
+ 	echo "FAILED"
Karsten Hopp 46abd1
+     endif
Karsten Hopp 46abd1
+ 
Karsten Hopp 46abd1
      " Valid local list
Karsten Hopp 46abd1
      let local_list = ["blue", "orange"]
Karsten Hopp 46abd1
      echo 'local_list: 1'
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 566,571 ****
Karsten Hopp 46abd1
--- 581,590 ----
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
      call TestFuncArg("arg1", "arg2")
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
+     echo ' g:footest#x =' g:footest#x
Karsten Hopp 46abd1
+     echo '   footest#F()' footest#F()
Karsten Hopp 46abd1
+     echo 'UndefFun()' UndefFun()
Karsten Hopp 46abd1
+ 
Karsten Hopp 46abd1
      redir END
Karsten Hopp 46abd1
  endfunction
Karsten Hopp 46abd1
  :call TestExists()
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 576,580 ****
Karsten Hopp 46abd1
--- 595,600 ----
Karsten Hopp 46abd1
  :set ff=unix
Karsten Hopp 46abd1
  :w
Karsten Hopp 46abd1
  :qa!
Karsten Hopp 46abd1
+ :while getchar(1) | call getchar() | endwhile
Karsten Hopp 46abd1
  ENDTEST
Karsten Hopp 46abd1
  
Karsten Hopp 46abd1
*** ../vim-7.4.148/src/testdir/test60.ok	2010-05-15 13:04:10.000000000 +0200
Karsten Hopp 46abd1
--- src/testdir/test60.ok	2014-01-14 14:50:50.000000000 +0100
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 71,76 ****
Karsten Hopp 46abd1
--- 71,80 ----
Karsten Hopp 46abd1
  OK
Karsten Hopp 46abd1
  *MyxyzFunc: 0
Karsten Hopp 46abd1
  OK
Karsten Hopp 46abd1
+ *UndefFun: 0
Karsten Hopp 46abd1
+ OK
Karsten Hopp 46abd1
+ *footest#F: 0
Karsten Hopp 46abd1
+ OK
Karsten Hopp 46abd1
  :edit: 2
Karsten Hopp 46abd1
  OK
Karsten Hopp 46abd1
  :edit/a: 0
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 95,100 ****
Karsten Hopp 46abd1
--- 99,106 ----
Karsten Hopp 46abd1
  OK
Karsten Hopp 46abd1
  local_var: 0
Karsten Hopp 46abd1
  OK
Karsten Hopp 46abd1
+ footest#x: 0
Karsten Hopp 46abd1
+ OK
Karsten Hopp 46abd1
  local_list: 1
Karsten Hopp 46abd1
  OK
Karsten Hopp 46abd1
  local_list[1]: 1
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 195,197 ****
Karsten Hopp 46abd1
--- 201,206 ----
Karsten Hopp 46abd1
  OK
Karsten Hopp 46abd1
  a:2: 0
Karsten Hopp 46abd1
  OK
Karsten Hopp 46abd1
+  g:footest#x = 1
Karsten Hopp 46abd1
+    footest#F() 0
Karsten Hopp 46abd1
+ UndefFun() 0
Karsten Hopp 46abd1
*** ../vim-7.4.148/src/testdir/sautest/autoload/footest.vim	1970-01-01 01:00:00.000000000 +0100
Karsten Hopp 46abd1
--- src/testdir/sautest/autoload/footest.vim	2014-01-14 14:52:06.000000000 +0100
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 0 ****
Karsten Hopp 46abd1
--- 1,5 ----
Karsten Hopp 46abd1
+ " Autoload script used by test55 and test60
Karsten Hopp 46abd1
+ let footest#x = 1
Karsten Hopp 46abd1
+ func footest#F()
Karsten Hopp 46abd1
+   return 0
Karsten Hopp 46abd1
+ endfunc
Karsten Hopp 46abd1
*** ../vim-7.4.148/src/version.c	2014-01-14 13:26:17.000000000 +0100
Karsten Hopp 46abd1
--- src/version.c	2014-01-14 15:23:36.000000000 +0100
Karsten Hopp 46abd1
***************
Karsten Hopp 46abd1
*** 740,741 ****
Karsten Hopp 46abd1
--- 740,743 ----
Karsten Hopp 46abd1
  {   /* Add new patch number below this line */
Karsten Hopp 46abd1
+ /**/
Karsten Hopp 46abd1
+     149,
Karsten Hopp 46abd1
  /**/
Karsten Hopp 46abd1
Karsten Hopp 46abd1
-- 
Karsten Hopp 46abd1
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 46abd1
157. You fum through a magazine, you first check to see if it has a web
Karsten Hopp 46abd1
     address.
Karsten Hopp 46abd1
Karsten Hopp 46abd1
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 46abd1
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 46abd1
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 46abd1
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///