public override ElementSyntaxBase With( NameToken name = null, IImmutableList <AttributeSyntaxBase> attributes = null, IImmutableList <NodeSyntax> nodes = null, bool?isEmpty = null) { name = name ?? Name; nodes = nodes ?? Nodes; attributes = attributes ?? Attributes; if ((isEmpty ?? true) && nodes.Count == 0) { if (name.Equals(Name) && (attributes.Equals(Attributes) || attributes.SequenceEqual(Attributes))) { return(this); } return(new EmptyElementSyntax(LessThan, name, attributes, Slash, GreaterThan)); } return(ElementSyntax.Create( ElementStartTagSyntax.Create(LessThan, name, attributes, GreaterThanToken.Default), nodes, ElementEndTagSyntax.Create( LessThanToken.Default, SlashToken.Default, name, GreaterThan))); }
protected override SyntaxBase VisitElementStartTag(ElementStartTagSyntax syntax) { var attributes = VisitAttributes(syntax.Attributes); return(ElementStartTagSyntax.Create( LessThanToken.Create(TriviaSyntax.Empty, TriviaSyntax.Empty), syntax.Name.WithTrivia(TriviaSyntax.Empty, TriviaSyntax.Empty), attributes, GreaterThanToken.Create(TriviaSyntax.Empty, TriviaSyntax.Empty))); }
protected virtual SyntaxBase VisitElementStartTag(ElementStartTagSyntax syntax) { var lessThan = VisitAndConvert(syntax.LessThan); var name = VisitAndConvert(syntax.Name); var attributes = VisitAndConvert(syntax.Attributes); var greaterThan = VisitAndConvert(syntax.GreaterThan); if (SyntaxEquals(syntax.LessThan, lessThan) && SyntaxEquals(syntax.Name, name) && ReferenceEquals(syntax.Attributes, attributes) && SyntaxEquals(syntax.GreaterThan, greaterThan)) { return(syntax); } return(ElementStartTagSyntax.Create(lessThan, name, attributes, greaterThan)); }