Unnest IntermediateToken.TokenKind
This commit is contained in:
Родитель
03c92fe36b
Коммит
11c5293862
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var pageAttribute = new CSharpCodeIntermediateNode();
|
||||
pageAttribute.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = attribute,
|
||||
});
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var beginNode = new CSharpCodeIntermediateNode();
|
||||
beginNode.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = string.Format("{0}({1}, {2}, {3});",
|
||||
beginContextMethodName,
|
||||
item.Source.AbsoluteIndex.ToString(CultureInfo.InvariantCulture),
|
||||
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var endNode = new CSharpCodeIntermediateNode();
|
||||
endNode.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = string.Format("{0}();", endContextMethodName)
|
||||
});
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
|
||||
expression.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = "ModelExpressionProvider.CreateModelExpression(ViewData, __model => ",
|
||||
});
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
|
||||
expression.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = "__model."
|
||||
});
|
||||
|
||||
|
@ -71,7 +71,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
|
||||
expression.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = ")",
|
||||
});
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var vddProperty = new CSharpCodeIntermediateNode();
|
||||
vddProperty.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = $"public {viewDataType} ViewData => ({viewDataType})PageContext?.ViewData;",
|
||||
});
|
||||
@class.Children.Add(vddProperty);
|
||||
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var modelProperty = new CSharpCodeIntermediateNode();
|
||||
modelProperty.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = $"public {modelType} Model => ViewData.Model;",
|
||||
});
|
||||
@class.Children.Add(modelProperty);
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
var code = new CSharpCodeIntermediateNode();
|
||||
code.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = writer.GenerateCode()
|
||||
});
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
_builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = chunkGenerator.Value,
|
||||
Kind = IntermediateToken.TokenKind.Html,
|
||||
Kind = TokenKind.Html,
|
||||
Source = valueSpan
|
||||
});
|
||||
|
||||
|
@ -525,7 +525,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
_builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = span.Content,
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Source = BuildSourceSpanFromNode(span),
|
||||
});
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
_builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = span.Content,
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Source = BuildSourceSpanFromNode(span),
|
||||
});
|
||||
|
||||
|
@ -601,7 +601,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
_builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = span.Content,
|
||||
Kind = IntermediateToken.TokenKind.Html,
|
||||
Kind = TokenKind.Html,
|
||||
Source = source,
|
||||
});
|
||||
|
||||
|
@ -652,7 +652,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
node.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Content = span.Content,
|
||||
Kind = IntermediateToken.TokenKind.Html,
|
||||
Kind = TokenKind.Html,
|
||||
Source = BuildSourceSpanFromNode(span),
|
||||
});
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
|||
{
|
||||
new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = "#pragma warning disable 0414",
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
|||
{
|
||||
new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = $"private static {typeof(object).FullName} {DesignTimeVariable} = null;",
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
|||
{
|
||||
new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = "#pragma warning restore 0414",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,13 +26,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
|||
|
||||
visitor.VisitToken(this);
|
||||
}
|
||||
|
||||
public enum TokenKind
|
||||
{
|
||||
Unknown,
|
||||
CSharp,
|
||||
Html,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
||||
{
|
||||
public enum TokenKind
|
||||
{
|
||||
Unknown,
|
||||
CSharp,
|
||||
Html,
|
||||
}
|
||||
}
|
|
@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
{
|
||||
var csharpCode = Assert.IsType<CSharpCodeIntermediateNode>(node);
|
||||
var token = Assert.IsType<IntermediateToken>(Assert.Single(csharpCode.Children));
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(expectedAttribute, token.Content);
|
||||
},
|
||||
node => Assert.Same(@namespace, node));
|
||||
|
@ -238,7 +238,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
{
|
||||
var csharpCode = Assert.IsType<CSharpCodeIntermediateNode>(node);
|
||||
var token = Assert.IsType<IntermediateToken>(Assert.Single(csharpCode.Children));
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(expectedAttribute, token.Content);
|
||||
},
|
||||
node => Assert.Same(@namespace, node));
|
||||
|
@ -296,7 +296,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
{
|
||||
var csharpCode = Assert.IsType<CSharpCodeIntermediateNode>(node);
|
||||
var token = Assert.IsType<IntermediateToken>(Assert.Single(csharpCode.Children));
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(expectedAttribute, token.Content);
|
||||
},
|
||||
node => Assert.Same(@namespace, node));
|
||||
|
@ -348,7 +348,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
{
|
||||
var csharpCode = Assert.IsType<CSharpCodeIntermediateNode>(node);
|
||||
var token = Assert.IsType<IntermediateToken>(Assert.Single(csharpCode.Children));
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(expectedAttribute, token.Content);
|
||||
},
|
||||
node => Assert.Same(@namespace, node));
|
||||
|
|
|
@ -203,7 +203,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
for (var i = 0; i < node.Children.Count; i++)
|
||||
{
|
||||
var child = node.Children[i] as IntermediateToken;
|
||||
if (child.Kind == IntermediateToken.TokenKind.CSharp)
|
||||
if (child.Kind == TokenKind.CSharp)
|
||||
{
|
||||
builder.Append(child.Content);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "Hi",
|
||||
Kind = IntermediateToken.TokenKind.Html,
|
||||
Kind = TokenKind.Html,
|
||||
Source = CreateSource(1)
|
||||
});
|
||||
builder.Pop();
|
||||
|
@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "Hi",
|
||||
Kind = IntermediateToken.TokenKind.Html,
|
||||
Kind = TokenKind.Html,
|
||||
});
|
||||
builder.Pop();
|
||||
|
||||
|
@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "Hi",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
var pass = new InstrumentationPass()
|
||||
|
@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "Hi",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
var pass = new InstrumentationPass()
|
||||
|
@ -150,7 +150,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "Hi",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
var pass = new InstrumentationPass()
|
||||
|
@ -197,7 +197,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "Hi",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
var pass = new InstrumentationPass()
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
for (var i = 0; i < node.Children.Count; i++)
|
||||
{
|
||||
var child = node.Children[i] as IntermediateToken;
|
||||
if (child.Kind == IntermediateToken.TokenKind.CSharp)
|
||||
if (child.Kind == TokenKind.CSharp)
|
||||
{
|
||||
builder.Append(child.Content);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
Assert.Equal("ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Bar)", GetCSharpContent(expression));
|
||||
|
||||
var originalNode = Assert.IsType<IntermediateToken>(expression.Children[2]);
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, originalNode.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, originalNode.Kind);
|
||||
Assert.Equal("Bar", originalNode.Content);
|
||||
Assert.Equal(new SourceSpan("test.cshtml", 51, 1, 8, 3), originalNode.Source.Value);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
Assert.Equal("ModelExpressionProvider.CreateModelExpression(ViewData, __model => Bar)", GetCSharpContent(expression));
|
||||
|
||||
var originalNode = Assert.IsType<IntermediateToken>(expression.Children[1]);
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, originalNode.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, originalNode.Kind);
|
||||
Assert.Equal("Bar", originalNode.Content);
|
||||
Assert.Equal(new SourceSpan("test.cshtml", 52, 1, 9, 3), originalNode.Source.Value);
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
for (var i = 0; i < node.Children.Count; i++)
|
||||
{
|
||||
var child = node.Children[i] as IntermediateToken;
|
||||
if (child.Kind == IntermediateToken.TokenKind.CSharp)
|
||||
if (child.Kind == TokenKind.CSharp)
|
||||
{
|
||||
builder.Append(child.Content);
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore.
|
|||
",
|
||||
tokenNode.Content,
|
||||
ignoreLineEndingDifferences: true);
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, tokenNode.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, tokenNode.Kind);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -191,7 +191,7 @@ public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore.
|
|||
",
|
||||
tokenNode.Content,
|
||||
ignoreLineEndingDifferences: true);
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, tokenNode.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, tokenNode.Kind);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -274,7 +274,7 @@ public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore.
|
|||
",
|
||||
tokenNode.Content,
|
||||
ignoreLineEndingDifferences: true);
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, tokenNode.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, tokenNode.Kind);
|
||||
}
|
||||
|
||||
private RazorCodeDocument CreateDocument(string content)
|
||||
|
@ -335,7 +335,7 @@ public class __Generated__TagCloudViewComponentTagHelper : Microsoft.AspNetCore.
|
|||
for (var i = 0; i < node.Children.Count; i++)
|
||||
{
|
||||
var child = node.Children[i] as IntermediateToken;
|
||||
if (child.Kind == IntermediateToken.TokenKind.CSharp)
|
||||
if (child.Kind == TokenKind.CSharp)
|
||||
{
|
||||
builder.Append(child.Content);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ using System;
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -111,7 +111,7 @@ using System;
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -142,13 +142,13 @@ __o = i++;
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
builder.Add(new MyExtensionIntermediateNode());
|
||||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -179,13 +179,13 @@ __o = i++;
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
builder.Add(new MyExtensionIntermediateNode());
|
||||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -216,7 +216,7 @@ __o = i++;
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = " \t"
|
||||
});
|
||||
|
||||
|
@ -242,7 +242,7 @@ __o = i++;
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = " "
|
||||
});
|
||||
|
||||
|
@ -269,7 +269,7 @@ __o = i++;
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = "if (true) { }"
|
||||
});
|
||||
|
||||
|
@ -299,7 +299,7 @@ __o = i++;
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = "if (true) { }",
|
||||
});
|
||||
|
||||
|
@ -333,7 +333,7 @@ if (true) { }
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = " if (true) { }",
|
||||
});
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
|
|
@ -81,7 +81,7 @@ using System;
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -115,7 +115,7 @@ using System;
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -150,13 +150,13 @@ Test(i++);
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
builder.Add(new MyExtensionIntermediateNode());
|
||||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -191,13 +191,13 @@ Test(i++);
|
|||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "i",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
builder.Add(new MyExtensionIntermediateNode());
|
||||
builder.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "++",
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -229,7 +229,7 @@ Test(i++);
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = " \t"
|
||||
});
|
||||
|
||||
|
@ -253,7 +253,7 @@ Test(i++);
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = "if (true) { }"
|
||||
});
|
||||
|
||||
|
@ -284,7 +284,7 @@ Test(i++);
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = "if (true) { }",
|
||||
});
|
||||
|
||||
|
@ -319,7 +319,7 @@ if (true) { }
|
|||
IntermediateNodeBuilder.Create(node)
|
||||
.Add(new IntermediateToken()
|
||||
{
|
||||
Kind = IntermediateToken.TokenKind.CSharp,
|
||||
Kind = TokenKind.CSharp,
|
||||
Content = " if (true) { }",
|
||||
});
|
||||
|
||||
|
@ -351,7 +351,7 @@ if (true) { }
|
|||
node.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Content = "SomeContent",
|
||||
Kind = IntermediateToken.TokenKind.Html,
|
||||
Kind = TokenKind.Html,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
@ -378,7 +378,7 @@ if (true) { }
|
|||
node.Children.Add(new IntermediateToken()
|
||||
{
|
||||
Content = new string('*', 2000),
|
||||
Kind = IntermediateToken.TokenKind.Html,
|
||||
Kind = TokenKind.Html,
|
||||
});
|
||||
|
||||
// Act
|
||||
|
|
|
@ -255,11 +255,11 @@ __tagHelperExecutionContext = __tagHelperScopeManager.End();
|
|||
{
|
||||
new HtmlAttributeValueIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.Html, Content = "Blah-" } }
|
||||
Children = { new IntermediateToken { Kind = TokenKind.Html, Content = "Blah-" } }
|
||||
},
|
||||
new CSharpCodeAttributeValueIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "\"Foo\"", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "\"Foo\"", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -295,7 +295,7 @@ Render Children
|
|||
{
|
||||
new HtmlAttributeIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.Html, Content = "\"value\"", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.Html, Content = "\"value\"", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -333,11 +333,11 @@ __tagHelperExecutionContext.AddHtmlAttribute(""name"", Html.Raw(__tagHelperStrin
|
|||
{
|
||||
new HtmlAttributeValueIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.Html, Content = "Blah-" } }
|
||||
Children = { new IntermediateToken { Kind = TokenKind.Html, Content = "Blah-" } }
|
||||
},
|
||||
new CSharpCodeAttributeValueIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "\"Foo\"", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "\"Foo\"", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -380,7 +380,7 @@ EndAddHtmlAttributeValues(__tagHelperExecutionContext);
|
|||
{
|
||||
new HtmlContentIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.Html, Content = "value", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.Html, Content = "value", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -421,7 +421,7 @@ __InputTagHelper.StringProp = ""value"";
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "\"3+5\"", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "\"3+5\"", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -463,7 +463,7 @@ __InputTagHelper.StringProp = string.Empty;
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -551,7 +551,7 @@ __InputTagHelper.IntProp = 32;
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -592,7 +592,7 @@ __InputTagHelper.IntProp = 32;
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -636,7 +636,7 @@ __InputTagHelper.IntIndexer[""bound""] = 32;
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -676,7 +676,7 @@ __InputTagHelper.IntIndexer[""bound""] = 32;
|
|||
{
|
||||
new HtmlContentIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.Html, Content = "\"value\"", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.Html, Content = "\"value\"", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -723,7 +723,7 @@ __tagHelperExecutionContext.AddTagHelperAttribute(""bound"", __InputTagHelper.St
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -812,7 +812,7 @@ __tagHelperExecutionContext.AddTagHelperAttribute(""bound"", __InputTagHelper.In
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -854,7 +854,7 @@ __tagHelperExecutionContext.AddTagHelperAttribute(""bound"", __InputTagHelper.In
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -904,7 +904,7 @@ __tagHelperExecutionContext.AddTagHelperAttribute(""foo-bound"", __InputTagHelpe
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "17", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "17", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -922,7 +922,7 @@ __tagHelperExecutionContext.AddTagHelperAttribute(""foo-bound"", __InputTagHelpe
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -968,7 +968,7 @@ __tagHelperExecutionContext.AddTagHelperAttribute(""foo-bound"", __InputTagHelpe
|
|||
{
|
||||
new CSharpExpressionIntermediateNode()
|
||||
{
|
||||
Children = { new IntermediateToken { Kind = IntermediateToken.TokenKind.CSharp, Content = "32", } },
|
||||
Children = { new IntermediateToken { Kind = TokenKind.CSharp, Content = "32", } },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
|||
for (var i = 0; i < html.Children.Count; i++)
|
||||
{
|
||||
var token = Assert.IsType<IntermediateToken>(html.Children[i]);
|
||||
Assert.Equal(IntermediateToken.TokenKind.Html, token.Kind);
|
||||
Assert.Equal(TokenKind.Html, token.Kind);
|
||||
content.Append(token.Content);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
|||
for (var i = 0; i < statement.Children.Count; i++)
|
||||
{
|
||||
var token = Assert.IsType<IntermediateToken>(statement.Children[i]);
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, token.Kind);
|
||||
content.Append(token.Content);
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
|||
for (var i = 0; i < cSharp.Children.Count; i++)
|
||||
{
|
||||
var token = Assert.IsType<IntermediateToken>(cSharp.Children[i]);
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, token.Kind);
|
||||
content.Append(token.Content);
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
|||
for (var i = 0; i < endNode.Children.Count; i++)
|
||||
{
|
||||
var token = Assert.IsType<IntermediateToken>(endNode.Children[i]);
|
||||
Assert.Equal(IntermediateToken.TokenKind.CSharp, token.Kind);
|
||||
Assert.Equal(TokenKind.CSharp, token.Kind);
|
||||
content.Append(token.Content);
|
||||
}
|
||||
Assert.Equal("EndContext();", content.ToString());
|
||||
|
|
Загрузка…
Ссылка в новой задаче