Add attribute splatting compiler support (dotnet/aspnetcore-tooling#640)

* Add TagHelperDescriptorProvider

* Remove bad life-choice

* Add some AddRange love

* Add splatting lowering and codegen

* PR feedback
\n\nCommit migrated from 9c8dd1cae7
This commit is contained in:
Ryan Nowak 2019-06-21 14:48:09 -07:00 committed by GitHub
parent fa65b30dce
commit ef4773a2d5
82 changed files with 2416 additions and 56 deletions

View File

@ -304,6 +304,11 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
Context.NodeWriter.WriteSetKey(Context, node);
}
public override void VisitSplat(SplatIntermediateNode node)
{
Context.NodeWriter.WriteSplat(Context, node);
}
public override void VisitDefault(IntermediateNode node)
{
Context.RenderChildren(node);

View File

@ -69,6 +69,11 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
throw new NotSupportedException("This writer does not support components.");
}
public virtual void WriteSplat(CodeRenderingContext context, SplatIntermediateNode node)
{
throw new NotSupportedException("This writer does not support components.");
}
public abstract void BeginWriterScope(CodeRenderingContext context, string writer);
public abstract void EndWriterScope(CodeRenderingContext context);

View File

@ -195,6 +195,9 @@
<data name="RefTagHelper_Documentation" xml:space="preserve">
<value>Populates the specified field or property with a reference to the element or component.</value>
</data>
<data name="SplatTagHelper_Documentation" xml:space="preserve">
<value>Merges a collection of attributes into the current element or component.</value>
</data>
<data name="TypeParamDirective_Description" xml:space="preserve">
<value>Declares a generic type parameter for the generated component class.</value>
</data>

View File

