Patch 7.4.149

2014-01-14 Thread Bram Moolenaar

Patch 7.4.149
Problem:Get E685 error when assigning a function to an autoload variable.
(Yukihiro Nakadaira)
Solution:   Instead of having a global no_autoload variable, pass an autoload
flag down to where it is used. (ZyX)
Files:  src/eval.c, src/testdir/test55.in, src/testdir/test55.ok,
src/testdir/test60.in, src/testdir/test60.ok,
src/testdir/sautest/autoload/footest.vim


*** ../vim-7.4.148/src/eval.c   2014-01-06 06:18:44.0 +0100
--- src/eval.c  2014-01-14 15:14:05.0 +0100
***
*** 125,133 
   */
  static hashtab_T  compat_hashtab;
  
- /* When using exists() don't auto-load a script. */
- static intno_autoload = FALSE;
- 
  /*
   * When recursively copying lists and dicts we need to remember which ones we
   * have done to avoid endless recursiveness.  This unique ID is used for that.
--- 125,130 
***
*** 156,161 
--- 153,163 
  /* Values for trans_function_name() argument: */
  #define TFN_INT   1   /* internal function name OK */
  #define TFN_QUIET 2   /* no error messages */
+ #define TFN_NO_AUTOLOAD   4   /* do not use script autoloading */
+ 
+ /* 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 */
  
  /*
   * Structure to hold info for a user function.
***
*** 390,396 
  static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg, int *first));
  static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u 
*endchars, char_u *op));
  static int check_changedtick __ARGS((char_u *arg));
! static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, 
int unlet, int skip, int quiet, int fne_flags));
  static void clear_lval __ARGS((lval_T *lp));
  static void set_var_lval __ARGS((lval_T *lp, char_u *endp, typval_T *rettv, 
int copy, char_u *op));
  static int tv_op __ARGS((typval_T *tv1, typval_T *tv2, char_u  *op));
--- 392,398 
  static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg, int *first));
  static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u 
*endchars, char_u *op));
  static int check_changedtick __ARGS((char_u *arg));
! static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, 
int unlet, int skip, int flags, int fne_flags));
  static void clear_lval __ARGS((lval_T *lp));
  static void set_var_lval __ARGS((lval_T *lp, char_u *endp, typval_T *rettv, 
int copy, char_u *op));
  static int tv_op __ARGS((typval_T *tv1, typval_T *tv2, char_u  *op));
***
*** 770,776 
  static char_u * make_expanded_name __ARGS((char_u *in_start, char_u 
*expr_start, char_u *expr_end, char_u *in_end));
  static int eval_isnamec __ARGS((int c));
  static int eval_isnamec1 __ARGS((int c));
! static int get_var_tv __ARGS((char_u *name, int len, typval_T *rettv, int 
verbose));
  static int handle_subscript __ARGS((char_u **arg, typval_T *rettv, int 
evaluate, int verbose));
  static typval_T *alloc_tv __ARGS((void));
  static typval_T *alloc_string_tv __ARGS((char_u *string));
--- 772,778 
  static char_u * make_expanded_name __ARGS((char_u *in_start, char_u 
*expr_start, char_u *expr_end, char_u *in_end));
  static int eval_isnamec __ARGS((int c));
  static int eval_isnamec1 __ARGS((int c));
! static int get_var_tv __ARGS((char_u *name, int len, typval_T *rettv, int 
verbose, int no_autoload));
  static int handle_subscript __ARGS((char_u **arg, typval_T *rettv, int 
evaluate, int verbose));
  static typval_T *alloc_tv __ARGS((void));
  static typval_T *alloc_string_tv __ARGS((char_u *string));
***
*** 781,788 
  static char_u *get_tv_string __ARGS((typval_T *varp));
  static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
  static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
! static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp));
! static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u 
*varname, int writing));
  static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
  static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val));
  static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi));
--- 783,790 
  static char_u *get_tv_string __ARGS((typval_T *varp));
  static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
  static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
! static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp, int 
no_autoload));
! static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u 
*varname, int no_autoload));
  static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
  static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val));
  static void delete_var _

Re: Patch 7.4.149

2014-01-14 Thread Yukihiro Nakadaira
On Tue, Jan 14, 2014 at 11:24 PM, Bram Moolenaar  wrote:

>
> Patch 7.4.149
> Problem:Get E685 error when assigning a function to an autoload
> variable.
> (Yukihiro Nakadaira)
> Solution:   Instead of having a global no_autoload variable, pass an
> autoload
> flag down to where it is used. (ZyX)
> Files:  src/eval.c, src/testdir/test55.in, src/testdir/test55.ok,
> src/testdir/test60.in, src/testdir/test60.ok,
> src/testdir/sautest/autoload/footest.vim
>

Sorry for my late reply.  It need additional no_autoload to fix the problem.

diff -r 98a642716acc src/eval.c
--- a/src/eval.cTue Jan 14 15:53:52 2014 +0100
+++ b/src/eval.cWed Jan 15 00:58:24 2014 +0900
@@ -447,7 +447,7 @@
 #endif
 static int get_env_tv __ARGS((char_u **arg, typval_T *rettv, int
evaluate));
 static int find_internal_func __ARGS((char_u *name));
-static char_u *deref_func_name __ARGS((char_u *name, int *lenp));
+static char_u *deref_func_name __ARGS((char_u *name, int *lenp, int
no_autoload));
 static int get_func_tv __ARGS((char_u *name, int len, typval_T *rettv,
char_u **arg, linenr_T firstline, linenr_T lastline, int *doesrange, int
evaluate, dict_T *selfdict));
 static int call_func __ARGS((char_u *funcname, int len, typval_T *rettv,
int argcount, typval_T *argvars, linenr_T firstline, linenr_T lastline, int
*doesrange, int evaluate, dict_T *selfdict));
 static void emsg_funcname __ARGS((char *ermsg, char_u *name));
@@ -3432,7 +3432,7 @@

 /* If it is the name of a variable of type VAR_FUNC use its contents.
*/
 len = (int)STRLEN(tofree);
