3
3
"
4
4
" See https://github.com/vim-jp/vital.vim for vital module.
5
5
6
- let s: VimLParser = vital#vimlparser#import (' VimlParser' ).import ()
6
+ call extend ( s: , vital#vimlparser#import (' VimlParser' ).import () )
7
7
8
8
" To Vim plugin developer who want to depend on vim-vimlparser:
9
9
" Please use vimlparser as vital-module instead of this autoload function.
10
10
" We do not ensure that future changes are backward compatible.
11
11
function ! vimlparser#import ()
12
- return s: VimLParser
12
+ return s:
13
13
endfunction
14
14
15
15
" @brief Read input as VimScript and return stringified AST.
@@ -31,3 +31,32 @@ function! vimlparser#test(input, ...)
31
31
echoerr substitute (v: throwpoint , ' \.\.\zs\d\+' , ' \=s:numtoname(submatch(0))' , ' g' ) . " \n " . v: exception
32
32
endtry
33
33
endfunction
34
+
35
+ if has (' patch-7.4.1842' )
36
+ function ! s: numtoname (num)
37
+ for k in keys (s: )
38
+ if type (s: [k ]) == type ({})
39
+ for name in keys (s: [k ])
40
+ if type (s: [k ][name]) == type (function (' tr' )) && get (s: [k ][name], ' name' ) == a: num
41
+ return printf (' %s.%s' , k , name)
42
+ endif
43
+ endfor
44
+ endif
45
+ endfor
46
+ return a: num
47
+ endfunction
48
+ else
49
+ function ! s: numtoname (num)
50
+ let sig = printf (" function('%s')" , a: num )
51
+ for k in keys (s: )
52
+ if type (s: [k ]) == type ({})
53
+ for name in keys (s: [k ])
54
+ if type (s: [k ][name]) == type (function (' tr' )) && string (s: [k ][name]) == sig
55
+ return printf (' %s.%s' , k , name)
56
+ endif
57
+ endfor
58
+ endif
59
+ endfor
60
+ return a: num
61
+ endfunction
62
+ endif
0 commit comments