Commits

ZyX_I committed d82318b

Removed hardcoding of `plugin/frawor' as self id

Comments (0)

Files changed (1)

plugin/frawor.vim

 let s:g.pls={} " Plugin dictionaries
 let s:g.loading={}
 let s:g.features={}
-let s:g.dependents={'plugin/frawor': {}}
+let s:g.dependents={}
 "▶2 Messages
 if v:lang=~?'ru'
     let s:g._messages={
                 \      'oneload': !!a:oneload,
                 \         'file': a:file,
                 \          'sid': a:sid,
-                \ 'dependencies': {'plugin/frawor': 1},
+                \ 'dependencies': {},
                 \       'status': 1,
                 \     'features': {},
                 \            'F': a:F,
         call s:F._frawor.throw('depnotdict', plid)
     endif
     let d={}
-    for [dplid, d.Version] in items(a:dependencies)
+    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
+    endif
+    for [dplid, d.Version] in items(deps)
         "▶4 Verifying dependency version
         if type(d.Version)!=type([])
             call s:F._frawor.throw('d_vernotlist', dplid, plid)
         endif
         let s:g.dependents[dplid][plid]=1
     endfor
-    let s:g.dependents['plugin/frawor'][plid]=1
     lockvar! plugdict.dependencies
     "▶2 Locking plugdict
     lockvar 1 plugdict
 endfunction
 "▶1 features.newfeature.cons
 let s:g.features.newfeature={
-            \'plid': 'plugin/frawor',
             \  'id': 'newfeature',
             \'init': {},
         \}
         unlet s:g.features[fid]
     endfor
 endfunction
-"▶1 warn
+"▶1 Plugin registration
+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)
+"▶1 warn feature
 function s:F.warn(plugdict, msgid, ...)
     if !has_key(a:plugdict.g, '_messages')
         call s:F._frawor.throw('nomessages', a:plugdict.id)
     echohl None
     return message
 endfunction
-"▶1 throw
+call s:F._frawor.newfeature('warn', {'cons': s:F.warn})
+"▶1 throw feature
 function s:F.throw(plugdict, msgid, ...)
     let throwmsg='Frawor:'.escape(a:plugdict.id, '\:').':'.
                 \escape(a:msgid, '\:').':'.
                 \call(s:F.warn, [a:plugdict, a:msgid]+a:000, {})
     throw throwmsg
 endfunction
-"▶1 Plugin registration
-call s:F.newplugin([0, 0], s:Eval('+matchstr(expand("<sfile>"), ''\d\+'')'),
-            \      expand('<sfile>:p'), {}, 1, s:g, s:F)
-"▶2 XXX adding missing features
-let s:g.pls['plugin/frawor'].features.newfeature={
-            \   'newfeature': s:g.features.newfeature,
-        \}
-call s:F.addfeature(s:g.pls['plugin/frawor'], s:g.features.newfeature)
-call s:F._frawor.newfeature('warn', {'cons': s:F.warn})
 call s:F._frawor.newfeature('throw', {'cons': s:F.throw})
 
 " vim: fmr=▶,▲ sw=4 ts=4 sts=4 et tw=80