Add dict to function refferencing self

This is no explicit problem in Vim, however Neovim diverged in this
behaviour from Vim and requires the dict attribute to be present before
accessing the self attribute.

See neovim/neovim#5763
This commit is contained in:
Hirokazu Hata 2016-12-13 16:44:39 +09:00 committed by Christian Brabandt
parent 7cb5c24151
commit dfc0cb772a
2 changed files with 6 additions and 6 deletions

View File

@ -5,20 +5,20 @@ scriptencoding utf-8
let s:prototype = {}
function! s:prototype.split(...)
function! s:prototype.split(...) dict
call add(self._sections, ['|', a:0 ? a:1 : '%='])
endfunction
function! s:prototype.add_section_spaced(group, contents)
function! s:prototype.add_section_spaced(group, contents) dict
let spc = empty(a:contents) ? '' : g:airline_symbols.space
call self.add_section(a:group, spc.a:contents.spc)
endfunction
function! s:prototype.add_section(group, contents)
function! s:prototype.add_section(group, contents) dict
call add(self._sections, [a:group, a:contents])
endfunction
function! s:prototype.add_raw(text)
function! s:prototype.add_raw(text) dict
call add(self._sections, ['', a:text])
endfunction
@ -34,7 +34,7 @@ function! s:get_prev_group(sections, i)
return ''
endfunction
function! s:prototype.build()
function! s:prototype.build() dict
let side = 1
let line = ''
let i = 0

View File

@ -82,7 +82,7 @@ endif
" available. This way we avoid overwriting v:shell_error, which might
" potentially disrupt other plugins.
if has('nvim')
function! s:system_job_handler(job_id, data, event)
function! s:system_job_handler(job_id, data, event) dict
if a:event == 'stdout'
let self.buf .= join(a:data)
endif