Patch 8.0.1377
Problem:    Cannot call a dict function in autoloaded dict.
Solution:   Call get_lval() passing the read-only flag.
Files:      src/userfunc.c, src/eval.c, src/testdir/sautest/autoload/foo.vim,
            src/testdir/sautest/autoload/globone.vim,
            src/testdir/sautest/autoload/globtwo.vim,
            src/testdir/test_escaped_glob.vim, src/Makefile,
            src/testdir/test_autoload.vim, src/testdir/Make_all.mak


*** ../vim-8.0.1376/src/userfunc.c      2017-06-24 14:48:07.215493177 +0200
--- src/userfunc.c      2017-12-07 21:32:41.376796256 +0100
***************
*** 1594,1600 ****
        start += lead;
  
      /* Note that TFN_ flags use the same values as GLV_ flags. */
!     end = get_lval(start, NULL, &lv, FALSE, skip, flags,
                                              lead > 2 ? 0 : FNE_CHECK_START);
      if (end == start)
      {
--- 1594,1600 ----
        start += lead;
  
      /* Note that TFN_ flags use the same values as GLV_ flags. */
!     end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY,
                                              lead > 2 ? 0 : FNE_CHECK_START);
      if (end == start)
      {
*** ../vim-8.0.1376/src/eval.c  2017-11-02 15:44:07.917903684 +0100
--- src/eval.c  2017-12-07 21:36:23.539484078 +0100
***************
*** 1956,1962 ****
  
      cc = *p;
      *p = NUL;
!     v = find_var(lp->ll_name, &ht, flags & GLV_NO_AUTOLOAD);
      if (v == NULL && !quiet)
        EMSG2(_(e_undefvar), lp->ll_name);
      *p = cc;
--- 1956,1965 ----
  
      cc = *p;
      *p = NUL;
!     /* Only pass &ht when we would write to the variable, it prevents autoload
!      * as well. */
!     v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht,
!                                                     flags & GLV_NO_AUTOLOAD);
      if (v == NULL && !quiet)
        EMSG2(_(e_undefvar), lp->ll_name);
      *p = cc;
***************
*** 6610,6615 ****
--- 6613,6620 ----
  
  /*
   * Get string v: variable value.  Uses a static buffer, can only be used once.
+  * If the String variable has never been set, return an empty string.
+  * Never returns NULL;
   */
      char_u *
  get_vim_var_str(int idx)
*** ../vim-8.0.1376/src/testdir/sautest/autoload/foo.vim        2017-12-07 
22:08:23.351402940 +0100
--- src/testdir/sautest/autoload/foo.vim        2017-12-07 21:44:49.508517701 
+0100
***************
*** 0 ****
--- 1,7 ----
+ let g:loaded_foo_vim += 1
+ 
+ let foo#bar = {}
+ 
+ func foo#bar.echo()
+   let g:called_foo_bar_echo += 1
+ endfunc
*** ../vim-8.0.1376/src/testdir/sautest/autoload/globone.vim    2017-12-07 
22:09:50.022872460 +0100
--- src/testdir/sautest/autoload/globone.vim    2017-12-07 22:04:04.305001679 
+0100
***************
*** 0 ****
--- 1 ----
+ " used by Test_globpath()
*** ../vim-8.0.1376/src/testdir/sautest/autoload/globtwo.vim    2017-12-07 
22:09:50.026872436 +0100
--- src/testdir/sautest/autoload/globtwo.vim    2017-12-07 22:04:27.496857553 
+0100
***************
*** 0 ****
--- 1 ----
+ " used by Test_globpath()
*** ../vim-8.0.1376/src/testdir/test_escaped_glob.vim   2017-11-21 
11:43:04.083900999 +0100
--- src/testdir/test_escaped_glob.vim   2017-12-07 22:05:10.340591878 +0100
***************
*** 25,32 ****
  endfunction
  
  function Test_globpath()
!   call 
assert_equal("sautest/autoload/Test104.vim\nsautest/autoload/footest.vim",
!         \ globpath('sautest/autoload', '*.vim'))
!   call assert_equal(['sautest/autoload/Test104.vim', 
'sautest/autoload/footest.vim'],
!         \ globpath('sautest/autoload', '*.vim', 0, 1))
  endfunction
--- 25,32 ----
  endfunction
  
  function Test_globpath()
!   call 
assert_equal("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim",
!         \ globpath('sautest/autoload', 'glob*.vim'))
!   call assert_equal(['sautest/autoload/globone.vim', 
'sautest/autoload/globtwo.vim'],
!         \ globpath('sautest/autoload', 'glob*.vim', 0, 1))
  endfunction
*** ../vim-8.0.1376/src/Makefile        2017-11-25 15:19:45.097464854 +0100
--- src/Makefile        2017-12-07 21:45:03.372436683 +0100
***************
*** 2120,2125 ****
--- 2124,2130 ----
        test_assign \
        test_autochdir \
        test_autocmd \
+       test_autoload \
        test_backspace_opt \
        test_breakindent \
        test_bufline \
*** ../vim-8.0.1376/src/testdir/test_autoload.vim       2017-12-07 
22:08:23.355402915 +0100
--- src/testdir/test_autoload.vim       2017-12-07 21:51:15.166011903 +0100
***************
*** 0 ****
--- 1,11 ----
+ " Tests for autoload
+ 
+ set runtimepath=./sautest
+ 
+ func! Test_autoload_dict_func()
+   let g:loaded_foo_vim = 0
+   let g:called_foo_bar_echo = 0
+   call g:foo#bar.echo()
+   call assert_equal(1, g:loaded_foo_vim)
+   call assert_equal(1, g:called_foo_bar_echo)
+ endfunc
*** ../vim-8.0.1376/src/testdir/Make_all.mak    2017-11-25 15:19:45.097464854 
+0100
--- src/testdir/Make_all.mak    2017-12-07 21:45:26.352302414 +0100
***************
*** 73,78 ****
--- 73,79 ----
            test_assert.res \
            test_autochdir.res \
            test_autocmd.res \
+           test_autoload.res \
            test_backspace_opt.res \
            test_breakindent.res \
            test_bufwintabinfo.res \
*** ../vim-8.0.1376/src/version.c       2017-12-05 21:32:28.947651524 +0100
--- src/version.c       2017-12-07 21:52:19.477565829 +0100
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1377,
  /**/

-- 
>From "know your smileys":
 ~#:-(  I just washed my hair, and I can't do nuthin' with it.

 /// Bram Moolenaar -- [email protected] -- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui