Permalink
Browse files

Add abort flag

  • Loading branch information...
1 parent aa075b9 commit 6cde85b6944bef2afb4f13d9d671da92ae9de62e @Shougo committed Feb 8, 2016
View
Oops, something went wrong.
@@ -29,7 +29,7 @@ set cpo&vim
" }}}
if !vimproc#util#is_windows()
- function! vimproc#cmd#system(expr)
+ function! vimproc#cmd#system(expr) abort
return vimproc#system(a:expr)
endfunction
let &cpo = s:save_cpo
@@ -45,7 +45,7 @@ augroup vimproc
augroup END
-function! s:cmd.open() "{{{
+function! s:cmd.open() abort "{{{
let cmd = 'cmd.exe'
let self.vimproc = vimproc#popen3(cmd)
let self.cwd = getcwd()
@@ -57,11 +57,11 @@ function! s:cmd.open() "{{{
endwhile
endfunction"}}}
-function! s:cmd.close() "{{{
+function! s:cmd.close() abort "{{{
call self.vimproc.waitpid()
endfunction"}}}
-function! s:cmd.system(cmd) "{{{
+function! s:cmd.system(cmd) abort "{{{
" Execute cmd.
if self.cwd !=# getcwd()
" Execute cd.
@@ -90,7 +90,7 @@ endfunction"}}}
call s:cmd.open()
-function! vimproc#cmd#system(expr)
+function! vimproc#cmd#system(expr) abort
let cmd = type(a:expr) == type('') ? a:expr :
\ join(map(a:expr,
\ 'match(v:val, "\\s") >= 0 ? "\"".v:val."\"" : v:val'))
@@ -17,18 +17,18 @@ let s:is_mac = !s:is_windows && !s:is_cygwin
\ (!executable('xdg-open') && system('uname') =~? '^darwin'))
" Get the directory separator.
-function! s:separator()
+function! s:separator() abort
return !exists('+shellslash') || &shellslash ? '/' : '\'
endfunction
" Get the path separator.
let s:path_separator = s:is_windows ? ';' : ':'
-function! s:path_separator()
+function! s:path_separator() abort
return s:path_separator
endfunction
" Get the path extensions
-function! s:path_extensions()
+function! s:path_extensions() abort
if !exists('s:path_extensions')
if s:is_windows
if exists('$PATHEXT')
@@ -49,12 +49,12 @@ function! s:path_extensions()
endfunction
" Convert all directory separators to "/".
-function! s:unify_separator(path)
+function! s:unify_separator(path) abort
return substitute(a:path, s:path_sep_pattern, '/', 'g')
endfunction
" Get the full path of command.
-function! s:which(command, ...)
+function! s:which(command, ...) abort
let maxcount = (a:0 >= 2 && type(a:2) == type(0)) ? a:2 : 1
if maxcount == 1 && exists('*exepath')
let full = exepath(a:command)
@@ -105,15 +105,15 @@ endfunction
" Split the path with directory separator.
" Note that this includes the drive letter of MS Windows.
-function! s:split(path)
+function! s:split(path) abort
return split(a:path, s:path_sep_pattern)
endfunction
" Join the paths.
" join('foo', 'bar') => 'foo/bar'
" join('foo/', 'bar') => 'foo/bar'
" join('/foo/', ['bar', 'buz/']) => '/foo/bar/buz/'
-function! s:join(...)
+function! s:join(...) abort
let sep = s:separator()
let path = ''
for part in a:000
@@ -127,19 +127,19 @@ endfunction
" Check if the path is absolute path.
if s:is_windows
- function! s:is_absolute(path)
+ function! s:is_absolute(path) abort
return a:path =~? '^[a-z]:[/\]'
endfunction
else
- function! s:is_absolute(path)
+ function! s:is_absolute(path) abort
return a:path[0] ==# '/'
endfunction
endif
" Return the parent directory of the path.
" NOTE: fnamemodify(path, ':h') does not return the parent directory
" when path[-1] is the separator.
-function! s:dirname(path)
+function! s:dirname(path) abort
let path = a:path
let orig = a:path
@@ -153,7 +153,7 @@ function! s:dirname(path)
endfunction
" Remove the separator at the end of a:path.
-function! s:remove_last_separator(path)
+function! s:remove_last_separator(path) abort
let sep = s:separator()
let pat = (sep == '\' ? '\\' : '/') . '\+$'
return substitute(a:path, pat, '', '')
@@ -163,11 +163,11 @@ endfunction
" Return true if filesystem ignores alphabetic case of a filename.
" Return false otherwise.
let s:is_case_tolerant = filereadable(expand('<sfile>:r') . '.VIM')
-function! s:is_case_tolerant()
+function! s:is_case_tolerant() abort
return s:is_case_tolerant
endfunction
-function! vimproc#filepath#which(command, path, maxcount)
+function! vimproc#filepath#which(command, path, maxcount) abort
return s:which(a:command, a:path, a:maxcount)
endfunction
@@ -35,15 +35,15 @@ let g:vimproc#lexer#token_type = {
\ }
" }}}
-function! vimproc#lexer#init_lexer(text)
+function! vimproc#lexer#init_lexer(text) abort
let lexer = deepcopy(s:lexer)
let lexer.reader = vimproc#lexer#init_reader(a:text)
return lexer
endfunction
let s:lexer = {}
-function! s:lexer.advance()
+function! s:lexer.advance() abort
call self.skip_spaces()
let c = self.reader.read()
@@ -62,7 +62,7 @@ function! s:lexer.advance()
return 1
endfunction
-function! s:lexer.lex_digit()
+function! s:lexer.lex_digit() abort
let self.val = 0
while 1
let c = self.reader.read()
@@ -77,7 +77,7 @@ function! s:lexer.lex_digit()
endwhile
endfunction
-function! s:lexer.skip_spaces()
+function! s:lexer.skip_spaces() abort
while 1
let c = self.reader.read()
if c < 0
@@ -89,15 +89,15 @@ function! s:lexer.skip_spaces()
endwhile
endfunction
-function! s:lexer.token()
+function! s:lexer.token() abort
return self.tok
endfunction
-function! s:lexer.value()
+function! s:lexer.value() abort
return self.val
endfunction
-function! vimproc#lexer#init_reader(text)
+function! vimproc#lexer#init_reader(text) abort
let reader = deepcopy(s:reader)
let reader.text = split(a:text, '\zs')
let reader.pos = 0
@@ -107,7 +107,7 @@ endfunction
let s:reader = {}
-function! s:reader.read()
+function! s:reader.read() abort
if self.pos >= len(self.text)
" Buffer over.
return -1
@@ -119,7 +119,7 @@ function! s:reader.read()
return c
endfunction
-function! s:reader.unread()
+function! s:reader.unread() abort
let self.pos -= 1
endfunction
Oops, something went wrong.

0 comments on commit 6cde85b

Please sign in to comment.