@ -317,14 +317,25 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// builder.SetKey(someValue);
// builder.AddElementCapture(3, (__value) => _field = __value);
// builder.CloseComponent();
foreach (var typeArgument in node.TypeArguments)
{
context.RenderNode(typeArgument);
}
foreach (var attribute in node.Attributes)
// We need to preserve order for attibutes and attribute splats since the ordering
// has a semantic effect.
foreach (var child in node.Children)
{
context.RenderNode(attribute);
if (child is ComponentAttributeIntermediateNode attribute)
{
context.RenderNode(attribute);
}
else if (child is SplatIntermediateNode splat)
{
context.RenderNode(splat);
}
}
if (node.ChildContents.Any())
@ -365,7 +376,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// to that method. We pass in all of the attribute values + the sequence numbers.
//
// __Blazor.MyComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, ..., 2, ..., 3, ....);
var attributes = node.Attributes.ToList();
// Preserve order of attributes + splats
var attributes = node.Children.Where(s =>
{
return s is ComponentAttributeIntermediateNode || s is SplatIntermediateNode;
}).ToList();
var childContents = node.ChildContents.ToList();
var captures = node.Captures.ToList();
var setKeys = node.SetKeys.ToList();
@ -390,7 +406,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// Don't type check generics, since we can't actually write the type name.
// The type checking with happen anyway since we defined a method and we're generating
// a call to it.
WriteComponentAttributeInnards(context, attributes[i], canTypeCheck: false);
if (attributes[i] is ComponentAttributeIntermediateNode attribute)
{
WriteComponentAttributeInnards(context, attribute, canTypeCheck: false);
}
else if (attributes[i] is SplatIntermediateNode splat)
{
WriteSplatInnards(context, splat, canTypeCheck: false);
}
remaining--;
if (remaining > 0)
@ -630,13 +653,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
bool NeedsTypeCheck(ComponentAttributeIntermediateNode n)
{
return n.BoundAttribute != null && !n.BoundAttribute.IsWeaklyTyped();
}
}
}
IReadOnlyList<IntermediateToken> GetCSharpTokens(ComponentAttributeIntermediateNode attribute)
{
// We generally expect all children to be CSharp, this is here just in case.
return attribute.FindDescendantNodes<IntermediateToken>().Where(t => t.IsCSharp).ToArray();
}
private IReadOnlyList<IntermediateToken> GetCSharpTokens(IntermediateNode node)
{
// We generally expect all children to be CSharp, this is here just in case.
return node.FindDescendantNodes<IntermediateToken>().Where(t => t.IsCSharp).ToArray();
}
public override void WriteComponentChildContent(CodeRenderingContext context, ComponentChildContentIntermediateNode node)
@ -774,6 +797,54 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
});
}
public override void WriteSplat(CodeRenderingContext context, SplatIntermediateNode node)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (node == null)
{
throw new ArgumentNullException(nameof(node));
}
// Looks like:
//
// builder.AddMultipleAttributes(2, ...);
context.CodeWriter.WriteStartMethodInvocation($"{_scopeStack.BuilderVarName}.{ComponentsApi.RenderTreeBuilder.AddMultipleAttributes}");
context.CodeWriter.Write("-1");
context.CodeWriter.WriteParameterSeparator();
WriteSplatInnards(context, node, canTypeCheck: true);
context.CodeWriter.WriteEndMethodInvocation();
}
private void WriteSplatInnards(CodeRenderingContext context, SplatIntermediateNode node, bool canTypeCheck)
{
var tokens = GetCSharpTokens(node);
if (canTypeCheck)
{
context.CodeWriter.Write(ComponentsApi.RuntimeHelpers.TypeCheck);
context.CodeWriter.Write("<");
context.CodeWriter.Write(ComponentsApi.AddMultipleAttributesTypeFullName);
context.CodeWriter.Write(">");
context.CodeWriter.Write("(");
}
for (var i = 0; i < tokens.Count; i++)
{
WriteCSharpToken(context, tokens[i]);
}
if (canTypeCheck)
{
context.CodeWriter.Write(")");
}
}
public override void WriteReferenceCapture(CodeRenderingContext context, ReferenceCaptureIntermediateNode node)
{
if (context == null)

View File

@ -17,16 +17,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
public static readonly string ImportsFileName = "_Imports.razor";
public static bool IsComponentTagHelperKind(string tagHelperKind)
{
return tagHelperKind == Component.TagHelperKind ||
tagHelperKind == ChildContent.TagHelperKind ||
tagHelperKind == EventHandler.TagHelperKind ||
tagHelperKind == Bind.TagHelperKind ||
tagHelperKind == Key.TagHelperKind ||
tagHelperKind == Ref.TagHelperKind;
}
public static string MangleClassName(string className)
{
if (string.IsNullOrEmpty(className))
@ -131,6 +121,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
public static readonly string RuntimeName = "Components.None";
}
public static class Splat
{
public readonly static string TagHelperKind = "Components.Splat";
public static readonly string RuntimeName = "Components.None";
}
public static class Ref
{
public readonly static string TagHelperKind = "Components.Ref";

View File

@ -130,19 +130,33 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
context.CodeWriter.WriteLine();
var index = 0;
foreach (var attribute in node.Component.Attributes)
// Preserve order of attributes and splat.
foreach (var child in node.Component.Children)
{
context.CodeWriter.WriteStartInstanceMethodInvocation("builder", ComponentsApi.RenderTreeBuilder.AddAttribute);
context.CodeWriter.Write(parameters[index].seqName);
context.CodeWriter.Write(", ");
if (child is ComponentAttributeIntermediateNode attribute)
{
context.CodeWriter.WriteStartInstanceMethodInvocation("builder", ComponentsApi.RenderTreeBuilder.AddAttribute);
context.CodeWriter.Write(parameters[index].seqName);
context.CodeWriter.Write(", ");
context.CodeWriter.Write($"\"{attribute.AttributeName}\"");
context.CodeWriter.Write(", ");
context.CodeWriter.Write($"\"{attribute.AttributeName}\"");
context.CodeWriter.Write(", ");
context.CodeWriter.Write(parameters[index].parameterName);
context.CodeWriter.WriteEndMethodInvocation();
context.CodeWriter.Write(parameters[index].parameterName);
context.CodeWriter.WriteEndMethodInvocation();
index++;
}
else if (child is SplatIntermediateNode)
{
context.CodeWriter.WriteStartInstanceMethodInvocation("builder", ComponentsApi.RenderTreeBuilder.AddMultipleAttributes);
context.CodeWriter.Write(parameters[index].seqName);
context.CodeWriter.Write(", ");
index++;
context.CodeWriter.Write(parameters[index].parameterName);
context.CodeWriter.WriteEndMethodInvocation();
index++;
}
}
foreach (var childContent in node.Component.ChildContents)
@ -189,14 +203,24 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
List<(string seqName, string typeName, string parameterName)> GetParameterDeclarations()
{
var p = new List<(string seqName, string typeName, string parameterName)>();
foreach (var attribute in node.Component.Attributes)
// Preserve order between attributes and splats
foreach (var child in node.Component.Children)
{
var typeName = attribute.TypeName;
if (attribute.BoundAttribute != null && !attribute.BoundAttribute.IsGenericTypedProperty())
if (child is ComponentAttributeIntermediateNode attribute)
{
typeName = "global::" + typeName;
var typeName = attribute.TypeName;
if (attribute.BoundAttribute != null && !attribute.BoundAttribute.IsGenericTypedProperty())
{
typeName = "global::" + typeName;
}
p.Add(($"__seq{p.Count}", typeName, $"__arg{p.Count}"));
}
else if (child is SplatIntermediateNode splat)
{
var typeName = ComponentsApi.AddMultipleAttributesTypeFullName;
p.Add(($"__seq{p.Count}", typeName, $"__arg{p.Count}"));
}
p.Add(($"__seq{p.Count}", typeName, $"__arg{p.Count}"));
}
foreach (var childContent in node.Component.ChildContents)

View File

@ -184,10 +184,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
.WriteStringLiteral(node.TagName)
.WriteEndMethodInvocation();
// Render Attributes before creating the scope.
foreach (var attribute in node.Attributes)
// Render attributes and splats (in order) before creating the scope.
foreach (var child in node.Children)
{
context.RenderNode(attribute);
if (child is HtmlAttributeIntermediateNode attribute)
{
context.RenderNode(attribute);
}
else if (child is SplatIntermediateNode splat)
{
context.RenderNode(splat);
}
}
foreach (var setKey in node.SetKeys)
@ -348,9 +355,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// We can skip type arguments during runtime codegen, they are handled in the
// type/parameter declarations.
foreach (var attribute in node.Attributes)
// Preserve order of attributes and splats
foreach (var child in node.Children)
{
context.RenderNode(attribute);
if (child is ComponentAttributeIntermediateNode attribute)
{
context.RenderNode(attribute);
}
else if (child is SplatIntermediateNode splat)
{
context.RenderNode(splat);
}
}
foreach (var childContent in node.ChildContents)
@ -382,7 +397,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// to that method. We pass in all of the attribute values + the sequence numbers.
//
// __Blazor.MyComponent.TypeInference.CreateMyComponent_0(builder, 0, 1, ..., 2, ..., 3, ...);
var attributes = node.Attributes.ToList();
// Preserve order of attributes and splats
var attributes = node.Children.Where(n =>
{
return n is ComponentAttributeIntermediateNode || n is SplatIntermediateNode;
}).ToList();
var childContents = node.ChildContents.ToList();
var captures = node.Captures.ToList();
var setKeys = node.SetKeys.ToList();
@ -407,7 +427,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// Don't type check generics, since we can't actually write the type name.
// The type checking with happen anyway since we defined a method and we're generating
// a call to it.
WriteComponentAttributeInnards(context, attributes[i], canTypeCheck: false);
if (attributes[i] is ComponentAttributeIntermediateNode attribute)
{
WriteComponentAttributeInnards(context, attribute, canTypeCheck: false);
}
else if (attributes[i] is SplatIntermediateNode splat)
{
WriteSplatInnards(context, splat, canTypeCheck: false);
}
remaining--;
if (remaining > 0)
@ -429,7 +456,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
context.CodeWriter.Write(", ");
}
}
for (var i = 0; i < setKeys.Count; i++)
{
context.CodeWriter.Write((_sourceSequence++).ToString());
@ -597,12 +624,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
}
}
IReadOnlyList<IntermediateToken> GetCSharpTokens(ComponentAttributeIntermediateNode attribute)
{
// We generally expect all children to be CSharp, this is here just in case.
return attribute.FindDescendantNodes<IntermediateToken>().Where(t => t.IsCSharp).ToArray();
}
IReadOnlyList<IntermediateToken> GetHtmlTokens(HtmlContentIntermediateNode html)
{
// We generally expect all children to be HTML, this is here just in case.
@ -615,6 +636,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
}
}
private IReadOnlyList<IntermediateToken> GetCSharpTokens(IntermediateNode node)
{
// We generally expect all children to be CSharp, this is here just in case.
return node.FindDescendantNodes<IntermediateToken>().Where(t => t.IsCSharp).ToArray();
}
public override void WriteComponentChildContent(CodeRenderingContext context, ComponentChildContentIntermediateNode node)
{
if (context == null)
@ -711,6 +738,54 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
});
}
public override void WriteSplat(CodeRenderingContext context, SplatIntermediateNode node)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (node == null)
{
throw new ArgumentNullException(nameof(node));
}
// Looks like:
//
// builder.AddMultipleAttributes(2, ...);
context.CodeWriter.WriteStartMethodInvocation($"{_scopeStack.BuilderVarName}.{ComponentsApi.RenderTreeBuilder.AddMultipleAttributes}");
context.CodeWriter.Write((_sourceSequence++).ToString());
context.CodeWriter.WriteParameterSeparator();
WriteSplatInnards(context, node, canTypeCheck: true);
context.CodeWriter.WriteEndMethodInvocation();
}
private void WriteSplatInnards(CodeRenderingContext context, SplatIntermediateNode node, bool canTypeCheck)
{
var tokens = GetCSharpTokens(node);
if (canTypeCheck)
{
context.CodeWriter.Write(ComponentsApi.RuntimeHelpers.TypeCheck);
context.CodeWriter.Write("<");
context.CodeWriter.Write(ComponentsApi.AddMultipleAttributesTypeFullName);
context.CodeWriter.Write(">");
context.CodeWriter.Write("(");
}
for (var i = 0; i < tokens.Count; i++)
{
WriteCSharpToken(context, tokens[i]);
}
if (canTypeCheck)
{
context.CodeWriter.Write(")");
}
}
public override void WriteReferenceCapture(CodeRenderingContext context, ReferenceCaptureIntermediateNode node)
{
// Looks like:
@ -759,7 +834,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
});
}
}
private void WriteAttribute(CodeRenderingContext context, string key, IList<IntermediateToken> value)
{
BeginWriteAttribute(context.CodeWriter, key);

View File

@ -0,0 +1,52 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
namespace Microsoft.AspNetCore.Razor.Language.Components
{
internal class ComponentSplatLoweringPass : ComponentIntermediateNodePassBase, IRazorOptimizationPass
{
// Run after component lowering pass
public override int Order => 50;
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode)
{
if (!IsComponentDocument(documentNode))
{
return;
}
var references = documentNode.FindDescendantReferences<TagHelperDirectiveAttributeIntermediateNode>();
var parents = new HashSet<IntermediateNode>();
for (var i = 0; i < references.Count; i++)
{
parents.Add(references[i].Parent);
}
for (var i = 0; i < references.Count; i++)
{
var reference = references[i];
var node = (TagHelperDirectiveAttributeIntermediateNode)reference.Node;
if (node.TagHelper.IsSplatTagHelper())
{
reference.Replace(RewriteUsage(reference.Parent, node));
}
}
}
private IntermediateNode RewriteUsage(IntermediateNode parent, TagHelperDirectiveAttributeIntermediateNode node)
{
var result = new SplatIntermediateNode()
{
Source = node.Source,
};
result.Children.AddRange(node.FindDescendantNodes<IntermediateToken>().Where(t => t.IsCSharp));
result.Diagnostics.AddRange(node.Diagnostics);
return result;
}
}
}

