public INode <AstNode> Visit(ListNode node) { // Ignore empty lists if (!node.Children.Any()) { return(node.Clone()); } var clonedChildren = node.Children.Select(Visit); // Ignore non-declaration nodes var symbolNode = node.Children.First() as SymbolNode; if (!ShouldBeConverted(node, symbolNode)) { return(new ListNode(clonedChildren)); } var children = node.Children.ToArray(); // Validate the child nodes if (HasValidChildNodes(node, children)) { return(CreateConvertedNode(node, clonedChildren)); } return(new ListNode(clonedChildren)); }
public void ListNodeCloneTest() { tlog.Debug(tag, $"ListNodeCloneTest START"); try { List <INode> nodes = new List <INode>() { new ElementNode(null, "1", null, 1, 1) }; var node = new ListNode(nodes, null, 1, 1); var ret = node.Clone(); Assert.IsNotNull(ret, "Should not be equal"); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } tlog.Debug(tag, $"ListNodeCloneTest END"); }