Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Fixed cycles
Browse files Browse the repository at this point in the history
- Throw an error when you declare a cycle

#997
  • Loading branch information
davidfowl committed Feb 12, 2015
1 parent 5648e41 commit 78c0533
Showing 1 changed file with 15 additions and 1 deletion.
Expand Up @@ -67,7 +67,7 @@ public class WalkContext
if (eclipsed)
{
break;
throw new InvalidOperationException(string.Format("Circular dependency detected {0}.", GetChain(node, dependency)));
}
foreach (var sideNode in scanNode.InnerNodes)
Expand Down Expand Up @@ -205,6 +205,20 @@ public class WalkContext
// uncomment in case of emergencies: TraceState(root);
}

private static string GetChain(Node node, LibraryDependency dependency)
{
var result = dependency.Name;
var current = node;

while (current != null)
{
result = current.Key.Name + " -> " + result;
current = current.OuterNode;
}

return result;
}

private void TraceState(Node root)
{
var elt = new XElement("state");
Expand Down

0 comments on commit 78c0533

Please sign in to comment.