diff --git a/src/Microsoft.AspNetCore.Razor/CSharpRazorCodeLanguage.cs b/src/Microsoft.AspNetCore.Razor/CSharpRazorCodeLanguage.cs index dc9c0f5eb2..1ce61ac734 100644 --- a/src/Microsoft.AspNetCore.Razor/CSharpRazorCodeLanguage.cs +++ b/src/Microsoft.AspNetCore.Razor/CSharpRazorCodeLanguage.cs @@ -45,9 +45,9 @@ namespace Microsoft.AspNetCore.Razor return new RazorChunkGenerator(className, rootNamespaceName, sourceFileName, host); } - public override CodeGenerator CreateCodeGenerator(CodeGeneratorContext context) + public override CodeGenerator CreateCodeGenerator(CodeGeneratorContext chunkGeneratorContext) { - return new CSharpCodeGenerator(context); + return new CSharpCodeGenerator(chunkGeneratorContext); } } } diff --git a/src/Microsoft.AspNetCore.Razor/Chunks/Generators/RazorChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor/Chunks/Generators/RazorChunkGenerator.cs index 5dfb12c856..eeff2a4307 100644 --- a/src/Microsoft.AspNetCore.Razor/Chunks/Generators/RazorChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor/Chunks/Generators/RazorChunkGenerator.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Chunks.Generators ClassName = className; RootNamespaceName = rootNamespaceName; SourceFileName = sourceFileName; - GenerateLinePragmas = string.IsNullOrEmpty(SourceFileName) ? false : true; + GenerateLinePragmas = !string.IsNullOrEmpty(SourceFileName); Host = host; } diff --git a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpCodeGenerator.cs b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpCodeGenerator.cs index c2d0198ef3..ab81d26494 100644 --- a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpCodeGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpCodeGenerator.cs @@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Razor.CodeGenerators using (writer.BuildConstructor(Context.ClassName)) { // Any constructor based logic that we need to add? - }; + } } private void AddImports(ChunkTree chunkTree, CSharpCodeWriter writer, IEnumerable defaultImports) diff --git a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpCodeWriter.cs b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpCodeWriter.cs index d8ed65bae6..559e8ced77 100644 --- a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpCodeWriter.cs +++ b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpCodeWriter.cs @@ -16,8 +16,7 @@ namespace Microsoft.AspNetCore.Razor.CodeGenerators { private const string InstanceMethodFormat = "{0}.{1}"; - private static readonly char[] CStyleStringLiteralEscapeChars = new char[] - { + private static readonly char[] CStyleStringLiteralEscapeChars = { '\r', '\t', '\"', diff --git a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CodeWriter.cs b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CodeWriter.cs index 6feb966e04..c74889e07a 100644 --- a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CodeWriter.cs +++ b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CodeWriter.cs @@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Razor.CodeGenerators { public class CodeWriter : IDisposable { - private static readonly char[] NewLineCharacters = new char[] { '\r', '\n' }; + private static readonly char[] NewLineCharacters = { '\r', '\n' }; private string _cache = string.Empty; private bool _dirty; diff --git a/src/Microsoft.AspNetCore.Razor/Parser/HtmlMarkupParser.Document.cs b/src/Microsoft.AspNetCore.Razor/Parser/HtmlMarkupParser.Document.cs index 94bac68dd5..9a05699afb 100644 --- a/src/Microsoft.AspNetCore.Razor/Parser/HtmlMarkupParser.Document.cs +++ b/src/Microsoft.AspNetCore.Razor/Parser/HtmlMarkupParser.Document.cs @@ -12,8 +12,7 @@ namespace Microsoft.AspNetCore.Razor.Parser { public partial class HtmlMarkupParser { - private static readonly char[] ValidAfterTypeAttributeNameCharacters = - new[] { ' ', '\t', '\r', '\n', '\f', '=' }; + private static readonly char[] ValidAfterTypeAttributeNameCharacters = { ' ', '\t', '\r', '\n', '\f', '=' }; public override void ParseDocument() { diff --git a/src/Microsoft.AspNetCore.Razor/Text/LocationTagged.cs b/src/Microsoft.AspNetCore.Razor/Text/LocationTagged.cs index e2916a34c2..abd4e8fad4 100644 --- a/src/Microsoft.AspNetCore.Razor/Text/LocationTagged.cs +++ b/src/Microsoft.AspNetCore.Razor/Text/LocationTagged.cs @@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Razor.Text public override bool Equals(object obj) { - LocationTagged other = obj as LocationTagged; + var other = obj as LocationTagged; if (ReferenceEquals(other, null)) { return false; diff --git a/src/Microsoft.AspNetCore.Razor/Tokenizer/Symbols/SymbolBase.cs b/src/Microsoft.AspNetCore.Razor/Tokenizer/Symbols/SymbolBase.cs index ca66b4fb9e..ba34a79b20 100644 --- a/src/Microsoft.AspNetCore.Razor/Tokenizer/Symbols/SymbolBase.cs +++ b/src/Microsoft.AspNetCore.Razor/Tokenizer/Symbols/SymbolBase.cs @@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Razor.Tokenizer.Symbols public override bool Equals(object obj) { - SymbolBase other = obj as SymbolBase; + var other = obj as SymbolBase; return other != null && Start.Equals(other.Start) && string.Equals(Content, other.Content, StringComparison.Ordinal) && diff --git a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperTypeResolverTest.cs b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperTypeResolverTest.cs index d5f2bba238..5d668ba6a5 100644 --- a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperTypeResolverTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperTypeResolverTest.cs @@ -13,13 +13,13 @@ namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers { public class TagHelperTypeResolverTest { - protected static readonly Type[] ValidTestableTagHelpers = new[] + protected static readonly Type[] ValidTestableTagHelpers = { typeof(Valid_PlainTagHelper), typeof(Valid_InheritedTagHelper) }; - protected static readonly Type[] InvalidTestableTagHelpers = new[] + protected static readonly Type[] InvalidTestableTagHelpers = { typeof(Invalid_AbstractTagHelper), typeof(Invalid_GenericTagHelper<>), diff --git a/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/TagHelperAttributeValueCodeRendererTest.cs b/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/TagHelperAttributeValueCodeRendererTest.cs index 1d129d1fae..8e70abc704 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/TagHelperAttributeValueCodeRendererTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/TagHelperAttributeValueCodeRendererTest.cs @@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Generator private class CustomTagHelperAttributeCodeRenderer : TagHelperAttributeValueCodeRenderer { public override void RenderAttributeValue( - TagHelperAttributeDescriptor attributeInfo, + TagHelperAttributeDescriptor attributeDescriptor, CSharpCodeWriter writer, CodeGeneratorContext context, Action renderAttributeValue, @@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Generator { writer.Write("**From custom attribute code renderer**: "); - base.RenderAttributeValue(attributeInfo, writer, context, renderAttributeValue, complexValue); + base.RenderAttributeValue(attributeDescriptor, writer, context, renderAttributeValue, complexValue); } } diff --git a/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/TagHelperTestBase.cs b/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/TagHelperTestBase.cs index b598a5f952..9c878d5862 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/TagHelperTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/TagHelperTestBase.cs @@ -82,9 +82,9 @@ namespace Microsoft.AspNetCore.Razor.Test.Generator return Host.DecorateCodeGenerator(new TestCSharpCodeGenerator(context), context); } - protected internal override RazorParser CreateParser(string fileName) + protected internal override RazorParser CreateParser(string sourceFileName) { - var parser = base.CreateParser(fileName); + var parser = base.CreateParser(sourceFileName); return new RazorParser(parser.CodeParser, parser.MarkupParser, diff --git a/test/Microsoft.AspNetCore.Razor.Test/Parser/CallbackParserListenerTest.cs b/test/Microsoft.AspNetCore.Razor.Test/Parser/CallbackParserListenerTest.cs index 4027d2251d..f64531bb79 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Parser/CallbackParserListenerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Parser/CallbackParserListenerTest.cs @@ -104,7 +104,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser private static void RunSyncContextTest(T expected, Func, CallbackVisitor> ctor, Action call) { // Arrange - Mock mockContext = new Mock(); + var mockContext = new Mock(); mockContext.Setup(c => c.Post(It.IsAny(), It.IsAny())) .Callback((callback, state) => { callback(expected); }); diff --git a/test/Microsoft.AspNetCore.Razor.Test/Parser/ParserContextTest.cs b/test/Microsoft.AspNetCore.Razor.Test/Parser/ParserContextTest.cs index ec53cec3c1..9968d728eb 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Parser/ParserContextTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Parser/ParserContextTest.cs @@ -127,7 +127,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser public void EndBlockAddsCurrentBlockToParentBlock() { // Arrange - Mock mockListener = new Mock(); + var mockListener = new Mock(); var context = SetupTestContext("phoo"); // Act @@ -147,7 +147,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser { // Arrange var factory = SpanFactory.CreateCsHtml(); - Mock mockListener = new Mock(); + var mockListener = new Mock(); var context = SetupTestContext("phoo"); var builder = new SpanBuilder() diff --git a/test/Microsoft.AspNetCore.Razor.Test/Parser/ParserVisitorExtensionsTest.cs b/test/Microsoft.AspNetCore.Razor.Test/Parser/ParserVisitorExtensionsTest.cs index 75a201dc44..964159d18d 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Parser/ParserVisitorExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Parser/ParserVisitorExtensionsTest.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser public void VisitSendsDocumentToVisitor() { // Arrange - Mock targetMock = new Mock(); + var targetMock = new Mock(); var root = new BlockBuilder() { Type = BlockType.Comment }.Build(); var errorSink = new ErrorSink(); var results = new ParserResults(root, @@ -35,10 +35,10 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser public void VisitSendsErrorsToVisitor() { // Arrange - Mock targetMock = new Mock(); + var targetMock = new Mock(); var root = new BlockBuilder() { Type = BlockType.Comment }.Build(); var errorSink = new ErrorSink(); - List errors = new List + var errors = new List { new RazorError("Foo", new SourceLocation(1, 0, 1), length: 3), new RazorError("Bar", new SourceLocation(2, 0, 2), length: 3), @@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser public void VisitCallsOnCompleteWhenAllNodesHaveBeenVisited() { // Arrange - Mock targetMock = new Mock(); + var targetMock = new Mock(); var root = new BlockBuilder() { Type = BlockType.Comment }.Build(); var errorSink = new ErrorSink(); errorSink.OnError(new RazorError("Foo", new SourceLocation(1, 0, 1), length: 3));