diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/AssemblyAttributeInjectionPass.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/AssemblyAttributeInjectionPass.cs index 6657b950a9..51e8f185e0 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/AssemblyAttributeInjectionPass.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/AssemblyAttributeInjectionPass.cs @@ -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, }); diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InstrumentationPass.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InstrumentationPass.cs index 953453710f..9f271faf82 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InstrumentationPass.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InstrumentationPass.cs @@ -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) }); diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ModelExpressionPass.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ModelExpressionPass.cs index b01382353c..7b44002ff9 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ModelExpressionPass.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ModelExpressionPass.cs @@ -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 = ")", }); diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/PagesPropertyInjectionPass.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/PagesPropertyInjectionPass.cs index fd85d6a2bb..4a47275e13 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/PagesPropertyInjectionPass.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/PagesPropertyInjectionPass.cs @@ -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); diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperPass.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperPass.cs index 405b7bdc19..03cb7c1f50 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperPass.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperPass.cs @@ -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() }); diff --git a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs index 670656ad8b..6c5d63731a 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs @@ -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), }); diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectivePass.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectivePass.cs index 7b0d75bc62..31e9cbf361 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectivePass.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectivePass.cs @@ -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", } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateToken.cs index fd2498602a..d2da5fae18 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateToken.cs @@ -26,13 +26,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitToken(this); } - - public enum TokenKind - { - Unknown, - CSharp, - Html, - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/TokenKind.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/TokenKind.cs new file mode 100644 index 0000000000..b73d6797cd --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/TokenKind.cs @@ -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, + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/AssemblyAttributeInjectionPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/AssemblyAttributeInjectionPassTest.cs index 0aa174b3bc..52fad6b872 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/AssemblyAttributeInjectionPassTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/AssemblyAttributeInjectionPassTest.cs @@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions { var csharpCode = Assert.IsType(node); var token = Assert.IsType(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(node); var token = Assert.IsType(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(node); var token = Assert.IsType(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(node); var token = Assert.IsType(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)); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/InjectDirectiveTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/InjectDirectiveTest.cs index e58f34065f..06acc57d82 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/InjectDirectiveTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/InjectDirectiveTest.cs @@ -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); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/InstrumentationPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/InstrumentationPassTest.cs index ee26d8d53b..0827042ac4 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/InstrumentationPassTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/InstrumentationPassTest.cs @@ -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() diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ModelDirectiveTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ModelDirectiveTest.cs index 704718dcbd..fcf8bc2422 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ModelDirectiveTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ModelDirectiveTest.cs @@ -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); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ModelExpressionPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ModelExpressionPassTest.cs index 2a4ca9fc8a..6a74edf40e 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ModelExpressionPassTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ModelExpressionPassTest.cs @@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions Assert.Equal("ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Bar)", GetCSharpContent(expression)); var originalNode = Assert.IsType(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(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); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ViewComponentTagHelperPassTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ViewComponentTagHelperPassTest.cs index e410ecb659..cb762ebebc 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ViewComponentTagHelperPassTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/ViewComponentTagHelperPassTest.cs @@ -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); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/DesignTimeNodeWriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/DesignTimeNodeWriterTest.cs index 3ec12f07bf..56033fe8a8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/DesignTimeNodeWriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/DesignTimeNodeWriterTest.cs @@ -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) { }", }); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/LiteralRuntimeNodeWriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/LiteralRuntimeNodeWriterTest.cs index c2192d4486..81dbad980e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/LiteralRuntimeNodeWriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/LiteralRuntimeNodeWriterTest.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration builder.Add(new IntermediateToken() { Content = "i++", - Kind = IntermediateToken.TokenKind.CSharp, + Kind = TokenKind.CSharp, }); // Act diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/RuntimeNodeWriterTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/RuntimeNodeWriterTest.cs index ea24ff2c02..fe6ca63021 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/RuntimeNodeWriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/CodeGeneration/RuntimeNodeWriterTest.cs @@ -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 diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/DefaultTagHelperTargetExtensionTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/DefaultTagHelperTargetExtensionTest.cs index 18c9673777..8ed76deb3d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/DefaultTagHelperTargetExtensionTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/DefaultTagHelperTargetExtensionTest.cs @@ -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", } }, } } }; diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Intermediate/IntermediateNodeAssert.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Intermediate/IntermediateNodeAssert.cs index ab72e69ec9..c0c2e18128 100644 --- a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Intermediate/IntermediateNodeAssert.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Intermediate/IntermediateNodeAssert.cs @@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate for (var i = 0; i < html.Children.Count; i++) { var token = Assert.IsType(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(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(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(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());