Minor optimisation.

This commit is contained in:
LCD 47 2014-12-11 08:32:33 +02:00
parent 9caf33d5d5
commit f583df730d
2 changed files with 8 additions and 3 deletions

View File

@ -305,7 +305,7 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
" populate loclist and jump {{{3
let do_jump = syntastic#util#var('auto_jump') + 0
if do_jump == 2
let do_jump = loclist.getFirstError() == 1
let do_jump = loclist.getFirstError(1)
elseif do_jump == 3
let do_jump = loclist.getFirstError()
elseif 0 > do_jump || do_jump > 3

View File

@ -133,8 +133,13 @@ function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
return self._stl_flag
endfunction " }}}2
function! g:SyntasticLoclist.getFirstError() " {{{2
for idx in range(len(self._rawLoclist))
function! g:SyntasticLoclist.getFirstError(...) " {{{2
let max_issues = len(self._rawLoclist)
if a:0 && a:1 < max_issues
let max_issues = a:1
endif
for idx in range(max_issues)
if get(self._rawLoclist[idx], 'type', '') ==? 'E'
return idx + 1
endif