Simplification of IntermediateNode

This commit is contained in:
Ryan Nowak 2017-07-02 16:44:57 -07:00
parent 112cbc0bb6
commit a7cc63d6e1
32 changed files with 30 additions and 795 deletions

View File

@ -9,12 +9,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
{ {
internal sealed class PreallocatedTagHelperHtmlAttributeIntermediateNode : ExtensionIntermediateNode internal sealed class PreallocatedTagHelperHtmlAttributeIntermediateNode : ExtensionIntermediateNode
{ {
public override RazorDiagnosticCollection Diagnostics { get; } = ReadOnlyDiagnosticCollection.Instance;
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override bool HasDiagnostics => false;
public string VariableName { get; set; } public string VariableName { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)

View File

@ -33,12 +33,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
} }
} }
public override RazorDiagnosticCollection Diagnostics { get; } = ReadOnlyDiagnosticCollection.Instance;
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override bool HasDiagnostics => false;
public string VariableName { get; set; } public string VariableName { get; set; }
public string AttributeName { get; set; } public string AttributeName { get; set; }

View File

@ -30,12 +30,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
TagHelper = propertyNode.TagHelper; TagHelper = propertyNode.TagHelper;
} }
public override RazorDiagnosticCollection Diagnostics => ReadOnlyDiagnosticCollection.Instance;
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override bool HasDiagnostics => false;
public string AttributeName { get; set; } public string AttributeName { get; set; }
public AttributeStructure AttributeStructure { get; set; } public AttributeStructure AttributeStructure { get; set; }

View File

