static IEnumerable <JsParentedNode> Descendants(this JsParentedNode node) { var list = node.Children().ToList(); for (var i = 0; i < list.Count; i++) { var child = list[i]; yield return(child); if (child.Node != null) { var children = child.Children(); list.AddRange(children); } } }
static IEnumerable <JsParentedNode> Children(this JsParentedNode node) { return(node.Node.Children().Select(t => new JsParentedNode(t, node))); }
public JsParentedNode(JsNode node, JsParentedNode parent) { Node = node; Parent = parent; }