Permalink
Browse files

Fix #175 implement the error check

  • Loading branch information...
1 parent b90b19b commit f5ecaea75b7efda146fe9ab6ba99d8385afc5c22 @Shougo committed Jan 4, 2017
Showing with 28 additions and 7 deletions.
  1. +14 −5 autoload/dein/autoload.vim
  2. +14 −2 test/install.vim
@@ -232,15 +232,24 @@ function! dein#autoload#_dummy_complete(arglead, cmdline, cursorpos) abort
endfunction
function! s:source_plugin(rtps, index, plugin, sourced) abort
- if a:plugin.sourced
+ if a:plugin.sourced || index(a:sourced, a:plugin) >= 0
return
endif
- let a:plugin.sourced = 1
+
+ call add(a:sourced, a:plugin)
" Load dependencies
for name in get(a:plugin, 'depends', [])
if !has_key(g:dein#_plugins, name)
- call dein#util#_error(printf('Plugin name "%s" is not found.', name))
+ call dein#util#_error(printf(
+ \ 'Plugin name "%s" is not found.', name))
+ return 1
+ endif
+
+ if !a:plugin.lazy && g:dein#_plugins[name].lazy
+ call dein#util#_error(printf(
+ \ 'Not lazy plugin "%s" depends lazy "%s" plugin.',
+ \ a:plugin.name, name))
return 1
endif
@@ -249,6 +258,8 @@ function! s:source_plugin(rtps, index, plugin, sourced) abort
endif
endfor
+ let a:plugin.sourced = 1
+
for on_source in filter(dein#util#_get_lazy_plugins(),
\ "index(get(v:val, 'on_source', []), a:plugin.name) >= 0")
if s:source_plugin(a:rtps, a:index, on_source, a:sourced)
@@ -276,8 +287,6 @@ function! s:source_plugin(rtps, index, plugin, sourced) abort
call add(a:rtps, a:plugin.rtp.'/after')
endif
endif
-
- call add(a:sourced, a:plugin)
endfunction
function! s:reset_ftplugin() abort
if exists('b:did_indent') || exists('b:did_ftplugin')
View
@@ -530,13 +530,25 @@ function! s:suite.depends_error_lazy() abort
call dein#begin(s:path)
call dein#add('Shougo/neocomplete.vim',
- \ { 'depends': 'vimfiler.vim', 'lazy': 1 })
+ \ { 'depends': 'vimfiler.vim' })
call s:assert.equals(s:dein_install(), 0)
call s:assert.equals(dein#end(), 0)
- call s:assert.equals(dein#source(['neocomplete.vim']), 1)
+ call s:assert.equals(dein#source(['neocomplete.vim']), 0)
+
+ call dein#begin(s:path)
+
+ call dein#add('Shougo/vimfiler.vim', { 'lazy': 1 })
+ call dein#add('Shougo/neocomplete.vim',
+ \ { 'depends': 'vimfiler.vim' })
+
+ call s:assert.equals(s:dein_install(), 0)
+
+ call s:assert.equals(dein#end(), 0)
+
+ call s:assert.equals(dein#source(['neocomplete.vim']), 0)
endfunction
function! s:suite.hooks() abort

0 comments on commit f5ecaea

Please sign in to comment.