@ -9,12 +9,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
{ {
internal sealed class PreallocatedTagHelperPropertyValueIntermediateNode : ExtensionIntermediateNode internal sealed class PreallocatedTagHelperPropertyValueIntermediateNode : ExtensionIntermediateNode
{ {
public override RazorDiagnosticCollection Diagnostics { get; } = ReadOnlyDiagnosticCollection.Instance;
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override bool HasDiagnostics => false;
public string VariableName { get; set; } public string VariableName { get; set; }
public string AttributeName { get; set; } public string AttributeName { get; set; }

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class CSharpCodeAttributeValueIntermediateNode : IntermediateNode public sealed class CSharpCodeAttributeValueIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string Prefix { get; set; } public string Prefix { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class CSharpCodeIntermediateNode : IntermediateNode public sealed class CSharpCodeIntermediateNode : IntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
if (visitor == null) if (visitor == null)

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class CSharpExpressionAttributeValueIntermediateNode : IntermediateNode public sealed class CSharpExpressionAttributeValueIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string Prefix { get; set; } public string Prefix { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class CSharpExpressionIntermediateNode : IntermediateNode public sealed class CSharpExpressionIntermediateNode : IntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
if (visitor == null) if (visitor == null)

View File

@ -8,41 +8,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class ClassDeclarationIntermediateNode : MemberDeclarationIntermediateNode public sealed class ClassDeclarationIntermediateNode : MemberDeclarationIntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public IList<string> Modifiers { get; } = new List<string>(); public IList<string> Modifiers { get; } = new List<string>();
public string Name { get; set; } public string Name { get; set; }

View File

@ -8,41 +8,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class DirectiveIntermediateNode : IntermediateNode public sealed class DirectiveIntermediateNode : IntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string Name { get; set; } public string Name { get; set; }
public IEnumerable<DirectiveTokenIntermediateNode> Tokens => Children.OfType<DirectiveTokenIntermediateNode>(); public IEnumerable<DirectiveTokenIntermediateNode> Tokens => Children.OfType<DirectiveTokenIntermediateNode>();

View File

@ -5,41 +5,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class DirectiveTokenIntermediateNode : IntermediateNode public sealed class DirectiveTokenIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string Content { get; set; } public string Content { get; set; }
public DirectiveTokenDescriptor Descriptor { get; set; } public DirectiveTokenDescriptor Descriptor { get; set; }

View File

@ -8,45 +8,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class DocumentIntermediateNode : IntermediateNode public sealed class DocumentIntermediateNode : IntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public string DocumentKind { get; set; } public string DocumentKind { get; set; }
public RazorCodeGenerationOptions Options { get; set; } public RazorCodeGenerationOptions Options { get; set; }
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public CodeTarget Target { get; set; } public CodeTarget Target { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)

View File

@ -8,39 +8,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public abstract class ExtensionIntermediateNode : IntermediateNode public abstract class ExtensionIntermediateNode : IntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public abstract void WriteNode(CodeTarget target, CodeRenderingContext context); public abstract void WriteNode(CodeTarget target, CodeRenderingContext context);
protected static void AcceptExtensionNode<TNode>(TNode node, IntermediateNodeVisitor visitor) protected static void AcceptExtensionNode<TNode>(TNode node, IntermediateNodeVisitor visitor)

View File

@ -8,41 +8,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class FieldDeclarationIntermediateNode : MemberDeclarationIntermediateNode public sealed class FieldDeclarationIntermediateNode : MemberDeclarationIntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public IList<string> Modifiers { get; } = new List<string>(); public IList<string> Modifiers { get; } = new List<string>();
public string Name { get; set; } public string Name { get; set; }

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class HtmlAttributeIntermediateNode : IntermediateNode public sealed class HtmlAttributeIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string AttributeName { get; set; } public string AttributeName { get; set; }
public string Prefix { get; set; } public string Prefix { get; set; }

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class HtmlAttributeValueIntermediateNode : IntermediateNode public sealed class HtmlAttributeValueIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string Prefix { get; set; } public string Prefix { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)

View File

@ -2,47 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Razor.Language.Intermediate namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class HtmlContentIntermediateNode : IntermediateNode public sealed class HtmlContentIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
if (visitor == null) if (visitor == null)

View File

@ -5,16 +5,41 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public abstract class IntermediateNode public abstract class IntermediateNode
{ {
public abstract ItemCollection Annotations { get; } private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public abstract RazorDiagnosticCollection Diagnostics { get; }
public abstract IntermediateNodeCollection Children { get; } public abstract IntermediateNodeCollection Children { get; }
public abstract SourceSpan? Source { get; set; } public RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
public abstract bool HasDiagnostics { get; } return _diagnostics;
}
}
public bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public SourceSpan? Source { get; set; }
public abstract void Accept(IntermediateNodeVisitor visitor); public abstract void Accept(IntermediateNodeVisitor visitor);
} }
} }

View File

@ -7,35 +7,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class IntermediateToken : IntermediateNode public sealed class IntermediateToken : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public string Content { get; set; } public string Content { get; set; }
@ -46,10 +17,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public TokenKind Kind { get; set; } = TokenKind.Unknown; public TokenKind Kind { get; set; } = TokenKind.Unknown;
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
if (visitor == null) if (visitor == null)

View File

@ -8,29 +8,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class MalformedDirectiveIntermediateNode : IntermediateNode public sealed class MalformedDirectiveIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations { get; }
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string Name { get; set; } public string Name { get; set; }
public IEnumerable<DirectiveTokenIntermediateNode> Tokens => Children.OfType<DirectiveTokenIntermediateNode>(); public IEnumerable<DirectiveTokenIntermediateNode> Tokens => Children.OfType<DirectiveTokenIntermediateNode>();

View File

@ -8,41 +8,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class MethodDeclarationIntermediateNode : MemberDeclarationIntermediateNode public sealed class MethodDeclarationIntermediateNode : MemberDeclarationIntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public IList<string> Modifiers { get; } = new List<string>(); public IList<string> Modifiers { get; } = new List<string>();
public string Name { get; set; } public string Name { get; set; }

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class NamespaceDeclarationIntermediateNode : IntermediateNode public sealed class NamespaceDeclarationIntermediateNode : IntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string Content { get; set; } public string Content { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)

View File

@ -8,40 +8,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class PropertyDeclarationIntermediateNode : MemberDeclarationIntermediateNode public sealed class PropertyDeclarationIntermediateNode : MemberDeclarationIntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public IList<string> Modifiers { get; } = new List<string>(); public IList<string> Modifiers { get; } = new List<string>();

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class TagHelperBodyIntermediateNode : IntermediateNode public sealed class TagHelperBodyIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
if (visitor == null) if (visitor == null)

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class TagHelperHtmlAttributeIntermediateNode : IntermediateNode public sealed class TagHelperHtmlAttributeIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string AttributeName { get; set; } public string AttributeName { get; set; }
public AttributeStructure AttributeStructure { get; set; } public AttributeStructure AttributeStructure { get; set; }

View File

@ -9,41 +9,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class TagHelperIntermediateNode : IntermediateNode public sealed class TagHelperIntermediateNode : IntermediateNode
{ {
private ItemCollection _annotations;
private RazorDiagnosticCollection _diagnostics;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string TagName { get; set; } public string TagName { get; set; }
public TagMode TagMode { get; set; } public TagMode TagMode { get; set; }

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class TagHelperPropertyIntermediateNode : IntermediateNode public sealed class TagHelperPropertyIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string AttributeName { get; set; } public string AttributeName { get; set; }
public AttributeStructure AttributeStructure { get; set; } public AttributeStructure AttributeStructure { get; set; }

View File

@ -7,41 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{ {
public sealed class UsingDirectiveIntermediateNode : IntermediateNode public sealed class UsingDirectiveIntermediateNode : IntermediateNode
{ {
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{
get
{
if (_diagnostics == null)
{
_diagnostics = new DefaultRazorDiagnosticCollection();
}
return _diagnostics;
}
}
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0;
public string Content { get; set; } public string Content { get; set; }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)

View File

@ -609,8 +609,6 @@ WriteAttributeValue("" "", 27, false, 28, 6, false);
{ {
public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance; public override IntermediateNodeCollection Children => ReadOnlyIntermediateNodeCollection.Instance;
public override SourceSpan? Source { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -206,16 +206,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
private class BasicIntermediateNode : IntermediateNode private class BasicIntermediateNode : IntermediateNode
{ {
public override ItemCollection Annotations { get; } = new DefaultItemCollection();
public override RazorDiagnosticCollection Diagnostics { get; } = new DefaultRazorDiagnosticCollection();
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => Diagnostics.Count > 0;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -497,16 +497,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public string Name { get; } public string Name { get; }
public override ItemCollection Annotations { get; } = new DefaultItemCollection();
public override RazorDiagnosticCollection Diagnostics => new DefaultRazorDiagnosticCollection();
public override IntermediateNodeCollection Children { get; } public override IntermediateNodeCollection Children { get; }
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => Diagnostics.Count > 0;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
throw new System.NotImplementedException(); throw new System.NotImplementedException();

View File

@ -124,16 +124,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public string Name { get; } public string Name { get; }
public override ItemCollection Annotations { get; } = new DefaultItemCollection();
public override RazorDiagnosticCollection Diagnostics { get; } = new DefaultRazorDiagnosticCollection();
public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection(); public override IntermediateNodeCollection Children { get; } = new DefaultIntermediateNodeCollection();
public override SourceSpan? Source { get; set; }
public override bool HasDiagnostics => Diagnostics.Count > 0;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
((DerivedIntermediateNodeWalker)visitor).VisitBasic(this); ((DerivedIntermediateNodeWalker)visitor).VisitBasic(this);