added loop detection + found a bug (can't yet reproduce)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-05-20 17:08:47 +03:00
parent 48bb6b2746
commit 9670d2bf0b
2 changed files with 19 additions and 3 deletions

View File

@ -601,9 +601,25 @@ var FeatureSetProto = {
// chain completed -> check and store...
if(chain.indexOf(k) >= 0){
var c = JSON.stringify(chain)
// repeating chain -> loop detected...
// repeating chain -> loop or order conflict detected...
if(chains.indexOf(c) >= 0){
console.error('Feature cyclic dependency:', chain)
// format the graph...
// XXX this catches strange things and not only loops...
// ...at this point I can't repeat this error, see
// ImageGrid.Viewer in nwjs load console output...
var graph = []
chain.forEach(function(k){
graph = graph
.concat((that[k].depends || [])
.filter(function(e){
return chain.indexOf(e) >= 0 })
.map(function(e){
return `${k} \t-> ${e}` })) })
console.error('Feature cyclic dependency or order conflict:\n\t'
+ graph.join('\n\t'))
// XXX should we give up completely (break) here
// or move on and find new loops???
break
}
chains.push(c)

View File

@ -1,6 +1,6 @@
{
"name": "ig-features",
"version": "2.2.5",
"version": "2.2.6",
"description": "",
"main": "features.js",
"scripts": {