Lazily initialize annotations for intermediate nodes.

#1390
This commit is contained in:
N. Taylor Mullen 2017-06-26 11:47:09 -07:00
parent 5e57e9f235
commit 2d90ae47f9
13 changed files with 169 additions and 13 deletions

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class AddTagHelperHtmlAttributeIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class CSharpCodeAttributeValueIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class CSharpExpressionAttributeValueIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class CreateTagHelperIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -9,8 +9,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class DeclareTagHelperFieldsIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -6,8 +6,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class DirectiveTokenIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class HtmlAttributeIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -9,8 +9,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class HtmlAttributeValueIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -9,8 +9,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class HtmlContentIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class IntermediateToken : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class SetTagHelperPropertyIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class TagHelperBodyIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{

View File

@ -8,8 +8,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public sealed class UsingDirectiveIntermediateNode : IntermediateNode
{
private RazorDiagnosticCollection _diagnostics;
private ItemCollection _annotations;
public override ItemCollection Annotations => ReadOnlyItemCollection.Empty;
public override ItemCollection Annotations
{
get
{
if (_annotations == null)
{
_annotations = new DefaultItemCollection();
}
return _annotations;
}
}
public override RazorDiagnosticCollection Diagnostics
{