-name = deref_func_name(tofree, &len);
+name = deref_func_name(tofree, &len, FALSE);

 /* Skip white space to allow ":call func ()".  Not good, but required
for
  * backward compatibility. */
@@ -5159,7 +5159,7 @@
 {
 /* If "s" is the name of a variable of type VAR_FUNC
  * use its contents. */
-s = deref_func_name(s, &len);
+s = deref_func_name(s, &len, FALSE);

 /* Invoke the function. */
 ret = get_func_tv(s, len, rettv, arg,
@@ -8282,16 +8282,17 @@
  * name it contains, otherwise return "name".
  */
 static char_u *
-deref_func_name(name, lenp)
+deref_func_name(name, lenp, no_autoload)
 char_u*name;
 int*lenp;
+intno_autoload;
 {
 dictitem_T*v;
 intcc;

 cc = name[*lenp];
 name[*lenp] = NUL;
-v = find_var(name, NULL, FALSE);
+v = find_var(name, NULL, no_autoload);
 name[*lenp] = cc;
 if (v != NULL && v->di_tv.v_type == VAR_FUNC)
 {
@@ -21938,14 +21939,14 @@
 if (lv.ll_exp_name != NULL)
 {
 len = (int)STRLEN(lv.ll_exp_name);
-name = deref_func_name(lv.ll_exp_name, &len);
+name = deref_func_name(lv.ll_exp_name, &len, flags & TFN_NO_AUTOLOAD);
 if (name == lv.ll_exp_name)
 name = NULL;
 }
 else
 {
 len = (int)(end - *pp);
-name = deref_func_name(*pp, &len);
+name = deref_func_name(*pp, &len, flags & TFN_NO_AUTOLOAD);
 if (name == *pp)
 name = NULL;
 }


-- 
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Patch 7.4.149

2014-01-14 Thread Bram Moolenaar

Yukihiro Nakadaira wrote:

> > Patch 7.4.149
> > Problem:Get E685 error when assigning a function to an autoload
> > variable.
> > (Yukihiro Nakadaira)
> > Solution:   Instead of having a global no_autoload variable, pass an
> > autoload
> > flag down to where it is used. (ZyX)
> > Files:  src/eval.c, src/testdir/test55.in, src/testdir/test55.ok,
> > src/testdir/test60.in, src/testdir/test60.ok,
> > src/testdir/sautest/autoload/footest.vim
> >
> 
> Sorry for my late reply.  It need additional no_autoload to fix the
> problem.

Thanks.  Perhaps we can add a test for your problem?


-- 
Send $25.00 for handy leaflet on how to make money by selling leaflets

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Patch 7.4.149

2014-01-14 Thread Yukihiro Nakadaira
On Wed, Jan 15, 2014 at 3:44 AM, Bram Moolenaar  wrote:

>
> Yukihiro Nakadaira wrote:
>
> > > Patch 7.4.149
> > > Problem:Get E685 error when assigning a function to an autoload
> > > variable.
> > > (Yukihiro Nakadaira)
> > > Solution:   Instead of having a global no_autoload variable, pass an
> > > autoload
> > > flag down to where it is used. (ZyX)
> > > Files:  src/eval.c, src/testdir/test55.in, src/testdir/test55.ok,
> > > src/testdir/test60.in, src/testdir/test60.ok,
> > > src/testdir/sautest/autoload/footest.vim
> > >
> >
> > Sorry for my late reply.  It need additional no_autoload to fix the
> > problem.
>
> Thanks.  Perhaps we can add a test for your problem?


I wrote test for it.  Please check the attached patch.

-- 
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
diff -r a42040fed96c src/testdir/Make_amiga.mak
--- a/src/testdir/Make_amiga.makTue Jan 14 21:31:34 2014 +0100
+++ b/src/testdir/Make_amiga.makWed Jan 15 11:51:47 2014 +0900
@@ -34,7 +34,8 @@
test81.out test82.out test83.out test84.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test97.out test98.out \
-   test99.out test100.out test101.out test102.out test103.out
+   test99.out test100.out test101.out test102.out test103.out \
+   test104.out
 
 .SUFFIXES: .in .out
 
@@ -154,3 +155,4 @@
 test101.out: test101.in
 test102.out: test102.in
 test103.out: test103.in
+test104.out: test104.in
diff -r a42040fed96c src/testdir/Make_dos.mak
--- a/src/testdir/Make_dos.mak  Tue Jan 14 21:31:34 2014 +0100
+++ b/src/testdir/Make_dos.mak  Wed Jan 15 11:51:47 2014 +0900
@@ -33,7 +33,7 @@
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test98.out test99.out \
-   test100.out test101.out test102.out test103.out
+   test100.out test101.out test102.out test103.out test104.out
 
 SCRIPTS32 =test50.out test70.out
 
diff -r a42040fed96c src/testdir/Make_ming.mak
--- a/src/testdir/Make_ming.mak Tue Jan 14 21:31:34 2014 +0100
+++ b/src/testdir/Make_ming.mak Wed Jan 15 11:51:47 2014 +0900
@@ -53,7 +53,7 @@
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test98.out test99.out \
-   test100.out test101.out test102.out test103.out
+   test100.out test101.out test102.out test103.out test104.out
 
 SCRIPTS32 =test50.out test70.out
 
diff -r a42040fed96c src/testdir/Make_os2.mak
--- a/src/testdir/Make_os2.mak  Tue Jan 14 21:31:34 2014 +0100
+++ b/src/testdir/Make_os2.mak  Wed Jan 15 11:51:47 2014 +0900
@@ -35,7 +35,7 @@
test81.out test82.out test83.out test84.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test98.out test99.out \
-   test100.out test101.out test102.out test103.out
+   test100.out test101.out test102.out test103.out test104.out
 
 .SUFFIXES: .in .out
 
diff -r a42040fed96c src/testdir/Make_vms.mms
--- a/src/testdir/Make_vms.mms  Tue Jan 14 21:31:34 2014 +0100
+++ b/src/testdir/Make_vms.mms  Wed Jan 15 11:51:47 2014 +0900
@@ -79,7 +79,7 @@
 test82.out test83.out test84.out test88.out test89.out \
 test90.out test91.out test92.out test93.out test94.out \
 test95.out test96.out test97.out test98.out test99.out \
-test100.out test101.out test102.out test103.out
+test100.out test101.out test102.out test103.out test104.out
 
 # Known problems:
 # Test 30: a problem around mac format - unknown reason
diff -r a42040fed96c src/testdir/Makefile
--- a/src/testdir/Makefile  Tue Jan 14 21:31:34 2014 +0100
+++ b/src/testdir/Makefile  Wed Jan 15 11:51:47 2014 +0900
@@ -30,7 +30,8 @@
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test97.out test98.out

Re: Patch 7.4.149

2014-01-15 Thread Bram Moolenaar

Yukihiro Nakadaira wrote:

> On Wed, Jan 15, 2014 at 3:44 AM, Bram Moolenaar  wrote:
> 
> >
> > Yukihiro Nakadaira wrote:
> >
> > > > Patch 7.4.149
> > > > Problem:Get E685 error when assigning a function to an autoload
> > > > variable.
> > > > (Yukihiro Nakadaira)
> > > > Solution:   Instead of having a global no_autoload variable, pass an
> > > > autoload
> > > > flag down to where it is used. (ZyX)
> > > > Files:  src/eval.c, src/testdir/test55.in, src/testdir/test55.ok,
> > > > src/testdir/test60.in, src/testdir/test60.ok,
> > > > src/testdir/sautest/autoload/footest.vim
> > > >
> > >
> > > Sorry for my late reply.  It need additional no_autoload to fix the
> > > problem.
> >
> > Thanks.  Perhaps we can add a test for your problem?
> 
> 
> I wrote test for it.  Please check the attached patch.

Thanks!

-- 
hundred-and-one symptoms of being an internet addict:
167. You have more than 200 websites bookmarked.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.