ZyX_I avatar ZyX_I committed a274ddb

Added check for existance at least one of the keys `cons', `load', `unload' or `unloadpre'

Comments (0)

Files changed (1)


 let s:g.pls={} " Plugin dictionaries
 let s:g.loading={}
 let s:g.features={}
+let s:g.featfunckeys=['cons', 'load', 'unload', 'unloadpre']
 let s:g.f={
             \'cons':      {},
             \'load':      {},
                 \ 'foptsnotdct': 'Ошибка регистрации возможности %s '.
                 \                'дополнения %s: описание возможности '.
                 \                'не является словарём',
+                \  'nofeatkeys': 'Ошибка регистрации возможности %s '.
+                \                'дополнения %s: описание возможности '.
+                \                'не содержит ни одного из ключей '.
+                \                '«'.join(s:g.featfunckeys, '», «').'»',
                 \       'nfref': 'Ошибка регистрации возможности %s '.
                 \                'дополнения %s: значение ключа «%s» '.
                 \                'не является ссылкой на функцию',
                 \ 'foptsnotdct': 'Error while registering feature %s '.
                 \                'of a plugin %s: description argument '.
                 \                'is not a Dictionary',
+                \  'nofeatkeys': 'Error while registering feature %s '.
+                \                'of a plugin %s: description argument '.
+                \                'contains none of the keys '.
+                \                '`'.join(s:g.featfunckeys, "', `")."'",
                 \       'nfref': 'Error while registering feature %s '.
                 \                'of a plugin %s: `%s'' fopts key is not '.
                 \                'a function reference',
     let feature={}
     let feature.plid=a:plugdict.id
     let feature.id=a:fid
-    for key in ['cons', 'load', 'unload', 'unloadpre']
+    let addedsomething=0
+    for key in s:g.featfunckeys
         if has_key(a:fopts, key)
-            call s:F.isfunc(a:fopts[key], key, a:fid, feature.plid)
+            call s:F.isfunc(a:fopts[key], key, feature.id, feature.plid)
             let feature[key]=a:fopts[key]
-            let s:g.f[key][a:fid]=feature
+            let s:g.f[key][feature.id]=feature
+            let addedsomething=1
+    if !addedsomething
+        call s:F._frawor.throw('nofeatkeys', feature.id, feature.plid)
+    endif
     if has_key(a:fopts, 'ignoredeps')
         let feature.ignoredeps=1
     if has_key(a:fopts, 'init')
         let feature.init=a:fopts.init
-        let s:g.f.load[a:fid]=feature
+        let s:g.f.load[feature.id]=feature
-    let a:plugdict.features.newfeature[a:fid]=feature
-    let s:g.features[a:fid]=feature
+    let a:plugdict.features.newfeature[feature.id]=feature
+    let s:g.features[feature.id]=feature
     if has_key(feature, 'ignoredeps')
         call map(values(s:g.pls), 's:F.addfeature(v:val, feature)')
     elseif has_key(s:g.dependents, a:plugdict.id)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.