View File

@ -9,6 +9,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
{
public static readonly string AssemblyName = "Microsoft.AspNetCore.Components";
public static readonly string AddMultipleAttributesTypeFullName = "global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>";
public static class ComponentBase
{
public static readonly string Namespace = "Microsoft.AspNetCore.Components";
@ -78,6 +80,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
public static readonly string AddAttribute = nameof(AddAttribute);
public static readonly string AddMultipleAttributes = nameof(AddMultipleAttributes);
public static readonly string AddElementReferenceCapture = nameof(AddElementReferenceCapture);
public static readonly string AddComponentReferenceCapture = nameof(AddComponentReferenceCapture);

View File

@ -9,6 +9,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
{
internal static class TagHelperDescriptorExtensions
{
public static bool IsAnyComponentDocumentTagHelper(this TagHelperDescriptor tagHelper)
{
if (tagHelper == null)
{
throw new ArgumentNullException(nameof(tagHelper));
}
return tagHelper.IsComponentTagHelper() || tagHelper.Metadata.ContainsKey(ComponentMetadata.SpecialKindKey);
}
public static bool IsBindTagHelper(this TagHelperDescriptor tagHelper)
{
if (tagHelper == null)
@ -153,6 +163,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
string.Equals(ComponentMetadata.Key.TagHelperKind, kind);
}
public static bool IsSplatTagHelper(this TagHelperDescriptor tagHelper)
{
if (tagHelper == null)
{
throw new ArgumentNullException(nameof(tagHelper));
}
return
tagHelper.Metadata.TryGetValue(ComponentMetadata.SpecialKindKey, out var kind) &&
string.Equals(ComponentMetadata.Splat.TagHelperKind, kind);
}
public static bool IsRefTagHelper(this TagHelperDescriptor tagHelper)
{
if (tagHelper == null)

View File

@ -121,7 +121,7 @@ namespace Microsoft.AspNetCore.Razor.Language
public TagHelperDirectiveVisitor(IReadOnlyList<TagHelperDescriptor> tagHelpers)
{
// We don't want to consider components in a view document.
_tagHelpers = tagHelpers.Where(t => !ComponentMetadata.IsComponentTagHelperKind(t.Kind)).ToList();
_tagHelpers = tagHelpers.Where(t => !t.IsAnyComponentDocumentTagHelper()).ToList();
}
public override string TagHelperPrefix => _tagHelperPrefix;
@ -232,7 +232,7 @@ namespace Microsoft.AspNetCore.Razor.Language
_filePath = filePath;
// We don't want to consider non-component tag helpers in a component document.
_tagHelpers = tagHelpers.Where(t => ComponentMetadata.IsComponentTagHelperKind(t.Kind) && !IsTagHelperFromMangledClass(t)).ToList();
_tagHelpers = tagHelpers.Where(t => t.IsAnyComponentDocumentTagHelper() && !IsTagHelperFromMangledClass(t)).ToList();
for (var i = 0; i < _tagHelpers.Count; i++)
{

View File

@ -4,9 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Razor.Language.CodeGeneration;
using Microsoft.AspNetCore.Razor.Language.Components;
namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{
@ -18,6 +15,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public IEnumerable<SetKeyIntermediateNode> SetKeys => Children.OfType<SetKeyIntermediateNode>();
public IEnumerable<SplatIntermediateNode> Splats => Children.OfType<SplatIntermediateNode>();
public IEnumerable<ComponentChildContentIntermediateNode> ChildContents => Children.OfType<ComponentChildContentIntermediateNode>();
public override IntermediateNodeCollection Children { get; } = new IntermediateNodeCollection();

View File

@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Razor.Language.CodeGeneration;
using Microsoft.AspNetCore.Razor.Language.Components;
namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{

View File

@ -59,6 +59,33 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
_inner.Add(item);
}
public void AddRange(IEnumerable<IntermediateNode> items)
{
if (items == null)
{
throw new ArgumentNullException(nameof(items));
}
foreach (var item in items)
{
_inner.Add(item);
}
}
public void AddRange(IntermediateNodeCollection items)
{
if (items == null)
{
throw new ArgumentNullException(nameof(items));
}
var count = items.Count;
for (var i = 0; i < count; i++)
{
_inner.Add(items[i]);
}
}
public void Clear()
{
_inner.Clear();

View File

@ -183,5 +183,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{
VisitDefault(node);
}
public virtual void VisitSplat(SplatIntermediateNode node)
{
VisitDefault(node);
}
}
}

View File

@ -20,6 +20,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{
return
c as HtmlAttributeIntermediateNode == null &&
c as SplatIntermediateNode == null &&
c as SetKeyIntermediateNode == null &&
c as ReferenceCaptureIntermediateNode == null;
});

View File

@ -0,0 +1,32 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Razor.Language.Intermediate
{
public sealed class SplatIntermediateNode : IntermediateNode
{
public override IntermediateNodeCollection Children { get; } = new IntermediateNodeCollection();
public override void Accept(IntermediateNodeVisitor visitor)
{
if (visitor == null)
{
throw new ArgumentNullException(nameof(visitor));
}
visitor.VisitSplat(this);
}
public override void FormatNode(IntermediateNodeFormatter formatter)
{
if (formatter == null)
{
throw new ArgumentNullException(nameof(formatter));
}
// No properties => do nothing
}
}
}

View File

@ -52,6 +52,16 @@ namespace Microsoft.AspNetCore.Razor.Language
_inner.Add(item);
}
public void AddRange(RazorDiagnosticCollection items)
{
if (items == null)
{
throw new ArgumentNullException(nameof(items));
}
_inner.AddRange(items);
}
public void Clear()
{
_inner.Clear();

View File

@ -231,6 +231,7 @@ namespace Microsoft.AspNetCore.Razor.Language
builder.Features.Add(new ComponentEventHandlerLoweringPass());
builder.Features.Add(new ComponentKeyLoweringPass());
builder.Features.Add(new ComponentReferenceCaptureLoweringPass());
builder.Features.Add(new ComponentSplatLoweringPass());
builder.Features.Add(new ComponentBindLoweringPass());
builder.Features.Add(new ComponentTemplateDiagnosticPass());
builder.Features.Add(new ComponentGenericTypePass());

View File

@ -3200,6 +3200,185 @@ namespace Test
#endregion
#region Splat
[Fact]
public void Element_WithSplat()
{
// Arrange/Act
var generated = CompileToCSharp(@"
<elem attributebefore=""before"" @attributes=""someAttributes"" attributeafter=""after"">Hello</elem>
@code {
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
[Fact]
public void Element_WithSplat_ImplicitExpression()
{
// Arrange/Act
var generated = CompileToCSharp(@"
<elem attributebefore=""before"" @attributes=""@someAttributes"" attributeafter=""after"">Hello</elem>
@code {
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
[Fact]
public void Element_WithSplat_ExplicitExpression()
{
// Arrange/Act
var generated = CompileToCSharp(@"
<elem attributebefore=""before"" @attributes=""@(someAttributes)"" attributeafter=""after"">Hello</elem>
@code {
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
[Fact]
public void Component_WithSplat()
{
// Arrange
AdditionalSyntaxTrees.Add(Parse(@"
using Microsoft.AspNetCore.Components;
namespace Test
{
public class MyComponent : ComponentBase
{
}
}
"));
// Arrange/Act
var generated = CompileToCSharp(@"
<MyComponent AttributeBefore=""before"" @attributes=""someAttributes"" AttributeAfter=""after"" />
@code {
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
[Fact]
public void Component_WithSplat_ImplicitExpression()
{
// Arrange
AdditionalSyntaxTrees.Add(Parse(@"
using Microsoft.AspNetCore.Components;
namespace Test
{
public class MyComponent : ComponentBase
{
}
}
"));
// Arrange/Act
var generated = CompileToCSharp(@"
<MyComponent AttributeBefore=""before"" @attributes=""@someAttributes"" AttributeAfter=""after"" />
@code {
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
[Fact]
public void Component_WithSplat_ExplicitExpression()
{
// Arrange
AdditionalSyntaxTrees.Add(Parse(@"
using Microsoft.AspNetCore.Components;
namespace Test
{
public class MyComponent : ComponentBase
{
}
}
"));
// Arrange/Act
var generated = CompileToCSharp(@"
<MyComponent AttributeBefore=""before"" @attributes=""@(someAttributes)"" AttributeAfter=""after"" />
@code {
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
[Fact]
public void Component_WithSplat_GenericTypeInference()
{
// Arrange
AdditionalSyntaxTrees.Add(Parse(@"
using Microsoft.AspNetCore.Components;
namespace Test
{
public class MyComponent<T> : ComponentBase
{
[Parameter] T Value { get; set;}
}
}
"));
// Arrange/Act
var generated = CompileToCSharp(@"
<MyComponent Value=""18"" @attributes=""@(someAttributes)"" />
@code {
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
}
");
// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}
#endregion
#region Ref
[Fact]

View File

@ -62,6 +62,7 @@ namespace Microsoft.AspNetCore.Razor.Language
feature => Assert.IsType<ComponentPageDirectivePass>(feature),
feature => Assert.IsType<ComponentReferenceCaptureLoweringPass>(feature),
feature => Assert.IsType<ComponentScriptTagPass>(feature),
feature => Assert.IsType<ComponentSplatLoweringPass>(feature),
feature => Assert.IsType<ComponentTemplateDiagnosticPass>(feature),
feature => Assert.IsType<ComponentWhitespacePass>(feature),
feature => Assert.IsType<DefaultDirectiveSyntaxTreePass>(feature),

View File

@ -0,0 +1,56 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__o = "";
builder.AddMultipleAttributes(-1, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
__o = "";
builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => {
}
));
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = typeof(MyComponent);
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,31 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [92] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - - AttributeBefore - AttributeStructure.DoubleQuotes
HtmlContent - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (51:0,51 [14] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (51:0,51 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
ComponentAttribute - - AttributeAfter - AttributeStructure.DoubleQuotes
HtmlContent - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (92:0,92 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (92:0,92 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (197:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (197:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (103:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (103:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,14 @@
Source Location: (51:0,51 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (1135:26,51 [14] )
|someAttributes|
Source Location: (103:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1666:47,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,56 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__o = "";
builder.AddMultipleAttributes(-1, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
__o = "";
builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => {
}
));
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = typeof(MyComponent);
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,31 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [95] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - - AttributeBefore - AttributeStructure.DoubleQuotes
HtmlContent - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (51:0,51 [17] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (53:0,53 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
ComponentAttribute - - AttributeAfter - AttributeStructure.DoubleQuotes
HtmlContent - (86:0,86 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (86:0,86 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (95:0,95 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (95:0,95 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (200:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (200:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,14 @@
Source Location: (53:0,53 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (1137:26,53 [14] )
|someAttributes|
Source Location: (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1668:47,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,73 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, -1, -1,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
18
#line default
#line hidden
#nullable disable
, -1,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
);
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = typeof(MyComponent<>);
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
namespace __Blazor.Test.TestComponent
{
#line hidden
internal static class TypeInference
{
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder, int seq, int __seq0, T __arg0, int __seq1, global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>> __arg1)
{
builder.OpenComponent<global::Test.MyComponent<T>>(seq);
builder.AddAttribute(__seq0, "Value", __arg0);
builder.AddMultipleAttributes(__seq1, __arg1);
builder.CloseComponent();
}
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,30 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [58] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
IntermediateToken - (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 18
Splat - (37:0,37 [17] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (39:0,39 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlContent - (58:0,58 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (58:0,58 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (163:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (163:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (69:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (69:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n
NamespaceDeclaration - - __Blazor.Test.TestComponent
ClassDeclaration - - internal static - TypeInference - -
ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0

View File

@ -0,0 +1,19 @@
Source Location: (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|18|
Generated Location: (956:25,20 [2] )
|18|
Source Location: (39:0,39 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (1139:33,39 [14] )
|someAttributes|
Source Location: (69:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1497:50,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,56 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__o = "";
builder.AddMultipleAttributes(-1, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
__o = "";
builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => {
}
));
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = typeof(MyComponent);
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,31 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [93] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - - AttributeBefore - AttributeStructure.DoubleQuotes
HtmlContent - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (51:0,51 [15] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (52:0,52 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
ComponentAttribute - - AttributeAfter - AttributeStructure.DoubleQuotes
HtmlContent - (84:0,84 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (84:0,84 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (93:0,93 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (93:0,93 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (198:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (198:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (104:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (104:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,14 @@
Source Location: (52:0,52 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (1136:26,52 [14] )
|someAttributes|
Source Location: (104:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1667:47,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,44 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.AddMultipleAttributes(-1, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,33 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [95] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (44:0,44 [14] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (44:0,44 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (76:0,76 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (76:0,76 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (95:0,95 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (95:0,95 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (200:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (200:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,14 @@
Source Location: (44:0,44 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (1105:25,44 [14] )
|someAttributes|
Source Location: (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1314:35,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,53 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__o =
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
;
__o =
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
"after"
#line default
#line hidden
#nullable disable
;
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,34 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [103] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (91:0,91 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (91:0,91 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
HtmlAttribute - (44:0,44 [17] x:\dir\subdir\Test\TestComponent.cshtml) - -
CSharpExpressionAttributeValue - -
IntermediateToken - (46:0,46 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
CSharpExpressionAttributeValue - (79:0,79 [10] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (81:0,81 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "after"
HtmlContent - (103:0,103 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (103:0,103 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (208:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (208:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (114:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (114:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, string> someAttributes = new Dictionary<string, string>();\n

View File

@ -0,0 +1,19 @@
Source Location: (46:0,46 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (909:25,46 [14] )
|someAttributes|
Source Location: (81:0,81 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|"after"|
Generated Location: (1161:34,81 [7] )
|"after"|
Source Location: (114:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
|
Generated Location: (1361:44,7 [93] )
|
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
|

View File

@ -0,0 +1,53 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__o =
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
;
__o =
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
"after"
#line default
#line hidden
#nullable disable
;
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,34 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [101] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (89:0,89 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (89:0,89 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
HtmlAttribute - (44:0,44 [15] x:\dir\subdir\Test\TestComponent.cshtml) - -
CSharpExpressionAttributeValue - -
IntermediateToken - (45:0,45 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
CSharpExpressionAttributeValue - (77:0,77 [10] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (79:0,79 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "after"
HtmlContent - (101:0,101 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (101:0,101 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (206:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (206:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, string> someAttributes = new Dictionary<string, string>();\n

View File

@ -0,0 +1,19 @@
Source Location: (45:0,45 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (908:25,45 [14] )
|someAttributes|
Source Location: (79:0,79 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|"after"|
Generated Location: (1158:34,79 [7] )
|"after"|
Source Location: (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
|
Generated Location: (1358:44,7 [93] )
|
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
|

View File

@ -0,0 +1,44 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.AddMultipleAttributes(-1, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,33 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [98] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (86:0,86 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (86:0,86 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (44:0,44 [17] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (46:0,46 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (79:0,79 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (79:0,79 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (98:0,98 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (98:0,98 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (203:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (203:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (109:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (109:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,14 @@
Source Location: (46:0,46 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (1107:25,46 [14] )
|someAttributes|
Source Location: (109:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1316:35,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,44 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.AddMultipleAttributes(-1, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,33 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [12] ) - System
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
UsingDirective - (53:3,1 [17] ) - System.Linq
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
DesignTimeDirective -
CSharpCode -
IntermediateToken - - CSharp - #pragma warning disable 0414
CSharpCode -
IntermediateToken - - CSharp - private static System.Object __o = null;
CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (84:0,84 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (84:0,84 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (44:0,44 [15] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (45:0,45 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (77:0,77 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (77:0,77 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
HtmlContent - (96:0,96 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (96:0,96 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
HtmlContent - (201:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (201:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (107:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (107:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,14 @@
Source Location: (45:0,45 [14] x:\dir\subdir\Test\TestComponent.cshtml)
|someAttributes|
Generated Location: (1106:25,45 [14] )
|someAttributes|
Source Location: (107:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1315:35,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,41 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "AttributeBefore", "before");
builder.AddMultipleAttributes(2, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
builder.AddAttribute(3, "AttributeAfter", "after");
builder.CloseComponent();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,20 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [92] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - - AttributeBefore - AttributeStructure.DoubleQuotes
HtmlContent - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (51:0,51 [14] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (51:0,51 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
ComponentAttribute - - AttributeAfter - AttributeStructure.DoubleQuotes
HtmlContent - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
CSharpCode - (103:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (103:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,9 @@
Source Location: (103:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1280:32,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,41 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "AttributeBefore", "before");
builder.AddMultipleAttributes(2, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
builder.AddAttribute(3, "AttributeAfter", "after");
builder.CloseComponent();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,20 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [95] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - - AttributeBefore - AttributeStructure.DoubleQuotes
HtmlContent - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (51:0,51 [17] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (53:0,53 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
ComponentAttribute - - AttributeAfter - AttributeStructure.DoubleQuotes
HtmlContent - (86:0,86 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (86:0,86 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
CSharpCode - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,9 @@
Source Location: (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1282:32,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,59 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
18
#line default
#line hidden
#nullable disable
, 2,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
);
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
namespace __Blazor.Test.TestComponent
{
#line hidden
internal static class TypeInference
{
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder, int seq, int __seq0, T __arg0, int __seq1, global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>> __arg1)
{
builder.OpenComponent<global::Test.MyComponent<T>>(seq);
builder.AddAttribute(__seq0, "Value", __arg0);
builder.AddMultipleAttributes(__seq1, __arg1);
builder.CloseComponent();
}
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,19 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [58] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
IntermediateToken - (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 18
Splat - (37:0,37 [17] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (39:0,39 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
CSharpCode - (69:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (69:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n
NamespaceDeclaration - - __Blazor.Test.TestComponent
ClassDeclaration - - internal static - TypeInference - -
ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0

View File

@ -0,0 +1,9 @@
Source Location: (69:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1076:36,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,59 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, 0, 1,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
18
#line default
#line hidden
#nullable disable
, 2,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
);
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private IReadOnlyDictionary<string, string> someAttributes = new Dictionary<string, string>();
#line default
#line hidden
#nullable disable
}
}
namespace __Blazor.Test.TestComponent
{
#line hidden
internal static class TypeInference
{
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder, int seq, int __seq0, T __arg0, int __seq1, System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>> __arg1)
{
builder.OpenComponent<global::Test.MyComponent<T>>(seq);
builder.AddAttribute(__seq0, "Value", __arg0);
builder.AddMultipleAttributes(__seq1, __arg1);
builder.CloseComponent();
}
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,20 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [58] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
IntermediateToken - (20:0,20 [2] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 18
ComponentAttribute - (37:0,37 [17] x:\dir\subdir\Test\TestComponent.cshtml) - - AttributeStructure.DoubleQuotes
CSharpExpression - (38:0,38 [16] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (39:0,39 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
CSharpCode - (69:2,7 [102] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (69:2,7 [102] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private IReadOnlyDictionary<string, string> someAttributes = new Dictionary<string, string>();\n
NamespaceDeclaration - - __Blazor.Test.TestComponent
ClassDeclaration - - internal static - TypeInference - -
ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0

View File

@ -0,0 +1,9 @@
Source Location: (69:2,7 [102] x:\dir\subdir\Test\TestComponent.cshtml)
|
private IReadOnlyDictionary<string, string> someAttributes = new Dictionary<string, string>();
|
Generated Location: (1076:36,7 [102] )
|
private IReadOnlyDictionary<string, string> someAttributes = new Dictionary<string, string>();
|

View File

@ -0,0 +1,41 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenComponent<Test.MyComponent>(0);
builder.AddAttribute(1, "AttributeBefore", "before");
builder.AddMultipleAttributes(2, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
builder.AddAttribute(3, "AttributeAfter", "after");
builder.CloseComponent();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,20 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [93] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - - AttributeBefore - AttributeStructure.DoubleQuotes
HtmlContent - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (30:0,30 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (51:0,51 [15] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (52:0,52 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
ComponentAttribute - - AttributeAfter - AttributeStructure.DoubleQuotes
HtmlContent - (84:0,84 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (84:0,84 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
CSharpCode - (104:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (104:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,9 @@
Source Location: (104:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1281:32,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,42 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenElement(0, "elem");
builder.AddAttribute(1, "attributebefore", "before");
builder.AddMultipleAttributes(2, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
builder.AddAttribute(3, "attributeafter", "after");
builder.AddContent(4, "Hello");
builder.CloseElement();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,22 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [95] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (83:0,83 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (44:0,44 [14] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (44:0,44 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (76:0,76 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (76:0,76 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
CSharpCode - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,9 @@
Source Location: (106:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1304:33,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,50 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenElement(0, "elem");
builder.AddAttribute(1, "attributebefore", "before");
builder.AddMultipleAttributes(2,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
);
builder.AddAttribute(3, "attributeafter",
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
"after"
#line default
#line hidden
#nullable disable
);
builder.AddContent(4, "Hello");
builder.CloseElement();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,23 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [103] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (91:0,91 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (91:0,91 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
HtmlAttribute - (44:0,44 [17] x:\dir\subdir\Test\TestComponent.cshtml) - -
CSharpExpressionAttributeValue - -
IntermediateToken - (46:0,46 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
CSharpExpressionAttributeValue - (79:0,79 [10] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (81:0,81 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "after"
CSharpCode - (114:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (114:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, string> someAttributes = new Dictionary<string, string>();\n

View File

@ -0,0 +1,9 @@
Source Location: (114:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
|
Generated Location: (1352:41,7 [93] )
|
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
|

View File

@ -0,0 +1,50 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenElement(0, "elem");
builder.AddAttribute(1, "attributebefore", "before");
builder.AddMultipleAttributes(2,
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
);
builder.AddAttribute(3, "attributeafter",
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
"after"
#line default
#line hidden
#nullable disable
);
builder.AddContent(4, "Hello");
builder.CloseElement();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,23 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [101] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (89:0,89 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (89:0,89 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
HtmlAttribute - (44:0,44 [15] x:\dir\subdir\Test\TestComponent.cshtml) - -
CSharpExpressionAttributeValue - -
IntermediateToken - (45:0,45 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
CSharpExpressionAttributeValue - (77:0,77 [10] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (79:0,79 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "after"
CSharpCode - (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, string> someAttributes = new Dictionary<string, string>();\n

View File

@ -0,0 +1,9 @@
Source Location: (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
|
Generated Location: (1349:41,7 [93] )
|
private Dictionary<string, string> someAttributes = new Dictionary<string, string>();
|

View File

@ -0,0 +1,42 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenElement(0, "elem");
builder.AddAttribute(1, "attributebefore", "before");
builder.AddMultipleAttributes(2, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
builder.AddAttribute(3, "attributeafter", "after");
builder.AddContent(4, "Hello");
builder.CloseElement();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,22 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [98] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (86:0,86 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (86:0,86 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (44:0,44 [17] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (46:0,46 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (79:0,79 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (79:0,79 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
CSharpCode - (109:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (109:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,9 @@
Source Location: (109:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1306:33,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -0,0 +1,42 @@
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
builder.OpenElement(0, "elem");
builder.AddAttribute(1, "attributebefore", "before");
builder.AddMultipleAttributes(2, Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<string, object>>>(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
someAttributes
#line default
#line hidden
#nullable disable
));
builder.AddAttribute(3, "attributeafter", "after");
builder.AddContent(4, "Hello");
builder.CloseElement();
}
#pragma warning restore 1998
#nullable restore
#line 3 "x:\dir\subdir\Test\TestComponent.cshtml"
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,22 @@
Document -
NamespaceDeclaration - - Test
UsingDirective - (3:1,1 [14] ) - System
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
UsingDirective - (53:3,1 [19] ) - System.Linq
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase -
MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - elem
HtmlContent - (84:0,84 [5] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (84:0,84 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello
HtmlAttribute - - attributebefore=" - "
HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before
Splat - (44:0,44 [15] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (45:0,45 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes
HtmlAttribute - - attributeafter=" - "
HtmlAttributeValue - (77:0,77 [5] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (77:0,77 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - after
CSharpCode - (107:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (107:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary<string, object> someAttributes = new Dictionary<string, object>();\n

View File

@ -0,0 +1,9 @@
Source Location: (107:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml)
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|
Generated Location: (1305:33,7 [93] )
|
private Dictionary<string, object> someAttributes = new Dictionary<string, object>();
|

View File

@ -29,6 +29,7 @@ namespace Microsoft.CodeAnalysis.Razor
builder.Features.Add(new EventHandlerTagHelperDescriptorProvider());
builder.Features.Add(new RefTagHelperDescriptorProvider());
builder.Features.Add(new KeyTagHelperDescriptorProvider());
builder.Features.Add(new SplatTagHelperDescriptorProvider());
builder.Features.Add(new DefaultTypeNameFeature());
}

View File

@ -0,0 +1,79 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Components;
namespace Microsoft.CodeAnalysis.Razor
{
internal class SplatTagHelperDescriptorProvider : ITagHelperDescriptorProvider
{
// Order doesn't matter
public int Order { get; set; }
public RazorEngine Engine { get; set; }
public void Execute(TagHelperDescriptorProviderContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
var compilation = context.GetCompilation();
if (compilation == null)
{
return;
}
var renderTreeBuilder = compilation.GetTypeByMetadataName(ComponentsApi.RenderTreeBuilder.FullTypeName);
if (renderTreeBuilder == null)
{
// If we can't find RenderTreeBuilder, then just bail. We won't be able to compile the
// generated code anyway.
return;
}
context.Results.Add(CreateSplatTagHelper());
}
private TagHelperDescriptor CreateSplatTagHelper()
{
var builder = TagHelperDescriptorBuilder.Create(ComponentMetadata.Splat.TagHelperKind, "Attributes", ComponentsApi.AssemblyName);
builder.Documentation = ComponentResources.SplatTagHelper_Documentation;
builder.Metadata.Add(ComponentMetadata.SpecialKindKey, ComponentMetadata.Splat.TagHelperKind);
builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString);
builder.Metadata[TagHelperMetadata.Runtime.Name] = ComponentMetadata.Splat.RuntimeName;
// WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like
// a C# property will crash trying to create the tooltips.
builder.SetTypeName("Microsoft.AspNetCore.Components.Attributes");
builder.TagMatchingRule(rule =>
{
rule.TagName = "*";
rule.Attribute(attribute =>
{
attribute.Name = "@attributes";
attribute.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString;
});
});
builder.BindAttribute(attribute =>
{
attribute.Documentation = ComponentResources.SplatTagHelper_Documentation;
attribute.Name = "@attributes";
// WTE has a bug 15.7p1 where a Tag Helper without a display-name that looks like
// a C# property will crash trying to create the tooltips.
attribute.SetPropertyName("Attributes");
attribute.TypeName = typeof(object).FullName;
attribute.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString;
});
return builder.Build();
}
}
}

View File

@ -0,0 +1,87 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Linq;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Components;
using Xunit;
namespace Microsoft.CodeAnalysis.Razor
{
public class SplatTagHelperDescriptorProviderTest : TagHelperDescriptorProviderTestBase
{
[Fact]
public void Execute_CreatesDescriptor()
{
// Arrange
var context = TagHelperDescriptorProviderContext.Create();
context.SetCompilation(BaseCompilation);
var provider = new SplatTagHelperDescriptorProvider();
// Act
provider.Execute(context);
// Assert
var matches = context.Results.Where(result => result.IsSplatTagHelper());
var item = Assert.Single(matches);
Assert.Empty(item.AllowedChildTags);
Assert.Null(item.TagOutputHint);
Assert.Empty(item.Diagnostics);
Assert.False(item.HasErrors);
Assert.Equal(ComponentMetadata.Splat.TagHelperKind, item.Kind);
Assert.Equal(bool.TrueString, item.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]);
Assert.Equal(ComponentMetadata.Splat.RuntimeName, item.Metadata[TagHelperMetadata.Runtime.Name]);
Assert.False(item.IsDefaultKind());
Assert.False(item.KindUsesDefaultTagHelperRuntime());
Assert.Equal(
"Merges a collection of attributes into the current element or component.",
item.Documentation);
Assert.Equal("Microsoft.AspNetCore.Components", item.AssemblyName);
Assert.Equal("Attributes", item.Name);
Assert.Equal("Microsoft.AspNetCore.Components.Attributes", item.DisplayName);
Assert.Equal("Microsoft.AspNetCore.Components.Attributes", item.GetTypeName());
var rule = Assert.Single(item.TagMatchingRules);
Assert.Empty(rule.Diagnostics);
Assert.False(rule.HasErrors);
Assert.Null(rule.ParentTag);
Assert.Equal("*", rule.TagName);
Assert.Equal(TagStructure.Unspecified, rule.TagStructure);
var requiredAttribute = Assert.Single(rule.Attributes);
Assert.Empty(requiredAttribute.Diagnostics);
Assert.Equal("@attributes", requiredAttribute.DisplayName);
Assert.Equal("@attributes", requiredAttribute.Name);
Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison);
Assert.Null(requiredAttribute.Value);
Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison);
var attribute = Assert.Single(item.BoundAttributes);
Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors);
Assert.Equal(ComponentMetadata.Splat.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind());
Assert.False(attribute.HasIndexer);
Assert.Null(attribute.IndexerNamePrefix);
Assert.Null(attribute.IndexerTypeName);
Assert.False(attribute.IsIndexerBooleanProperty);
Assert.False(attribute.IsIndexerStringProperty);
Assert.Equal(
"Merges a collection of attributes into the current element or component.",
attribute.Documentation);
Assert.Equal("@attributes", attribute.Name);
Assert.Equal("Attributes", attribute.GetPropertyName());
Assert.Equal("object Microsoft.AspNetCore.Components.Attributes.Attributes", attribute.DisplayName);
Assert.Equal("System.Object", attribute.TypeName);
Assert.False(attribute.IsStringProperty);
Assert.False(attribute.IsBooleanProperty);
Assert.False(attribute.IsEnum);
}
}
}

View File

@ -84,6 +84,10 @@ namespace Microsoft.AspNetCore.Components.RenderTree
{
}
public void AddMultipleAttributes(int sequence, IEnumerable<KeyValuePair<string, object>> attributes)
{
}
public void OpenComponent<TComponent>(int sequence) where TComponent : IComponent
{
}