diff --git a/src/Microsoft.AspNet.Razor/CSharpRazorCodeLanguage.cs b/src/Microsoft.AspNet.Razor/CSharpRazorCodeLanguage.cs index 64b15d090b..008b8edbd7 100644 --- a/src/Microsoft.AspNet.Razor/CSharpRazorCodeLanguage.cs +++ b/src/Microsoft.AspNet.Razor/CSharpRazorCodeLanguage.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser; #if NET45 @@ -36,7 +36,11 @@ namespace Microsoft.AspNet.Razor /// /// Constructs a new instance of the chunk generator for this language with the specified settings /// - public override RazorChunkGenerator CreateChunkGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host) + public override RazorChunkGenerator CreateChunkGenerator( + string className, + string rootNamespaceName, + string sourceFileName, + RazorEngineHost host) { return new RazorChunkGenerator(className, rootNamespaceName, sourceFileName, host); } diff --git a/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs b/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs index b587a993fc..30c6ea7e44 100644 --- a/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs @@ -8,13 +8,13 @@ namespace Microsoft.AspNet.Razor.Chunks { public class ChunkTreeBuilder { - private readonly Stack _parentChain; + private readonly Stack _parentStack; private Chunk _lastChunk; public ChunkTreeBuilder() { ChunkTree = new ChunkTree(); - _parentChain = new Stack(); + _parentStack = new Stack(); } public ChunkTree ChunkTree { get; private set; } @@ -27,13 +27,13 @@ namespace Microsoft.AspNet.Razor.Chunks chunk.Association = association; // If we're not in the middle of a chunk block - if (_parentChain.Count == 0 || topLevel == true) + if (_parentStack.Count == 0 || topLevel == true) { ChunkTree.Chunks.Add(chunk); } else { - _parentChain.Peek().Children.Add(chunk); + _parentStack.Peek().Children.Add(chunk); } } @@ -164,14 +164,14 @@ namespace Microsoft.AspNet.Razor.Chunks { AddChunk(parentChunk, association, topLevel); - _parentChain.Push(parentChunk); + _parentStack.Push(parentChunk); return parentChunk; } public void EndParentChunk() { - _lastChunk = _parentChain.Pop(); + _lastChunk = _parentStack.Pop(); } } } diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/ChunkGeneratorContext.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ChunkGeneratorContext.cs index 9accfb3394..95ff4493f8 100644 --- a/src/Microsoft.AspNet.Razor/Chunks/Generators/ChunkGeneratorContext.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/ChunkGeneratorContext.cs @@ -33,11 +33,11 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators public string SourceFile { get; internal set; } - public string RootNamespace { get; private set; } + public string RootNamespace { get; } - public string ClassName { get; private set; } + public string ClassName { get; } - public RazorEngineHost Host { get; private set; } + public RazorEngineHost Host { get; } public ChunkTreeBuilder ChunkTreeBuilder { get; set; } } diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/ExpressionChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ExpressionChunkGenerator.cs index 210ab287f3..adfee65da3 100644 --- a/src/Microsoft.AspNet.Razor/Chunks/Generators/ExpressionChunkGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/ExpressionChunkGenerator.cs @@ -5,21 +5,21 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class ExpressionChunkGenerator : HybridChunkGenerator + public class ExpressionChunkGenerator : ISpanChunkGenerator, IParentChunkGenerator { private static readonly int TypeHashCode = typeof(ExpressionChunkGenerator).GetHashCode(); - public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) + public void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) { context.ChunkTreeBuilder.StartParentChunk(target); } - public override void GenerateChunk(Span target, ChunkGeneratorContext context) + public void GenerateChunk(Span target, ChunkGeneratorContext context) { context.ChunkTreeBuilder.AddExpressionChunk(target.Content, target); } - public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) + public void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) { context.ChunkTreeBuilder.EndParentChunk(); } diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/HybridChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/HybridChunkGenerator.cs deleted file mode 100644 index 7a3d368b6a..0000000000 --- a/src/Microsoft.AspNet.Razor/Chunks/Generators/HybridChunkGenerator.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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 Microsoft.AspNet.Razor.Parser.SyntaxTree; - -namespace Microsoft.AspNet.Razor.Chunks.Generators -{ - public abstract class HybridChunkGenerator : ISpanChunkGenerator, IParentChunkGenerator - { - public virtual void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) - { - } - - public virtual void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) - { - } - - public virtual void GenerateChunk(Span target, ChunkGeneratorContext context) - { - } - } -} diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/LiteralAttributeChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/LiteralAttributeChunkGenerator.cs index df020effbd..4dd9ad81e0 100644 --- a/src/Microsoft.AspNet.Razor/Chunks/Generators/LiteralAttributeChunkGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/LiteralAttributeChunkGenerator.cs @@ -10,7 +10,9 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators { public class LiteralAttributeChunkGenerator : SpanChunkGenerator { - public LiteralAttributeChunkGenerator(LocationTagged prefix, LocationTagged valueGenerator) + public LiteralAttributeChunkGenerator( + LocationTagged prefix, + LocationTagged valueGenerator) { Prefix = prefix; ValueGenerator = valueGenerator; diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/ParentChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ParentChunkGenerator.cs index 4a7de85e44..54629c6260 100644 --- a/src/Microsoft.AspNet.Razor/Chunks/Generators/ParentChunkGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/ParentChunkGenerator.cs @@ -10,7 +10,10 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators { private static readonly int TypeHashCode = typeof(ParentChunkGenerator).GetHashCode(); - [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "This class has no instance state")] + [SuppressMessage( + "Microsoft.Security", + "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", + Justification = "This class has no instance state")] public static readonly IParentChunkGenerator Null = new NullParentChunkGenerator(); public virtual void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/SpanChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/SpanChunkGenerator.cs index c119889d9c..225d33c8c1 100644 --- a/src/Microsoft.AspNet.Razor/Chunks/Generators/SpanChunkGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/SpanChunkGenerator.cs @@ -10,7 +10,10 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators { private static readonly int TypeHashCode = typeof(SpanChunkGenerator).GetHashCode(); - [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "This class has no instance state")] + [SuppressMessage( + "Microsoft.Security", + "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", + Justification = "This class has no instance state")] public static readonly ISpanChunkGenerator Null = new NullSpanChunkGenerator(); public virtual void GenerateChunk(Span target, ChunkGeneratorContext context) diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperChunkGenerator.cs index 2b889d7db7..1d9b8421fc 100644 --- a/src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperChunkGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperChunkGenerator.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.TagHelpers; @@ -40,11 +41,9 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators { var tagHelperBlock = target as TagHelperBlock; - if (tagHelperBlock == null) - { - throw new ArgumentException( - RazorResources.TagHelpers_TagHelperCodeGeneartorMustBeAssociatedWithATagHelperBlock); - } + Debug.Assert( + tagHelperBlock != null, + $"A {nameof(TagHelperChunkGenerator)} must only be used with {nameof(TagHelperBlock)}s."); var attributes = new List>(); @@ -60,7 +59,7 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators if (attribute.Value != null) { - // Populates the code tree with chunks associated with attributes + // Populates the chunk tree with chunks associated with attributes attribute.Value.Accept(chunkGenerator); var chunks = chunkGenerator.Context.ChunkTreeBuilder.ChunkTree.Chunks; @@ -76,7 +75,7 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators attributes.Add(new KeyValuePair(attribute.Key, attributeChunkValue)); - // Reset the code tree builder so we can build a new one for the next attribute + // Reset the chunk tree builder so we can build a new one for the next attribute chunkGenerator.Context.ChunkTreeBuilder = new ChunkTreeBuilder(); } diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeGenerator.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeGenerator.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeGenerator.cs index 4f621fbf0e..e148b7b604 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeGenerator.cs @@ -5,10 +5,10 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Razor.Chunks; -using Microsoft.AspNet.Razor.CodeGeneration.Visitors; +using Microsoft.AspNet.Razor.CodeGenerators.Visitors; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CSharpCodeGenerator : CodeGenerator { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWriter.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeWriter.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWriter.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeWriter.cs index 4c4771f669..3782cff4de 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWriter.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeWriter.cs @@ -10,7 +10,7 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Text; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CSharpCodeWriter : CodeWriter { @@ -464,7 +464,10 @@ namespace Microsoft.AspNet.Razor.CodeGeneration Write("\""); } - public void WriteStartInstrumentationContext(ChunkGeneratorContext context, SyntaxTreeNode syntaxNode, bool isLiteral) + public void WriteStartInstrumentationContext( + ChunkGeneratorContext context, + SyntaxTreeNode syntaxNode, + bool isLiteral) { WriteStartMethodInvocation(context.Host.GeneratedClassContext.BeginContextMethodName); Write(syntaxNode.Start.AbsoluteIndex.ToString(CultureInfo.InvariantCulture)); diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWritingScope.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeWritingScope.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWritingScope.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeWritingScope.cs index c93131f1ed..2616c149b0 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWritingScope.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpCodeWritingScope.cs @@ -4,7 +4,7 @@ using System; using System.Linq; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public struct CSharpCodeWritingScope : IDisposable { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpDisableWarningScope.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpDisableWarningScope.cs similarity index 94% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CSharpDisableWarningScope.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CSharpDisableWarningScope.cs index 414a3d58e1..3c319c5f12 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpDisableWarningScope.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpDisableWarningScope.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public struct CSharpDisableWarningScope : IDisposable { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpLineMappingWriter.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpLineMappingWriter.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CSharpLineMappingWriter.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CSharpLineMappingWriter.cs index 62aa21a40d..20e948114d 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpLineMappingWriter.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpLineMappingWriter.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CSharpLineMappingWriter : IDisposable { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpPaddingBuilder.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpPaddingBuilder.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CSharpPaddingBuilder.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CSharpPaddingBuilder.cs index 2e04451c69..91f00285df 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpPaddingBuilder.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpPaddingBuilder.cs @@ -6,7 +6,7 @@ using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CSharpPaddingBuilder { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpTagHelperCodeRenderer.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CSharpTagHelperCodeRenderer.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs index 9a7f3456ae..b87f813cea 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpTagHelperCodeRenderer.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs @@ -6,11 +6,11 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using Microsoft.AspNet.Razor.Chunks; -using Microsoft.AspNet.Razor.CodeGeneration.Visitors; +using Microsoft.AspNet.Razor.CodeGenerators.Visitors; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { /// /// Renders tag helper rendering code. diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CodeGenerator.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CodeGenerator.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CodeGenerator.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CodeGenerator.cs index e758a395e6..e4930f42cb 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CodeGenerator.cs @@ -1,7 +1,7 @@ // 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.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public abstract class CodeGenerator { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CodeGeneratorContext.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CodeGeneratorContext.cs similarity index 87% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CodeGeneratorContext.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CodeGeneratorContext.cs index 0e30489cdd..b3dc00fcdc 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CodeGeneratorContext.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CodeGeneratorContext.cs @@ -3,7 +3,7 @@ using Microsoft.AspNet.Razor.Chunks.Generators; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { /// /// Context object with information used to generate a Razor page. @@ -26,12 +26,13 @@ namespace Microsoft.AspNet.Razor.CodeGeneration } // Internal for testing. - internal CodeGeneratorContext(RazorEngineHost host, - string className, - string rootNamespace, - string sourceFile, - bool shouldGenerateLinePragmas, - ErrorSink errorSink) + internal CodeGeneratorContext( + RazorEngineHost host, + string className, + string rootNamespace, + string sourceFile, + bool shouldGenerateLinePragmas, + ErrorSink errorSink) : base(host, className, rootNamespace, sourceFile, shouldGenerateLinePragmas) { ErrorSink = errorSink; diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CodeGeneratorResult.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CodeGeneratorResult.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CodeGeneratorResult.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CodeGeneratorResult.cs index e13d691d21..2d03a5fd4f 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CodeGeneratorResult.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CodeGeneratorResult.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CodeGeneratorResult { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/CodeWriter.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CodeWriter.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/CodeGeneration/CodeWriter.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/CodeWriter.cs index f0f43b0027..8190243d03 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/CodeWriter.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CodeWriter.cs @@ -4,7 +4,7 @@ using System; using System.IO; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CodeWriter : IDisposable { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/ExpressionRenderingMode.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/ExpressionRenderingMode.cs similarity index 95% rename from src/Microsoft.AspNet.Razor/CodeGeneration/ExpressionRenderingMode.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/ExpressionRenderingMode.cs index ae7655b78b..d580d375f1 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/ExpressionRenderingMode.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/ExpressionRenderingMode.cs @@ -1,7 +1,7 @@ // 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.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public enum ExpressionRenderingMode { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedClassContext.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedClassContext.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedClassContext.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedClassContext.cs index 3d6232a911..f0cc2a3c0b 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedClassContext.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedClassContext.cs @@ -6,7 +6,7 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.Framework.Internal; using Microsoft.Internal.Web.Utils; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public struct GeneratedClassContext { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedTagHelperContext.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedTagHelperContext.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedTagHelperContext.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedTagHelperContext.cs index 4f095f7d12..d50d4901da 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedTagHelperContext.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratedTagHelperContext.cs @@ -1,7 +1,7 @@ // 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.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { /// /// Contains necessary information for the tag helper code generation process. diff --git a/src/Microsoft.AspNet.Razor/GeneratorResults.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratorResults.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/GeneratorResults.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/GeneratorResults.cs index 23f4a263cc..1dad924ea8 100644 --- a/src/Microsoft.AspNet.Razor/GeneratorResults.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/GeneratorResults.cs @@ -3,12 +3,11 @@ using System.Collections.Generic; using Microsoft.AspNet.Razor.Chunks; -using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor +namespace Microsoft.AspNet.Razor.CodeGenerators { /// /// The results of parsing and generating code for a Razor document. diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/LineMapping.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/LineMapping.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/CodeGeneration/LineMapping.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/LineMapping.cs index 379416986a..011d0fdd51 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/LineMapping.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/LineMapping.cs @@ -4,7 +4,7 @@ using System.Globalization; using Microsoft.Internal.Web.Utils; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class LineMapping { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/LineMappingManager.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/LineMappingManager.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/CodeGeneration/LineMappingManager.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/LineMappingManager.cs index e14f85cbaa..584a83111a 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/LineMappingManager.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/LineMappingManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class LineMappingManager { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/MappingLocation.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/MappingLocation.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/CodeGeneration/MappingLocation.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/MappingLocation.cs index 3943f2c273..3150f45d72 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/MappingLocation.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/MappingLocation.cs @@ -4,7 +4,7 @@ using System.Globalization; using Microsoft.Internal.Web.Utils; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class MappingLocation { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/TagHelperAttributeValueCodeRenderer.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/TagHelperAttributeValueCodeRenderer.cs similarity index 91% rename from src/Microsoft.AspNet.Razor/CodeGeneration/TagHelperAttributeValueCodeRenderer.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/TagHelperAttributeValueCodeRenderer.cs index 7bf5525de3..3a17d9d4cd 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/TagHelperAttributeValueCodeRenderer.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/TagHelperAttributeValueCodeRenderer.cs @@ -5,7 +5,7 @@ using System; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { /// /// Renders code for tag helper property initialization. @@ -20,8 +20,8 @@ namespace Microsoft.AspNet.Razor.CodeGeneration /// The to generate code for. /// /// The that's used to write code. - /// A instance that contains information about - /// the current code generation process. + /// A instance that contains + /// information about the current code generation process. /// /// that renders the raw value of the HTML attribute. /// diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpBaseTypeVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpBaseTypeVisitor.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpBaseTypeVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpBaseTypeVisitor.cs index 52abbe9992..b1859db9f4 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpBaseTypeVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpBaseTypeVisitor.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public class CSharpBaseTypeVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpCodeVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpCodeVisitor.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpCodeVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpCodeVisitor.cs index 410c320f0f..731d72593e 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpCodeVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpCodeVisitor.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.Razor.Chunks; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public class CSharpCodeVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpDesignTimeHelpersVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpDesignTimeHelpersVisitor.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpDesignTimeHelpersVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpDesignTimeHelpersVisitor.cs index 7962742c8f..feb4ececef 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpDesignTimeHelpersVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpDesignTimeHelpersVisitor.cs @@ -6,7 +6,7 @@ using System.Globalization; using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public class CSharpDesignTimeHelpersVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperAttributeValueVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperAttributeValueVisitor.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperAttributeValueVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperAttributeValueVisitor.cs index 25056f8504..3d8091b2e7 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperAttributeValueVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperAttributeValueVisitor.cs @@ -6,7 +6,7 @@ using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { /// /// that writes code for a non- tag helper @@ -98,7 +98,7 @@ namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors /// The to render. /// /// Allowed to support future C# extensions. Likely "~/..." will lead to a C# compilation error but that is up - /// to the . + /// to the compiler. /// protected override void Visit(ResolveUrlChunk chunk) { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs index de415edcde..18d87c2a62 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public class CSharpTagHelperFieldDeclarationVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs index e2b3de5f9f..ae38ac0c1a 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { /// /// The that generates the code to initialize the TagHelperRunner. diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTypeMemberVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTypeMemberVisitor.cs similarity index 94% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTypeMemberVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTypeMemberVisitor.cs index b27aade501..1410730251 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTypeMemberVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpTypeMemberVisitor.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public class CSharpTypeMemberVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpUsingVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpUsingVisitor.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpUsingVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpUsingVisitor.cs index 7ed96e7f61..f4e865be31 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpUsingVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CSharpUsingVisitor.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.Razor.Chunks; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public class CSharpUsingVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/ChunkVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/ChunkVisitor.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/ChunkVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/ChunkVisitor.cs index e6ed9c35ad..3143eb6df8 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/ChunkVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/ChunkVisitor.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public abstract class ChunkVisitor : IChunkVisitor where TWriter : CodeWriter diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CodeVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CodeVisitor.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CodeVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CodeVisitor.cs index d882ee2c49..b89c2f242b 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CodeVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/CodeVisitor.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public class CodeVisitor : ChunkVisitor where TWriter : CodeWriter diff --git a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/IChunkVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/IChunkVisitor.cs similarity index 86% rename from src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/IChunkVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/IChunkVisitor.cs index 00f97470d6..f7b84c6da8 100644 --- a/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/IChunkVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/Visitors/IChunkVisitor.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Microsoft.AspNet.Razor.Chunks; -namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors +namespace Microsoft.AspNet.Razor.CodeGenerators.Visitors { public interface IChunkVisitor { diff --git a/src/Microsoft.AspNet.Razor/DocumentParseCompleteEventArgs.cs b/src/Microsoft.AspNet.Razor/DocumentParseCompleteEventArgs.cs index c1cf0dff67..898d7b0828 100644 --- a/src/Microsoft.AspNet.Razor/DocumentParseCompleteEventArgs.cs +++ b/src/Microsoft.AspNet.Razor/DocumentParseCompleteEventArgs.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Text; namespace Microsoft.AspNet.Razor diff --git a/src/Microsoft.AspNet.Razor/Editor/BackgroundParser.cs b/src/Microsoft.AspNet.Razor/Editor/BackgroundParser.cs index 0b90c04392..762ca2433f 100644 --- a/src/Microsoft.AspNet.Razor/Editor/BackgroundParser.cs +++ b/src/Microsoft.AspNet.Razor/Editor/BackgroundParser.cs @@ -9,6 +9,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Threading; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Utils; diff --git a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Directives.cs b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Directives.cs index 6075b489d4..31712ca038 100644 --- a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Directives.cs +++ b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Directives.cs @@ -222,7 +222,9 @@ namespace Microsoft.AspNet.Razor.Parser protected void InheritsDirectiveCore() { - BaseTypeDirective(RazorResources.ParseError_InheritsKeyword_Must_Be_Followed_By_TypeName, baseType => new SetBaseTypeChunkGenerator(baseType)); + BaseTypeDirective( + RazorResources.ParseError_InheritsKeyword_Must_Be_Followed_By_TypeName, + baseType => new SetBaseTypeChunkGenerator(baseType)); } protected void BaseTypeDirective(string noTypeNameError, Func createChunkGenerator) diff --git a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.cs b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.cs index 7d687d49c3..67fafd6a17 100644 --- a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.cs +++ b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.cs @@ -334,7 +334,10 @@ namespace Microsoft.AspNet.Razor.Parser using (PushSpanConfig(span => { - span.EditHandler = new ImplicitExpressionEditHandler(Language.TokenizeString, Keywords, acceptTrailingDot: IsNested); + span.EditHandler = new ImplicitExpressionEditHandler( + Language.TokenizeString, + Keywords, + acceptTrailingDot: IsNested); span.EditHandler.AcceptedCharacters = acceptedCharacters; span.ChunkGenerator = new ExpressionChunkGenerator(); })) diff --git a/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs b/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs index ac6521c6e6..916e8787b4 100644 --- a/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs +++ b/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs @@ -635,17 +635,20 @@ namespace Microsoft.AspNet.Razor.Parser Accept(prefix); // Literal value - // 'quote' should be "Unknown" if not quoted and symbols coming from the tokenizer should never have "Unknown" type. + // 'quote' should be "Unknown" if not quoted and symbols coming from the tokenizer should never have + // "Unknown" type. var value = ReadWhile(sym => - // These three conditions find separators which break the attribute value into portions - sym.Type != HtmlSymbolType.WhiteSpace && - sym.Type != HtmlSymbolType.NewLine && - sym.Type != HtmlSymbolType.Transition && - // This condition checks for the end of the attribute value (it repeats some of the checks above - // but for now that's ok) - !IsEndOfAttributeValue(quote, sym)); + // These three conditions find separators which break the attribute value into portions + sym.Type != HtmlSymbolType.WhiteSpace && + sym.Type != HtmlSymbolType.NewLine && + sym.Type != HtmlSymbolType.Transition && + // This condition checks for the end of the attribute value (it repeats some of the checks above + // but for now that's ok) + !IsEndOfAttributeValue(quote, sym)); Accept(value); - Span.ChunkGenerator = new LiteralAttributeChunkGenerator(prefix.GetContent(prefixStart), value.GetContent(prefixStart)); + Span.ChunkGenerator = new LiteralAttributeChunkGenerator( + prefix.GetContent(prefixStart), + value.GetContent(prefixStart)); } Output(SpanKind.Markup); } diff --git a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Block.cs b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Block.cs index 0e0a2e0ed9..a03f359187 100644 --- a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Block.cs +++ b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Block.cs @@ -45,7 +45,11 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree Children = contents; } - [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "Type is the most appropriate name for this property and there is little chance of confusion with GetType")] + [SuppressMessage( + "Microsoft.Naming", + "CA1721:PropertyNamesShouldNotMatchGetMethods", + Justification = "Type is the most appropriate name for this property and there is little chance of " + + "confusion with GetType")] public BlockType Type { get; } public IEnumerable Children { get; } @@ -105,7 +109,13 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree public override string ToString() { - return string.Format(CultureInfo.CurrentCulture, "{0} Block at {1}::{2} (Gen:{3})", Type, Start, Length, ChunkGenerator); + return string.Format( + CultureInfo.CurrentCulture, + "{0} Block at {1}::{2} (Gen:{3})", + Type, + Start, + Length, + ChunkGenerator); } public override bool Equals(object obj) diff --git a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/BlockBuilder.cs b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/BlockBuilder.cs index 51eb9cd357..5d8696b778 100644 --- a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/BlockBuilder.cs +++ b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/BlockBuilder.cs @@ -21,7 +21,11 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree ChunkGenerator = original.ChunkGenerator; } - [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "Type is the most appropriate name for this property and there is little chance of confusion with GetType")] + [SuppressMessage( + "Microsoft.Naming", + "CA1721:PropertyNamesShouldNotMatchGetMethods", + Justification = "Type is the most appropriate name for this property and there is little chance of " + + "confusion with GetType")] public BlockType? Type { get; set; } public IList Children { get; private set; } public IParentChunkGenerator ChunkGenerator { get; set; } diff --git a/src/Microsoft.AspNet.Razor/RazorCodeLanguage.cs b/src/Microsoft.AspNet.Razor/RazorCodeLanguage.cs index ce046591d2..f0d2f24deb 100644 --- a/src/Microsoft.AspNet.Razor/RazorCodeLanguage.cs +++ b/src/Microsoft.AspNet.Razor/RazorCodeLanguage.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser; namespace Microsoft.AspNet.Razor @@ -14,7 +14,8 @@ namespace Microsoft.AspNet.Razor /// public abstract class RazorCodeLanguage { - private static IDictionary _services = new Dictionary(StringComparer.OrdinalIgnoreCase) + private static IDictionary _services = + new Dictionary(StringComparer.OrdinalIgnoreCase) { { "cshtml", new CSharpRazorCodeLanguage() } }; @@ -52,7 +53,11 @@ namespace Microsoft.AspNet.Razor /// /// Constructs the chunk generator. Must return a new instance on EVERY call to ensure thread-safety /// - public abstract RazorChunkGenerator CreateChunkGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host); + public abstract RazorChunkGenerator CreateChunkGenerator( + string className, + string rootNamespaceName, + string sourceFileName, + RazorEngineHost host); public abstract CodeGenerator CreateCodeGenerator(CodeGeneratorContext chunkGeneratorContext); } diff --git a/src/Microsoft.AspNet.Razor/RazorEngineHost.cs b/src/Microsoft.AspNet.Razor/RazorEngineHost.cs index 8b240a2df7..ba705e3c18 100644 --- a/src/Microsoft.AspNet.Razor/RazorEngineHost.cs +++ b/src/Microsoft.AspNet.Razor/RazorEngineHost.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.Framework.Internal; @@ -36,7 +36,10 @@ namespace Microsoft.AspNet.Razor private int _tabSize = 4; - [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "The code path is safe, it is a property setter and not dependent on other state")] + [SuppressMessage( + "Microsoft.Usage", + "CA2214:DoNotCallOverridableMethodsInConstructors", + Justification = "The code path is safe, it is a property setter and not dependent on other state")] protected RazorEngineHost() { GeneratedClassContext = GeneratedClassContext.Default; diff --git a/src/Microsoft.AspNet.Razor/RazorResources.resx b/src/Microsoft.AspNet.Razor/RazorResources.resx index 12446cda67..2c40a9ee7c 100644 --- a/src/Microsoft.AspNet.Razor/RazorResources.resx +++ b/src/Microsoft.AspNet.Razor/RazorResources.resx @@ -1,17 +1,17 @@ - @@ -375,9 +375,6 @@ Instead, wrap the contents of the block in "{{}}": The tag helper '{0}' must not have C# in the element's attribute declaration area. - - A TagHelperChunkGenerator must only be used with TagHelperBlocks. - Directive '{0}' must have a value. diff --git a/src/Microsoft.AspNet.Razor/RazorTemplateEngine.cs b/src/Microsoft.AspNet.Razor/RazorTemplateEngine.cs index cf01ec7cf8..ee3add4519 100644 --- a/src/Microsoft.AspNet.Razor/RazorTemplateEngine.cs +++ b/src/Microsoft.AspNet.Razor/RazorTemplateEngine.cs @@ -8,7 +8,7 @@ using System.Security.Cryptography; using System.Text; using System.Threading; using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Text; using Microsoft.Framework.Internal; diff --git a/test/Microsoft.AspNet.Razor.Test/CSharpRazorCodeLanguageTest.cs b/test/Microsoft.AspNet.Razor.Test/CSharpRazorCodeLanguageTest.cs index 3f9b01b187..4665b8cf1b 100644 --- a/test/Microsoft.AspNet.Razor.Test/CSharpRazorCodeLanguageTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CSharpRazorCodeLanguageTest.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser; using Xunit; diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AttributeBlockChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/AttributeBlockChunkGeneratorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/AttributeBlockChunkGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/Chunks/Generators/AttributeBlockChunkGeneratorTest.cs diff --git a/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkTreeBuilderTest.cs b/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkTreeBuilderTest.cs similarity index 98% rename from test/Microsoft.AspNet.Razor.Test/Chunks/ChunkTreeBuilderTest.cs rename to test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkTreeBuilderTest.cs index 705c9d6df7..440e71bb05 100644 --- a/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkTreeBuilderTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkTreeBuilderTest.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; using Xunit; -namespace Microsoft.AspNet.Razor.Chunks +namespace Microsoft.AspNet.Razor.Chunks.Generators { public class ChunkTreeBuilderTest { diff --git a/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkVisitorTests.cs b/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkVisitorTests.cs similarity index 90% rename from test/Microsoft.AspNet.Razor.Test/Chunks/ChunkVisitorTests.cs rename to test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkVisitorTests.cs index 0481dda2ea..0ccb0214c0 100644 --- a/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkVisitorTests.cs +++ b/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkVisitorTests.cs @@ -2,13 +2,13 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. #if !DNXCORE50 -using Microsoft.AspNet.Razor.CodeGeneration; -using Microsoft.AspNet.Razor.CodeGeneration.Visitors; +using Microsoft.AspNet.Razor.CodeGenerators; +using Microsoft.AspNet.Razor.CodeGenerators.Visitors; using Moq; using Moq.Protected; using Xunit; -namespace Microsoft.AspNet.Razor.Chunks +namespace Microsoft.AspNet.Razor.Chunks.Generators { public class ChunkVisitorTests { diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AddImportChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/AddImportChunkGeneratorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/AddImportChunkGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/AddImportChunkGeneratorTest.cs diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeGeneratorTest.cs similarity index 97% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeGeneratorTest.cs index 08defe8b43..b591f025eb 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeGeneratorTest.cs @@ -9,7 +9,7 @@ using Microsoft.AspNet.Razor.Test.Utils; using Moq; using Xunit; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CSharpCodeGeneratorTest { diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeWriterTest.cs similarity index 96% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeWriterTest.cs index 85a79789eb..cc58513c77 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeWriterTest.cs @@ -3,7 +3,7 @@ using Xunit; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CSharpCodeWriterTest { diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpLineMappingWriterTest.cs similarity index 98% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpLineMappingWriterTest.cs index 964aebdf12..e348c892a4 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpLineMappingWriterTest.cs @@ -4,7 +4,7 @@ using System; using Xunit; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CSharpLineMappingWriterTest { diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpPaddingBuilderTests.cs similarity index 99% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpPaddingBuilderTests.cs index 6526a77aef..3fa1539859 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpPaddingBuilderTests.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Xunit; diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpRazorChunkGeneratorTest.cs similarity index 98% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpRazorChunkGeneratorTest.cs index d32205c80f..a31a37bb9e 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpRazorChunkGeneratorTest.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Xunit; @@ -33,13 +33,17 @@ namespace Microsoft.AspNet.Razor.Test.Generator [Fact] public void ConstructorRequiresNonNullClassName() { - Assert.Throws("className", () => new RazorChunkGenerator(null, TestRootNamespaceName, TestPhysicalPath, CreateHost())); + Assert.Throws( + "className", + () => new RazorChunkGenerator(null, TestRootNamespaceName, TestPhysicalPath, CreateHost())); } [Fact] public void ConstructorRequiresNonEmptyClassName() { - Assert.Throws("className", () => new RazorChunkGenerator(string.Empty, TestRootNamespaceName, TestPhysicalPath, CreateHost())); + Assert.Throws( + "className", + () => new RazorChunkGenerator(string.Empty, TestRootNamespaceName, TestPhysicalPath, CreateHost())); } [Fact] diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs similarity index 99% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs index 79ecc674e5..8a369b17fc 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs @@ -6,7 +6,7 @@ using System.Linq; #if DNXCORE50 using System.Reflection; #endif -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.TagHelpers; using Xunit; diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingUnitTest.cs similarity index 98% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingUnitTest.cs index 3b7706cbca..a4d051b7f2 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingUnitTest.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using Microsoft.AspNet.Razor.Chunks; using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; -using Microsoft.AspNet.Razor.CodeGeneration.Visitors; +using Microsoft.AspNet.Razor.CodeGenerators; +using Microsoft.AspNet.Razor.CodeGenerators.Visitors; using Microsoft.AspNet.Razor.TagHelpers; using Xunit; diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeGenerator.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeGenTestCodeGenerator.cs similarity index 94% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeGenerator.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeGenTestCodeGenerator.cs index 52cdc7d43d..6457e40aad 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeGenerator.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeGenTestCodeGenerator.cs @@ -1,7 +1,7 @@ // 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 Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; namespace Microsoft.AspNet.Razor.Test.Generator { diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeGenTestHost.cs similarity index 94% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeGenTestHost.cs index 75d6b49d72..cb7e1fdd09 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeGenTestHost.cs @@ -1,7 +1,7 @@ // 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 Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; namespace Microsoft.AspNet.Razor.Test.Generator { diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeWriterTest.cs similarity index 99% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeWriterTest.cs index 2b170c7ed9..210afd00e4 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CodeWriterTest.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Xunit; -namespace Microsoft.AspNet.Razor.CodeGeneration +namespace Microsoft.AspNet.Razor.CodeGenerators { public class CodeWriterTest { diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/DynamicAttributeBlockChunkGeneratorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/DynamicAttributeBlockChunkGeneratorTest.cs diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/LineMappingTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/LineMappingTest.cs similarity index 98% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/LineMappingTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/LineMappingTest.cs index dc24749169..5027a0e2ae 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/LineMappingTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/LineMappingTest.cs @@ -1,7 +1,7 @@ // 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 Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Xunit; namespace Microsoft.AspNet.Razor.Test.Generator diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorChunkGeneratorTest.cs similarity index 92% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorChunkGeneratorTest.cs index 03b7a42aa6..b2bbed4cdd 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorChunkGeneratorTest.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Test.Utils; using Microsoft.AspNet.Testing; using Xunit; @@ -127,7 +127,9 @@ namespace Microsoft.AspNet.Razor.Test.Generator } var sourceLocation = string.Format("TestFiles/CodeGenerator/Source/{0}.{1}", name, FileExtension); - var expectedOutput = TestFile.Create(string.Format("TestFiles/CodeGenerator/Output/{0}.{1}", baselineName, BaselineExtension)).ReadAllText(); + var expectedOutput = TestFile + .Create(string.Format("TestFiles/CodeGenerator/Output/{0}.{1}", baselineName, BaselineExtension)) + .ReadAllText(); // Set up the host and engine var host = CreateHost(); @@ -171,10 +173,19 @@ namespace Microsoft.AspNet.Razor.Test.Generator { var sourceFile = NormalizeNewLines(source); var sourceFileName = generatePragmas ? string.Format("{0}.{1}", name, FileExtension) : null; - results = engine.GenerateCode(sourceFile, className: name, rootNamespace: TestRootNamespaceName, sourceFileName: sourceFileName); + results = engine.GenerateCode( + sourceFile, + className: name, + rootNamespace: TestRootNamespaceName, + sourceFileName: sourceFileName); } // Only called if GENERATE_BASELINES is set, otherwise compiled out. - BaselineWriter.WriteBaseline(string.Format(@"test\Microsoft.AspNet.Razor.Test\TestFiles\ChunkGenerator\Output\{0}.{1}", baselineName, BaselineExtension), results.GeneratedCode); + BaselineWriter.WriteBaseline( + string.Format( + @"test\Microsoft.AspNet.Razor.Test\TestFiles\ChunkGenerator\Output\{0}.{1}", + baselineName, + BaselineExtension), + results.GeneratedCode); #if !GENERATE_BASELINES var textOutput = results.GeneratedCode; diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorCommentChunkGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorCommentChunkGeneratorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorCommentChunkGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/RazorCommentChunkGeneratorTest.cs diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TabTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/TabTest.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/TabTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/TabTest.cs diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/TagHelperAttributeValueCodeRendererTest.cs similarity index 95% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/TagHelperAttributeValueCodeRendererTest.cs index 035565fce2..3468b8f679 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/TagHelperAttributeValueCodeRendererTest.cs @@ -5,8 +5,8 @@ using System; #if DNXCORE50 using System.Reflection; #endif -using Microsoft.AspNet.Razor.CodeGeneration; -using Microsoft.AspNet.Razor.CodeGeneration.Visitors; +using Microsoft.AspNet.Razor.CodeGenerators; +using Microsoft.AspNet.Razor.CodeGenerators.Visitors; using Microsoft.AspNet.Razor.TagHelpers; using Xunit; @@ -58,7 +58,9 @@ namespace Microsoft.AspNet.Razor.Test.Generator GeneratedClassContext = originalHost.GeneratedClassContext; } - public override CodeGenerator DecorateCodeGenerator(CodeGenerator incomingBuilder, CodeGeneratorContext context) + public override CodeGenerator DecorateCodeGenerator( + CodeGenerator incomingBuilder, + CodeGeneratorContext context) { return new AttributeChunkGeneratorReplacingCodeGenerator(context); } diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/TagHelperTestBase.cs similarity index 96% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/TagHelperTestBase.cs index b9e3bdc7b8..a697336306 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/TagHelperTestBase.cs @@ -4,8 +4,8 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNet.Razor.CodeGeneration; -using Microsoft.AspNet.Razor.CodeGeneration.Visitors; +using Microsoft.AspNet.Razor.CodeGenerators; +using Microsoft.AspNet.Razor.CodeGenerators.Visitors; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.TagHelpers; @@ -100,7 +100,9 @@ namespace Microsoft.AspNet.Razor.Test.Generator } - protected override CSharpCodeVisitor CreateCSharpCodeVisitor(CSharpCodeWriter writer, CodeGeneratorContext context) + protected override CSharpCodeVisitor CreateCSharpCodeVisitor( + CSharpCodeWriter writer, + CodeGeneratorContext context) { var visitor = base.CreateCSharpCodeVisitor(writer, context); visitor.TagHelperRenderer = new NoUniqueIdsTagHelperCodeRenderer(visitor, writer, context); diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TestSpan.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/TestSpan.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/CodeGeneration/TestSpan.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGenerators/TestSpan.cs diff --git a/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs b/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs index 8fee4c95c3..99418bc3b7 100644 --- a/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs +++ b/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs @@ -124,7 +124,10 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Markup; - public MarkupBlock(BlockType blockType, IParentChunkGenerator chunkGenerator, IEnumerable children) + public MarkupBlock( + BlockType blockType, + IParentChunkGenerator chunkGenerator, + IEnumerable children) : base(blockType, children, chunkGenerator) { } diff --git a/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs b/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs index d2b0b81cdf..258bbd2a7d 100644 --- a/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs +++ b/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs @@ -19,12 +19,17 @@ namespace Microsoft.AspNet.Razor.Test.Framework public static UnclassifiedCodeSpanConstructor EmptyCSharp(this SpanFactory self) { return new UnclassifiedCodeSpanConstructor( - self.Span(SpanKind.Code, new CSharpSymbol(self.LocationTracker.CurrentLocation, string.Empty, CSharpSymbolType.Unknown))); + self.Span( + SpanKind.Code, + new CSharpSymbol(self.LocationTracker.CurrentLocation, string.Empty, CSharpSymbolType.Unknown))); } public static SpanConstructor EmptyHtml(this SpanFactory self) { - return self.Span(SpanKind.Markup, new HtmlSymbol(self.LocationTracker.CurrentLocation, string.Empty, HtmlSymbolType.Unknown)) + return self + .Span( + SpanKind.Markup, + new HtmlSymbol(self.LocationTracker.CurrentLocation, string.Empty, HtmlSymbolType.Unknown)) .With(new MarkupChunkGenerator()); } @@ -36,7 +41,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework public static SpanConstructor CodeTransition(this SpanFactory self) { - return self.Span(SpanKind.Transition, SyntaxConstants.TransitionString, markup: false).Accepts(AcceptedCharacters.None); + return self + .Span(SpanKind.Transition, SyntaxConstants.TransitionString, markup: false) + .Accepts(AcceptedCharacters.None); } public static SpanConstructor CodeTransition(this SpanFactory self, string content) @@ -46,7 +53,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework public static SpanConstructor CodeTransition(this SpanFactory self, CSharpSymbolType type) { - return self.Span(SpanKind.Transition, SyntaxConstants.TransitionString, type).Accepts(AcceptedCharacters.None); + return self + .Span(SpanKind.Transition, SyntaxConstants.TransitionString, type) + .Accepts(AcceptedCharacters.None); } public static SpanConstructor CodeTransition(this SpanFactory self, string content, CSharpSymbolType type) @@ -56,7 +65,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework public static SpanConstructor MarkupTransition(this SpanFactory self) { - return self.Span(SpanKind.Transition, SyntaxConstants.TransitionString, markup: true).Accepts(AcceptedCharacters.None); + return self + .Span(SpanKind.Transition, SyntaxConstants.TransitionString, markup: true) + .Accepts(AcceptedCharacters.None); } public static SpanConstructor MarkupTransition(this SpanFactory self, string content) @@ -66,7 +77,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework public static SpanConstructor MarkupTransition(this SpanFactory self, HtmlSymbolType type) { - return self.Span(SpanKind.Transition, SyntaxConstants.TransitionString, type).Accepts(AcceptedCharacters.None); + return self + .Span(SpanKind.Transition, SyntaxConstants.TransitionString, type) + .Accepts(AcceptedCharacters.None); } public static SpanConstructor MarkupTransition(this SpanFactory self, string content, HtmlSymbolType type) @@ -241,7 +254,10 @@ namespace Microsoft.AspNet.Razor.Test.Framework return AutoCompleteWith(self, autoCompleteString, atEndOfSpan: false); } - public static SpanConstructor AutoCompleteWith(this SpanConstructor self, string autoCompleteString, bool atEndOfSpan) + public static SpanConstructor AutoCompleteWith( + this SpanConstructor self, + string autoCompleteString, + bool atEndOfSpan) { return self.With(new AutoCompleteEditHandler( SpanConstructor.TestTokenizer, @@ -289,7 +305,8 @@ namespace Microsoft.AspNet.Razor.Test.Framework public SpanConstructor AsImplicitExpression(ISet keywords, bool acceptTrailingDot) { - return _self.With(new ImplicitExpressionEditHandler(SpanConstructor.TestTokenizer, keywords, acceptTrailingDot)) + return _self + .With(new ImplicitExpressionEditHandler(SpanConstructor.TestTokenizer, keywords, acceptTrailingDot)) .With(new ExpressionChunkGenerator()); } diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs index 6aa62d5fea..636a9d21e8 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs @@ -61,37 +61,58 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp [Fact] public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsForKeyword() { - SingleSpanBlockTest("for(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "for(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsForeachKeyword() { - SingleSpanBlockTest("foreach(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "foreach(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsWhileKeyword() { - SingleSpanBlockTest("while(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "while(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsUsingKeywordFollowedByParen() { - SingleSpanBlockTest("using(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "using(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", + BlockType.Statement, + SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSupportsUsingsNestedWithinOtherBlocks() { - SingleSpanBlockTest("if(foo) { using(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); } }", BlockType.Statement, SpanKind.Code); + SingleSpanBlockTest( + "if(foo) { using(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); } }", + BlockType.Statement, + SpanKind.Code); } [Fact] public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches() { - SingleSpanBlockTest("if(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", BlockType.Statement, SpanKind.Code); + SingleSpanBlockTest( + "if(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }", + BlockType.Statement, + SpanKind.Code); } [Fact] @@ -113,31 +134,46 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp [Fact] public void ParseBlockSupportsBlockCommentBetweenIfAndElseClause() { - SingleSpanBlockTest("if(foo) { bar(); } /* Foo */ /* Bar */ else { baz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "if(foo) { bar(); } /* Foo */ /* Bar */ else { baz(); }", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSupportsRazorCommentBetweenIfAndElseClause() { - RunRazorCommentBetweenClausesTest("if(foo) { bar(); } ", " else { baz(); }", acceptedCharacters: AcceptedCharacters.None); + RunRazorCommentBetweenClausesTest( + "if(foo) { bar(); } ", " else { baz(); }", + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSupportsBlockCommentBetweenElseIfAndElseClause() { - SingleSpanBlockTest("if(foo) { bar(); } else if(bar) { baz(); } /* Foo */ /* Bar */ else { biz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "if(foo) { bar(); } else if(bar) { baz(); } /* Foo */ /* Bar */ else { biz(); }", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSupportsRazorCommentBetweenElseIfAndElseClause() { - RunRazorCommentBetweenClausesTest("if(foo) { bar(); } else if(bar) { baz(); } ", " else { baz(); }", acceptedCharacters: AcceptedCharacters.None); + RunRazorCommentBetweenClausesTest( + "if(foo) { bar(); } else if(bar) { baz(); } ", " else { baz(); }", + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSupportsBlockCommentBetweenIfAndElseIfClause() { - SingleSpanBlockTest("if(foo) { bar(); } /* Foo */ /* Bar */ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code); + SingleSpanBlockTest( + "if(foo) { bar(); } /* Foo */ /* Bar */ else if(bar) { baz(); }", + BlockType.Statement, + SpanKind.Code); } [Fact] @@ -228,7 +264,9 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code); const string document = ifStatement + elseIfBranch + elseBranch + elseIfBranch; const string expected = ifStatement + elseIfBranch + elseBranch; - ParseBlockTest(document, new StatementBlock(Factory.Code(expected).AsStatement().Accepts(AcceptedCharacters.None))); + ParseBlockTest( + document, + new StatementBlock(Factory.Code(expected).AsStatement().Accepts(AcceptedCharacters.None))); } [Fact] @@ -244,7 +282,8 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code); [Fact] public void ParseBlockAcceptsElseIfWithNoCondition() { - // We don't want to be a full C# parser - If the else if is missing it's condition, the C# compiler can handle that, we have all the info we need to keep parsing + // We don't want to be a full C# parser - If the else if is missing it's condition, the C# compiler + // can handle that, we have all the info we need to keep parsing const string ifBranch = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) { Debug.WriteLine(@""foo } bar""); }"; @@ -257,7 +296,11 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code); [Fact] public void ParseBlockCorrectlyParsesDoWhileBlock() { - SingleSpanBlockTest("do { var foo = bar; } while(foo != bar);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "do { var foo = bar; } while(foo != bar);", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] @@ -275,7 +318,11 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code); [Fact] public void ParseBlockCorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon() { - SingleSpanBlockTest("do { var foo = bar; } while;", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "do { var foo = bar; } while;", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] @@ -287,7 +334,11 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code); [Fact] public void ParseBlockSupportsBlockCommentBetweenDoAndWhileClause() { - SingleSpanBlockTest("do { var foo = bar; } /* Foo */ /* Bar */ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "do { var foo = bar; } /* Foo */ /* Bar */ while(true);", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] @@ -302,7 +353,9 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC [Fact] public void ParseBlockSupportsRazorCommentBetweenDoAndWhileClause() { - RunRazorCommentBetweenClausesTest("do { var foo = bar; } ", " while(true);", acceptedCharacters: AcceptedCharacters.None); + RunRazorCommentBetweenClausesTest( + "do { var foo = bar; } ", " while(true);", + acceptedCharacters: AcceptedCharacters.None); } [Fact] @@ -343,25 +396,40 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC [Fact] public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsLockKeyword() { - SingleSpanBlockTest("lock(foo) { Debug.WriteLine(@\"foo } bar\"); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "lock(foo) { Debug.WriteLine(@\"foo } bar\"); }", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockHasErrorsIfNamespaceImportMissingSemicolon() { - NamespaceImportTest("using Foo.Bar.Baz", " Foo.Bar.Baz", acceptedCharacters: AcceptedCharacters.NonWhiteSpace | AcceptedCharacters.WhiteSpace, location: new SourceLocation(17, 0, 17)); + NamespaceImportTest( + "using Foo.Bar.Baz", + " Foo.Bar.Baz", + acceptedCharacters: AcceptedCharacters.NonWhiteSpace | AcceptedCharacters.WhiteSpace, + location: new SourceLocation(17, 0, 17)); } [Fact] public void ParseBlockHasErrorsIfNamespaceAliasMissingSemicolon() { - NamespaceImportTest("using Foo.Bar.Baz = FooBarBaz", " Foo.Bar.Baz = FooBarBaz", acceptedCharacters: AcceptedCharacters.NonWhiteSpace | AcceptedCharacters.WhiteSpace, location: new SourceLocation(29, 0, 29)); + NamespaceImportTest( + "using Foo.Bar.Baz = FooBarBaz", + " Foo.Bar.Baz = FooBarBaz", + acceptedCharacters: AcceptedCharacters.NonWhiteSpace | AcceptedCharacters.WhiteSpace, + location: new SourceLocation(29, 0, 29)); } [Fact] public void ParseBlockParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat() { - NamespaceImportTest("using Foo.Bar.Baz;", " Foo.Bar.Baz", AcceptedCharacters.NonWhiteSpace | AcceptedCharacters.WhiteSpace); + NamespaceImportTest( + "using Foo.Bar.Baz;", + " Foo.Bar.Baz", + AcceptedCharacters.NonWhiteSpace | AcceptedCharacters.WhiteSpace); } [Fact] @@ -377,7 +445,10 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC [Fact] public void ParseBlockParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat() { - NamespaceImportTest("using FooBarBaz = FooBarBaz;", " FooBarBaz = FooBarBaz", AcceptedCharacters.NonWhiteSpace | AcceptedCharacters.WhiteSpace); + NamespaceImportTest( + "using FooBarBaz = FooBarBaz;", + " FooBarBaz = FooBarBaz", + AcceptedCharacters.NonWhiteSpace | AcceptedCharacters.WhiteSpace); } [Fact] @@ -390,17 +461,29 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC public void ParseBlockTerminatesSingleLineCommentAtEndOfFile() { const string document = "foreach(var f in Foo) { // foo bar baz"; - SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code, - new RazorError(RazorResources.FormatParseError_Expected_EndOfBlock_Before_EOF("foreach", '}', '{'), SourceLocation.Zero)); + SingleSpanBlockTest( + document, + document, + BlockType.Statement, + SpanKind.Code, + new RazorError( + RazorResources.FormatParseError_Expected_EndOfBlock_Before_EOF("foreach", '}', '{'), + SourceLocation.Zero)); } [Fact] public void ParseBlockTerminatesBlockCommentAtEndOfFile() { const string document = "foreach(var f in Foo) { /* foo bar baz"; - SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code, - new RazorError(RazorResources.ParseError_BlockComment_Not_Terminated, 24, 0, 24), - new RazorError(RazorResources.FormatParseError_Expected_EndOfBlock_Before_EOF("foreach", '}', '{'), SourceLocation.Zero)); + SingleSpanBlockTest( + document, + document, + BlockType.Statement, + SpanKind.Code, + new RazorError(RazorResources.ParseError_BlockComment_Not_Terminated, 24, 0, 24), + new RazorError( + RazorResources.FormatParseError_Expected_EndOfBlock_Before_EOF("foreach", '}', '{'), + SourceLocation.Zero)); } [Fact] @@ -426,13 +509,19 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC [Fact] public void ParseBlockSupportsBlockCommentBetweenCatchAndFinallyClause() { - SingleSpanBlockTest("try { bar(); } catch(bar) { baz(); } /* Foo */ /* Bar */ finally { biz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None); + SingleSpanBlockTest( + "try { bar(); } catch(bar) { baz(); } /* Foo */ /* Bar */ finally { biz(); }", + BlockType.Statement, + SpanKind.Code, + acceptedCharacters: AcceptedCharacters.None); } [Fact] public void ParseBlockSupportsRazorCommentBetweenCatchAndFinallyClause() { - RunRazorCommentBetweenClausesTest("try { bar(); } catch(bar) { baz(); } ", " finally { biz(); }", acceptedCharacters: AcceptedCharacters.None); + RunRazorCommentBetweenClausesTest( + "try { bar(); } catch(bar) { baz(); } ", " finally { biz(); }", + acceptedCharacters: AcceptedCharacters.None); } [Fact] @@ -519,7 +608,11 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); [Fact] public void ParseBlockSupportsTryStatementWithMultipleCatchClause() { - SingleSpanBlockTest("try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }", BlockType.Statement, SpanKind.Code); + SingleSpanBlockTest( + "try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) " + + "{ var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }", + BlockType.Statement, + SpanKind.Code); } [Fact] @@ -532,7 +625,8 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); public void ParseBlockSupportsMarkupWithinAdditionalCatchClauses() { RunSimpleWrappedMarkupTest( - prefix: "try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) {", + prefix: "try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) " + + "{ var foo = new { } } catch(Foo Bar Baz) {", markup: "

Foo

", suffix: "}", expectedMarkup: new MarkupBlock( diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/PartialParsing/PartialParsingTestBase.cs b/test/Microsoft.AspNet.Razor.Test/Parser/PartialParsing/PartialParsingTestBase.cs index 99f6f55fe2..b3e27e4848 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/PartialParsing/PartialParsingTestBase.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/PartialParsing/PartialParsingTestBase.cs @@ -4,7 +4,7 @@ using System; using System.Threading; using System.Web.WebPages.TestUtils; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Utils; diff --git a/test/Microsoft.AspNet.Razor.Test/RazorEngineHostTest.cs b/test/Microsoft.AspNet.Razor.Test/RazorEngineHostTest.cs index 2751acb16b..27566ef0e6 100644 --- a/test/Microsoft.AspNet.Razor.Test/RazorEngineHostTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/RazorEngineHostTest.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser; using Xunit; diff --git a/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs b/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs index f750a03a77..60f3b9caa3 100644 --- a/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading; using System.Web.WebPages.TestUtils; using Microsoft.AspNet.Razor.Chunks.Generators; -using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Text; using Moq;