summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0019
blob: 2c23681b752d21cf01ad31d3087d81e9084841ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0019
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0019
Problem:    Error when defining a Lambda with index of a function result.
Solution:   When not evaluating an expression and skipping a function call,
            set the return value to VAR_UNKNOWN.
Files:	    src/userfunc.c, src/testdir/test_lambda.vim


*** ../vim-8.1.0018/src/userfunc.c	2018-03-04 16:24:26.000000000 +0100
--- src/userfunc.c	2018-05-22 18:28:12.801624574 +0200
***************
*** 1349,1356 ****
      }
  
  
!     /* execute the function if no errors detected and executing */
!     if (evaluate && error == ERROR_NONE)
      {
  	char_u *rfname = fname;
  
--- 1349,1364 ----
      }
  
  
!     /*
!      * Execute the function if executing and no errors were detected.
!      */
!     if (!evaluate)
!     {
! 	// Not evaluating, which means the return value is unknown.  This
! 	// matters for giving error messages.
! 	rettv->v_type = VAR_UNKNOWN;
!     }
!     else if (error == ERROR_NONE)
      {
  	char_u *rfname = fname;
  
*** ../vim-8.1.0018/src/testdir/test_lambda.vim	2017-02-02 22:52:07.000000000 +0100
--- src/testdir/test_lambda.vim	2018-05-22 18:27:22.697688766 +0200
***************
*** 284,286 ****
--- 284,292 ----
    call test_garbagecollect_now()
    call assert_equal(14, s:Abar())
  endfunc
+ 
+ func Test_lambda_with_index()
+   let List = {x -> [x]}
+   let Extract = {-> function(List, ['foobar'])()[0]}
+   call assert_equal('foobar', Extract())
+ endfunc
*** ../vim-8.1.0018/src/version.c	2018-05-22 17:50:38.683980716 +0200
--- src/version.c	2018-05-22 18:27:48.673655578 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     19,
  /**/

-- 
Westheimer's Discovery:
        A couple of months in the laboratory can
        frequently save a couple of hours in the library.

 /// 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    ///