protected void SetChildByRole <T> (Role <T> role, T newChild) where T : AstNode { AstNode oldChild = GetChildByRole(role); if (oldChild.IsNull) { AddChild(newChild, role); } else { oldChild.ReplaceWith(newChild); } }