Throw error if requiring doesn't load namespace

References #2.
This commit is contained in:
Tim Pope 2012-12-04 20:15:33 -05:00
parent a5bc4b0b44
commit 208f549664

View File

@ -135,12 +135,13 @@ function! s:repl.eval(expr, ns) dict abort
endfunction endfunction
function! s:repl.require(lib) dict abort function! s:repl.require(lib) dict abort
if a:lib =~# '^\%(user\)\=$' || has_key(self.requires, a:lib) if a:lib !~# '^\%(user\)\=$' && !get(self.requires, a:lib, 0)
return '' let reload = has_key(self.requires, a:lib) ? ' :reload' : ''
endif let self.requires[a:lib] = 0
let result = self.eval('(require '.s:qsym(a:lib).')', 'user') call self.eval('(doto '.s:qsym(a:lib).' (require'.reload.') the-ns)', 'user')
let self.requires[a:lib] = 1 let self.requires[a:lib] = 1
return result endif
return ''
endfunction endfunction
function! s:repl.includes_file(file) dict abort function! s:repl.includes_file(file) dict abort