Commits

ZyX_I committed 490ba7c

Fixed newfeature feature registration, fixed feature.load(), fixed warning about _frawor plugin that depends on itself

Comments (0)

Files changed (2)

 function frawor#Setup(version, dependencies, oneload)
+    if !exists('*FraworRegister')
+        runtime! plugin/frawor.vim
+    endif
     if type(a:version)==type("")
         let ver=map(split(a:version, '\.'), '+v:val')
     else
     endif
     let d={}
     let deps=copy(a:dependencies)
-    if has_key(s:g, '_frawor') && !has_key(deps, s:g._frawor.id)
-        let deps[s:g._frawor.id]=s:g.pls[s:g._frawor.id].version
+    if has_key(s:g, '_frawor')
+        if !has_key(deps, s:g._frawor.id)
+            let deps[s:g._frawor.id]=s:g.pls[s:g._frawor.id].version
+        endif
+    else
+        let deps[plid]=plversion
     endif
     for [dplid, d.Version] in items(deps)
         "▶4 Verifying dependency version
     endif
     "▶2 Feature registration
     if has_key(a:feature, 'load')
+        let d={}
         let d.Result=a:feature.load(a:plugdict)
         let a:plugdict.features[a:feature.id]=((d.Result is 0)?({}):(d.Result))
     elseif has_key(a:feature, 'init')
         try
             "▶2 Loading dependencies
             for [dplid, d.Version] in items(plugdict.dependencies)
-                if type(d.Version)!=type([])
-                    continue
-                endif
                 if has_key(s:g.loading, dplid)
-                    call s:F._frawor.warn('recdep', dplid, a:plid)
+                    if dplid!=#a:plid
+                        call s:F._frawor.warn('recdep', dplid, a:plid)
+                    endif
                     continue
                 endif
                 if s:F.loadplugin(dplid)
 let s:g._frawor=s:F.newplugin([0, 0],
             \       s:Eval('+matchstr(expand("<sfile>"), ''\d\+'')'),
             \       expand('<sfile>:p'), {}, 1, s:g, s:F)
-let s:g.features.newfeature.plid=s:g._frawor.id
-let s:g.pls[s:g._frawor.id].features.newfeature={
-            \   'newfeature': s:g.features.newfeature,
-        \}
 call s:F.addfeature(s:g.pls[s:g._frawor.id], s:g.features.newfeature)
+let s:g.pls[s:g._frawor.id].features.newfeature.newfeature=
+            \                                           s:g.features.newfeature
 "▶1 warn feature
 function s:F.warn(plugdict, msgid, ...)
     if !has_key(a:plugdict.g, '_messages')