From 5df9b52afe84aacf08a279aceb5701dc54965877 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 21 May 2015 16:39:17 -0700 Subject: [PATCH] Renamed and moved several Razor classes for clarity. - Renamed CodeGenerators to ChunkGenerators. - Updated location of TestFiles from TestFiles/CodeGenerator/CS/{Output|Source} => TestFiles/CodeGenerator/{Output|Source}. - Removed ChunkTree test; it was a legacy test used to experiment with Razor rendering (not a real test). - Removed CSharpRazorCodeGenerator; it's now replaced with RazorCodeGenerator. It was an empty class that did nothing. - Updated ChunkBlock => ParentChunk. Also updated several patterns throughout the code base that referenced these blocks as blocks and not parents. - Moved Chunks and ChunkGenerators into the Chunks/Chunks.Generators namespace/folder structure. Updated test project to reflect the same. - Moved CodeBuilders and CodeVisitors to the CodeGeneration/CodeGeneration.Visitors namespace/folder structure. Updated test project to reflect the same. - Moved several TagHelper assets outside of their own namespaces and into Razors more general structures; such as CodeGeneration and Chunks/Chunks.Generators. #140 --- .../CSharpRazorCodeLanguage.cs | 11 +- .../AddTagHelperChunk.cs | 2 +- .../Compiler/CodeTree => }/Chunks/Chunk.cs | 2 +- .../CodeTree.cs => Chunks/ChunkTree.cs} | 6 +- .../ChunkTreeBuilder.cs} | 42 +-- .../Chunks/CodeAttributeChunk.cs | 4 +- .../Chunks/DynamicCodeAttributeChunk.cs | 4 +- .../Chunks/ExpressionBlockChunk.cs | 4 +- .../CodeTree => }/Chunks/ExpressionChunk.cs | 2 +- .../Generators/AddImportChunkGenerator.cs} | 12 +- .../AddOrRemoveTagHelperChunkGenerator.cs} | 32 +- .../AttributeBlockChunkGenerator.cs} | 17 +- .../Generators/ChunkGeneratorContext.cs | 44 +++ .../DynamicAttributeBlockChunkGenerator.cs} | 19 +- .../Generators/ExpressionChunkGenerator.cs} | 19 +- .../Chunks/Generators/HybridChunkGenerator.cs | 22 ++ .../Generators/IParentChunkGenerator.cs | 13 + .../Generators/ISpanChunkGenerator.cs} | 6 +- .../LiteralAttributeChunkGenerator.cs} | 21 +- .../Generators/MarkupChunkGenerator.cs} | 8 +- .../Generators/ParentChunkGenerator.cs} | 18 +- .../Generators/RazorChunkGenerator.cs} | 20 +- .../Generators/RazorCommentChunkGenerator.cs} | 4 +- .../Generators/ResolveUrlChunkGenerator.cs} | 12 +- .../Generators/SectionChunkGenerator.cs} | 17 +- .../Generators/SetBaseTypeChunkGenerator.cs} | 12 +- .../Generators/SpanChunkGenerator.cs} | 14 +- .../Generators/StatementChunkGenerator.cs} | 8 +- .../Generators/TagHelperChunkGenerator.cs} | 47 ++- ...TagHelperPrefixDirectiveChunkGenerator.cs} | 24 +- .../Generators/TemplateBlockChunkGenerator.cs | 20 ++ .../Generators/TypeMemberChunkGenerator.cs} | 8 +- .../CodeTree => }/Chunks/LiteralChunk.cs | 2 +- .../Chunks/LiteralCodeAttributeChunk.cs | 4 +- .../ChunkBlock.cs => Chunks/ParentChunk.cs} | 6 +- .../RemoveTagHelperChunk.cs | 2 +- .../CodeTree => }/Chunks/ResolveUrlChunk.cs | 2 +- .../CodeTree => }/Chunks/SectionChunk.cs | 4 +- .../CodeTree => }/Chunks/SetBaseTypeChunk.cs | 2 +- .../CodeTree => }/Chunks/StatementChunk.cs | 2 +- .../TagHelpers => Chunks}/TagHelperChunk.cs | 6 +- .../TagHelperPrefixDirectiveChunk.cs | 2 +- .../CodeTree => }/Chunks/TemplateChunk.cs | 4 +- .../CodeTree => }/Chunks/TypeMemberChunk.cs | 2 +- .../CodeTree => }/Chunks/UsingChunk.cs | 2 +- .../CSharpCodeBuilder.cs | 10 +- .../CSharpCodeWriter.cs | 7 +- .../CSharpCodeWritingScope.cs | 2 +- .../CSharpDisableWarningScope.cs | 2 +- .../CSharpLineMappingWriter.cs | 2 +- .../CSharpPaddingBuilder.cs | 2 +- .../CSharpTagHelperCodeRenderer.cs | 10 +- .../CodeBuilder.cs | 2 +- .../CodeBuilderContext.cs | 18 +- .../CodeBuilderResult.cs | 2 +- .../CodeWriter.cs | 10 +- .../ExpressionRenderingMode.cs | 6 +- .../GeneratedClassContext.cs | 2 +- .../GeneratedTagHelperContext.cs | 2 +- .../LineMapping.cs | 2 +- .../LineMappingManager.cs | 2 +- .../MappingLocation.cs | 2 +- .../Visitors/CSharpBaseTypeVisitor.cs | 3 +- .../Visitors/CSharpCodeVisitor.cs | 5 +- .../CSharpDesignTimeHelpersVisitor.cs | 5 +- .../CSharpTagHelperAttributeValueVisitor.cs | 9 +- .../CSharpTagHelperFieldDeclarationVisitor.cs | 19 +- ...arpTagHelperRunnerInitializationVisitor.cs | 3 +- .../Visitors/CSharpTypeMemberVisitor.cs | 3 +- .../Visitors/CSharpUsingVisitor.cs | 3 +- .../Visitors}/ChunkVisitor.cs | 9 +- .../Visitors}/CodeVisitor.cs | 5 +- .../Visitors}/IChunkVisitor.cs | 3 +- .../DocumentParseCompleteEventArgs.cs | 6 +- .../Generator/CSharpRazorCodeGenerator.cs | 24 -- .../Generator/CodeGeneratorContext.cs | 44 --- .../Generator/HybridCodeGenerator.cs | 22 -- .../Generator/IBlockCodeGenerator.cs | 13 - .../Generator/TemplateBlockCodeGenerator.cs | 21 -- .../GeneratorResults.cs | 19 +- .../Parser/CSharpCodeParser.Directives.cs | 34 +- .../Parser/CSharpCodeParser.Statements.cs | 10 +- .../Parser/CSharpCodeParser.cs | 34 +- .../Parser/ConditionalAttributeCollapser.cs | 10 +- .../Parser/HtmlMarkupParser.Block.cs | 45 +-- .../Parser/HtmlMarkupParser.cs | 8 +- .../Parser/MarkupCollapser.cs | 4 +- .../Parser/SyntaxTree/Block.cs | 20 +- .../Parser/SyntaxTree/BlockBuilder.cs | 8 +- .../Parser/SyntaxTree/Span.cs | 10 +- .../Parser/SyntaxTree/SpanBuilder.cs | 8 +- .../Parser/TagHelpers/TagHelperBlock.cs | 6 +- .../TagHelpers/TagHelperBlockBuilder.cs | 6 +- .../TagHelpers/TagHelperBlockRewriter.cs | 44 +-- .../TagHelperDirectiveSpanVisitor.cs | 20 +- .../TagHelpers/TagHelperParseTreeRewriter.cs | 2 +- .../Parser/TokenizerBackedParser.Helpers.cs | 6 +- .../Properties/RazorResources.Designer.cs | 4 +- .../RazorCodeLanguage.cs | 10 +- src/Microsoft.AspNet.Razor/RazorEngineHost.cs | 28 +- .../RazorResources.resx | 2 +- .../RazorTemplateEngine.cs | 14 +- .../TagHelperAttributeValueCodeRenderer.cs | 6 +- .../CSharpRazorCodeLanguageTest.cs | 11 +- .../CSharpCodeBuilderTests.cs | 16 +- .../ChunkTreeBuilderTest.cs} | 53 ++- .../CodeTree => Chunks}/ChunkVisitorTests.cs | 6 +- .../AddImportChunkGeneratorTest.cs} | 50 +-- .../AttributeBlockChunkGeneratorTest.cs} | 62 ++-- .../CSharpCodeWriterTest.cs | 2 +- .../CSharpLineMappingWriterTest.cs | 2 +- .../CSharpPaddingBuilderTests.cs | 2 +- .../CSharpRazorChunkGeneratorTest.cs} | 72 ++-- .../CSharpTagHelperRenderingTest.cs | 6 +- .../CSharpTagHelperRenderingUnitTest.cs | 9 +- .../CodeGenTestCodeBuilder.cs | 8 +- .../CodeGenTestHost.cs | 4 +- .../CodeWriterTest.cs | 2 +- ...ynamicAttributeBlockChunkGeneratorTest.cs} | 56 +-- .../LineMappingTest.cs | 2 +- .../RazorChunkGeneratorTest.cs} | 10 +- .../RazorCommentChunkGeneratorTest.cs | 92 +++++ .../{Generator => CodeGeneration}/TabTest.cs | 0 ...TagHelperAttributeValueCodeRendererTest.cs | 15 +- .../TagHelperTestBase.cs | 7 +- .../{Generator => CodeGeneration}/TestSpan.cs | 0 .../Framework/BlockTypes.cs | 104 +++--- .../Framework/ParserTestBase.cs | 12 +- .../Framework/TestSpanBuilder.cs | 46 +-- .../CodeTree/CodeTreeGenerationTest.cs | 18 - .../RazorCommentCodeGeneratorTest.cs | 92 ----- .../Parser/BlockTest.cs | 10 +- .../Parser/CSharp/CSharpAutoCompleteTest.cs | 8 +- .../Parser/CSharp/CSharpBlockTest.cs | 198 +++++----- .../Parser/CSharp/CSharpDirectivesTest.cs | 4 +- .../Parser/CSharp/CSharpSectionTest.cs | 72 ++-- .../Parser/CSharp/CSharpStatementTest.cs | 4 +- .../Parser/CSharp/CSharpTemplateTest.cs | 12 +- .../Parser/CSharp/CSharpToMarkupSwitchTest.cs | 6 +- .../Parser/Html/HtmlAttributeTest.cs | 106 +++--- .../Parser/Html/HtmlBlockTest.cs | 52 +-- .../Parser/Html/HtmlDocumentTest.cs | 204 +++++------ .../Parser/Html/HtmlErrorTest.cs | 8 +- .../Parser/Html/HtmlToCodeSwitchTest.cs | 24 +- .../Parser/Html/HtmlUrlAttributeTest.cs | 136 +++---- .../PartialParsing/PartialParsingTestBase.cs | 19 +- .../RazorEngineHostTest.cs | 9 +- .../RazorTemplateEngineTest.cs | 14 +- .../TagHelperDirectiveSpanVisitorTest.cs | 8 +- .../TagHelperParseTreeRewriterTest.cs | 340 +++++++++--------- .../CodeGenerator/CS/Output/CodeTree.cs | 25 -- .../CodeGenerator/CS/Source/CodeTree.cshtml | 1 - .../{CS => }/Output/AddTagHelperDirective.cs | 0 ...AttributeTargetingTagHelpers.DesignTime.cs | 0 .../Output/AttributeTargetingTagHelpers.cs | 0 .../{CS => }/Output/Await.DesignTime.cs | 0 .../CodeGenerator/{CS => }/Output/Await.cs | 0 ...cTagHelpers.CustomAttributeCodeBuilder.cs} | 0 .../Output/BasicTagHelpers.DesignTime.cs | 0 .../BasicTagHelpers.Prefixed.DesignTime.cs | 0 .../Output/BasicTagHelpers.Prefixed.cs | 0 .../Output/BasicTagHelpers.RemoveTagHelper.cs | 0 .../{CS => }/Output/BasicTagHelpers.cs | 0 .../CodeGenerator/{CS => }/Output/Blocks.cs | 0 .../{CS => }/Output/CSharpCodeBuilder.cs | 0 .../{CS => }/Output/CodeBlock.cs | 0 .../{CS => }/Output/CodeBlockAtEOF.cs | 0 .../Output/CodeBlockWithTextElement.cs | 0 .../Output/ComplexTagHelpers.DesignTime.cs | 0 .../{CS => }/Output/ComplexTagHelpers.cs | 0 .../ConditionalAttributes.DesignTime.cs | 0 .../{CS => }/Output/ConditionalAttributes.cs | 0 .../{CS => }/Output/DesignTime.cs | 0 .../Output/DuplicateTargetTagHelper.cs | 0 .../EmptyAttributeTagHelpers.DesignTime.cs | 0 .../Output/EmptyAttributeTagHelpers.cs | 0 .../{CS => }/Output/EmptyCodeBlock.cs | 0 .../Output/EmptyExplicitExpression.cs | 0 .../Output/EmptyImplicitExpression.cs | 0 .../EmptyImplicitExpressionInCode.Tabs.cs | 0 .../Output/EmptyImplicitExpressionInCode.cs | 0 .../Output/EscapedTagHelpers.DesignTime.cs | 0 .../{CS => }/Output/EscapedTagHelpers.cs | 0 .../{CS => }/Output/ExplicitExpression.cs | 0 .../Output/ExplicitExpressionAtEOF.cs | 0 .../{CS => }/Output/ExpressionsInCode.cs | 0 .../Output/FunctionsBlock.DesignTime.Tabs.cs | 0 .../Output/FunctionsBlock.DesignTime.cs | 0 .../{CS => }/Output/FunctionsBlock.cs | 0 .../FunctionsBlockMinimal.DesignTime.Tabs.cs | 0 .../{CS => }/Output/FunctionsBlock_Tabs.cs | 0 .../{CS => }/Output/HiddenSpansInCode.cs | 0 .../Output/HtmlCommentWithQuote_Double.cs | 0 .../Output/HtmlCommentWithQuote_Single.cs | 0 .../{CS => }/Output/ImplicitExpression.cs | 0 .../Output/ImplicitExpressionAtEOF.cs | 0 .../{CS => }/Output/Imports.DesignTime.cs | 0 .../CodeGenerator/{CS => }/Output/Imports.cs | 0 .../{CS => }/Output/Inherits.Designtime.cs | 0 .../{CS => }/Output/Inherits.Runtime.cs | 0 .../{CS => }/Output/InlineBlocks.cs | 0 .../{CS => }/Output/Instrumented.cs | 0 .../{CS => }/Output/MarkupInCodeBlock.cs | 0 .../Output/MinimizedTagHelpers.DesignTime.cs | 0 .../{CS => }/Output/MinimizedTagHelpers.cs | 0 .../{CS => }/Output/NestedCodeBlocks.cs | 0 .../{CS => }/Output/NoLinePragmas.cs | 0 .../NullConditionalExpressions.DesignTime.cs | 0 .../Output/NullConditionalExpressions.cs | 0 .../Output/OpenedIf.DesignTime.Tabs.cs | 0 .../{CS => }/Output/OpenedIf.DesignTime.cs | 0 .../{CS => }/Output/ParserError.cs | 0 .../PrefixedAttributeTagHelpers.DesignTime.cs | 0 .../PrefixedAttributeTagHelpers.Reversed.cs | 0 .../Output/PrefixedAttributeTagHelpers.cs | 0 .../Output/RazorComments.DesignTime.cs | 0 .../{CS => }/Output/RazorComments.cs | 0 .../Output/RemoveTagHelperDirective.cs | 0 .../{CS => }/Output/ResolveUrl.cs | 0 .../CodeGenerator/{CS => }/Output/Sections.cs | 0 .../SimpleUnspacedIf.DesignTime.Tabs.cs | 0 .../Output/SingleTagHelper.DesignTime.cs | 0 .../{CS => }/Output/SingleTagHelper.cs | 0 .../{CS => }/Output/TagHelpersInSection.cs | 0 .../{CS => }/Output/Templates.cs | 0 .../Output/UnfinishedExpressionInCode.Tabs.cs | 0 .../Output/UnfinishedExpressionInCode.cs | 0 .../Source/AddTagHelperDirective.cshtml | 0 .../AttributeTargetingTagHelpers.cshtml | 0 .../{CS => }/Source/Await.cshtml | 0 .../Source/BasicTagHelpers.Prefixed.cshtml | 0 .../BasicTagHelpers.RemoveTagHelper.cshtml | 0 .../{CS => }/Source/BasicTagHelpers.cshtml | 0 .../{CS => }/Source/Blocks.cshtml | 0 .../{CS => }/Source/CodeBlock.cshtml | 0 .../{CS => }/Source/CodeBlockAtEOF.cshtml | 0 .../Source/CodeBlockWithTextElement.cshtml | 0 .../{CS => }/Source/ComplexTagHelpers.cshtml | 0 .../Source/ConditionalAttributes.cshtml | 0 .../{CS => }/Source/DesignTime.cshtml | 0 .../Source/DuplicateTargetTagHelper.cshtml | 0 .../Source/EmptyAttributeTagHelpers.cshtml | 0 .../{CS => }/Source/EmptyCodeBlock.cshtml | 0 .../Source/EmptyExplicitExpression.cshtml | 0 .../Source/EmptyImplicitExpression.cshtml | 0 .../EmptyImplicitExpressionInCode.cshtml | 0 .../{CS => }/Source/EscapedTagHelpers.cshtml | 0 .../{CS => }/Source/ExplicitExpression.cshtml | 0 .../Source/ExplicitExpressionAtEOF.cshtml | 0 .../{CS => }/Source/ExpressionsInCode.cshtml | 0 .../{CS => }/Source/FunctionsBlock.cshtml | 0 .../Source/FunctionsBlockMinimal.cshtml | 0 .../Source/FunctionsBlock_Tabs.cshtml | 0 .../{CS => }/Source/HiddenSpansInCode.cshtml | 0 .../Source/HtmlCommentWithQuote_Double.cshtml | 0 .../Source/HtmlCommentWithQuote_Single.cshtml | 0 .../{CS => }/Source/ImplicitExpression.cshtml | 0 .../Source/ImplicitExpressionAtEOF.cshtml | 0 .../{CS => }/Source/Imports.cshtml | 0 .../{CS => }/Source/Inherits.cshtml | 0 .../{CS => }/Source/InlineBlocks.cshtml | 0 .../{CS => }/Source/Instrumented.cshtml | 0 .../{CS => }/Source/MarkupInCodeBlock.cshtml | 0 .../Source/MinimizedTagHelpers.cshtml | 0 .../{CS => }/Source/NestedCodeBlocks.cshtml | 0 .../{CS => }/Source/NoLinePragmas.cshtml | 0 .../Source/NullConditionalExpressions.cshtml | 0 .../{CS => }/Source/OpenedIf.cshtml | 0 .../{CS => }/Source/ParserError.cshtml | 0 .../Source/PrefixedAttributeTagHelpers.cshtml | 0 .../{CS => }/Source/RazorComments.cshtml | 0 .../Source/RemoveTagHelperDirective.cshtml | 0 .../{CS => }/Source/ResolveUrl.cshtml | 0 .../{CS => }/Source/Sections.cshtml | 0 .../{CS => }/Source/SimpleUnspacedIf.cshtml | 0 .../{CS => }/Source/SingleTagHelper.cshtml | 0 .../Source/TagHelpersInSection.cshtml | 0 .../{CS => }/Source/Templates.cshtml | 0 .../Source/UnfinishedExpressionInCode.cshtml | 0 279 files changed, 1569 insertions(+), 1622 deletions(-) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree/Chunks/TagHelpers => Chunks}/AddTagHelperChunk.cs (90%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/Chunk.cs (87%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree/CodeTree.cs => Chunks/ChunkTree.cs} (75%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree/CodeTreeBuilder.cs => Chunks/ChunkTreeBuilder.cs} (78%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/CodeAttributeChunk.cs (79%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/DynamicCodeAttributeChunk.cs (72%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/ExpressionBlockChunk.cs (64%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/ExpressionChunk.cs (87%) rename src/Microsoft.AspNet.Razor/{Generator/AddImportCodeGenerator.cs => Chunks/Generators/AddImportChunkGenerator.cs} (73%) rename src/Microsoft.AspNet.Razor/{Generator/TagHelpers/AddOrRemoveTagHelperCodeGenerator.cs => Chunks/Generators/AddOrRemoveTagHelperChunkGenerator.cs} (50%) rename src/Microsoft.AspNet.Razor/{Generator/AttributeBlockCodeGenerator.cs => Chunks/Generators/AttributeBlockChunkGenerator.cs} (68%) create mode 100644 src/Microsoft.AspNet.Razor/Chunks/Generators/ChunkGeneratorContext.cs rename src/Microsoft.AspNet.Razor/{Generator/DynamicAttributeBlockCodeGenerator.cs => Chunks/Generators/DynamicAttributeBlockChunkGenerator.cs} (58%) rename src/Microsoft.AspNet.Razor/{Generator/ExpressionCodeGenerator.cs => Chunks/Generators/ExpressionChunkGenerator.cs} (50%) create mode 100644 src/Microsoft.AspNet.Razor/Chunks/Generators/HybridChunkGenerator.cs create mode 100644 src/Microsoft.AspNet.Razor/Chunks/Generators/IParentChunkGenerator.cs rename src/Microsoft.AspNet.Razor/{Generator/ISpanCodeGenerator.cs => Chunks/Generators/ISpanChunkGenerator.cs} (58%) rename src/Microsoft.AspNet.Razor/{Generator/LiteralAttributeCodeGenerator.cs => Chunks/Generators/LiteralAttributeChunkGenerator.cs} (68%) rename src/Microsoft.AspNet.Razor/{Generator/MarkupCodeGenerator.cs => Chunks/Generators/MarkupChunkGenerator.cs} (55%) rename src/Microsoft.AspNet.Razor/{Generator/BlockCodeGenerator.cs => Chunks/Generators/ParentChunkGenerator.cs} (54%) rename src/Microsoft.AspNet.Razor/{Generator/RazorCodeGenerator.cs => Chunks/Generators/RazorChunkGenerator.cs} (79%) rename src/Microsoft.AspNet.Razor/{Generator/RazorCommentCodeGenerator.cs => Chunks/Generators/RazorCommentChunkGenerator.cs} (61%) rename src/Microsoft.AspNet.Razor/{Generator/ResolveUrlCodeGenerator.cs => Chunks/Generators/ResolveUrlChunkGenerator.cs} (55%) rename src/Microsoft.AspNet.Razor/{Generator/SectionCodeGenerator.cs => Chunks/Generators/SectionChunkGenerator.cs} (60%) rename src/Microsoft.AspNet.Razor/{Generator/SetBaseTypeCodeGenerator.cs => Chunks/Generators/SetBaseTypeChunkGenerator.cs} (65%) rename src/Microsoft.AspNet.Razor/{Generator/SpanCodeGenerator.cs => Chunks/Generators/SpanChunkGenerator.cs} (61%) rename src/Microsoft.AspNet.Razor/{Generator/StatementCodeGenerator.cs => Chunks/Generators/StatementChunkGenerator.cs} (55%) rename src/Microsoft.AspNet.Razor/{Generator/TagHelperCodeGenerator.cs => Chunks/Generators/TagHelperChunkGenerator.cs} (63%) rename src/Microsoft.AspNet.Razor/{Generator/TagHelpers/TagHelperPrefixDirectiveCodeGenerator.cs => Chunks/Generators/TagHelperPrefixDirectiveChunkGenerator.cs} (52%) create mode 100644 src/Microsoft.AspNet.Razor/Chunks/Generators/TemplateBlockChunkGenerator.cs rename src/Microsoft.AspNet.Razor/{Generator/TypeMemberCodeGenerator.cs => Chunks/Generators/TypeMemberChunkGenerator.cs} (55%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/LiteralChunk.cs (87%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/LiteralCodeAttributeChunk.cs (80%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree/Chunks/ChunkBlock.cs => Chunks/ParentChunk.cs} (74%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree/Chunks/TagHelpers => Chunks}/RemoveTagHelperChunk.cs (92%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/ResolveUrlChunk.cs (83%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/SectionChunk.cs (70%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/SetBaseTypeChunk.cs (83%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/StatementChunk.cs (87%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree/Chunks/TagHelpers => Chunks}/TagHelperChunk.cs (92%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree/Chunks/TagHelpers => Chunks}/TagHelperPrefixDirectiveChunk.cs (91%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/TemplateChunk.cs (65%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/TypeMemberChunk.cs (83%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeTree => }/Chunks/UsingChunk.cs (83%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/CSharpCodeBuilder.cs (92%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/CSharpCodeWriter.cs (98%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/CSharpCodeWritingScope.cs (97%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/CSharpDisableWarningScope.cs (93%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/CSharpLineMappingWriter.cs (98%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/CSharpPaddingBuilder.cs (99%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/CSharpTagHelperCodeRenderer.cs (98%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder => CodeGeneration}/CodeBuilder.cs (91%) rename src/Microsoft.AspNet.Razor/{Generator => CodeGeneration}/CodeBuilderContext.cs (80%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder => CodeGeneration}/CodeBuilderResult.cs (91%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder => CodeGeneration}/CodeWriter.cs (97%) rename src/Microsoft.AspNet.Razor/{Generator => CodeGeneration}/ExpressionRenderingMode.cs (75%) rename src/Microsoft.AspNet.Razor/{Generator => CodeGeneration}/GeneratedClassContext.cs (99%) rename src/Microsoft.AspNet.Razor/{Generator => CodeGeneration}/GeneratedTagHelperContext.cs (99%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/LineMappings => CodeGeneration}/LineMapping.cs (97%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/LineMappings => CodeGeneration}/LineMappingManager.cs (92%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/LineMappings => CodeGeneration}/MappingLocation.cs (98%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/Visitors/CSharpBaseTypeVisitor.cs (87%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/Visitors/CSharpCodeVisitor.cs (99%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/Visitors/CSharpDesignTimeHelpersVisitor.cs (96%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/Visitors/CSharpTagHelperAttributeValueVisitor.cs (96%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs (84%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs (95%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/Visitors/CSharpTypeMemberVisitor.cs (90%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder/CSharp => CodeGeneration}/Visitors/CSharpUsingVisitor.cs (96%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder => CodeGeneration/Visitors}/ChunkVisitor.cs (94%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder => CodeGeneration/Visitors}/CodeVisitor.cs (92%) rename src/Microsoft.AspNet.Razor/{Generator/Compiler/CodeBuilder => CodeGeneration/Visitors}/IChunkVisitor.cs (77%) delete mode 100644 src/Microsoft.AspNet.Razor/Generator/CSharpRazorCodeGenerator.cs delete mode 100644 src/Microsoft.AspNet.Razor/Generator/CodeGeneratorContext.cs delete mode 100644 src/Microsoft.AspNet.Razor/Generator/HybridCodeGenerator.cs delete mode 100644 src/Microsoft.AspNet.Razor/Generator/IBlockCodeGenerator.cs delete mode 100644 src/Microsoft.AspNet.Razor/Generator/TemplateBlockCodeGenerator.cs rename test/Microsoft.AspNet.Razor.Test/{Generator/CodeTree => Chunks}/CSharpCodeBuilderTests.cs (70%) rename test/Microsoft.AspNet.Razor.Test/{Generator/CodeTree/CodeTreeBuilderTest.cs => Chunks/ChunkTreeBuilderTest.cs} (71%) rename test/Microsoft.AspNet.Razor.Test/{Generator/CodeTree => Chunks}/ChunkVisitorTests.cs (90%) rename test/Microsoft.AspNet.Razor.Test/{Generator/AddImportCodeGeneratorTest.cs => CodeGeneration/AddImportChunkGeneratorTest.cs} (51%) rename test/Microsoft.AspNet.Razor.Test/{Generator/AttributeBlockCodeGeneratorTest.cs => CodeGeneration/AttributeBlockChunkGeneratorTest.cs} (69%) rename test/Microsoft.AspNet.Razor.Test/{Generator/Compiler/CSharp => CodeGeneration}/CSharpCodeWriterTest.cs (96%) rename test/Microsoft.AspNet.Razor.Test/{Generator/Compiler => CodeGeneration}/CSharpLineMappingWriterTest.cs (98%) rename test/Microsoft.AspNet.Razor.Test/{Generator/CodeTree => CodeGeneration}/CSharpPaddingBuilderTests.cs (99%) rename test/Microsoft.AspNet.Razor.Test/{Generator/CSharpRazorCodeGeneratorTest.cs => CodeGeneration/CSharpRazorChunkGeneratorTest.cs} (85%) rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/CSharpTagHelperRenderingTest.cs (99%) rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/CSharpTagHelperRenderingUnitTest.cs (96%) rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/CodeGenTestCodeBuilder.cs (81%) rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/CodeGenTestHost.cs (88%) rename test/Microsoft.AspNet.Razor.Test/{Generator/Compiler => CodeGeneration}/CodeWriterTest.cs (99%) rename test/Microsoft.AspNet.Razor.Test/{Generator/DynamicAttributeBlockCodeGeneratorTest.cs => CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs} (72%) rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/LineMappingTest.cs (98%) rename test/Microsoft.AspNet.Razor.Test/{Generator/RazorCodeGeneratorTest.cs => CodeGeneration/RazorChunkGeneratorTest.cs} (95%) create mode 100644 test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorCommentChunkGeneratorTest.cs rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/TabTest.cs (100%) rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/TagHelperAttributeValueCodeRendererTest.cs (88%) rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/TagHelperTestBase.cs (96%) rename test/Microsoft.AspNet.Razor.Test/{Generator => CodeGeneration}/TestSpan.cs (100%) delete mode 100644 test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeGenerationTest.cs delete mode 100644 test/Microsoft.AspNet.Razor.Test/Generator/RazorCommentCodeGeneratorTest.cs delete mode 100644 test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeTree.cs delete mode 100644 test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeTree.cshtml rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/AddTagHelperDirective.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/AttributeTargetingTagHelpers.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/AttributeTargetingTagHelpers.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Await.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Await.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs => Output/BasicTagHelpers.CustomAttributeCodeBuilder.cs} (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/BasicTagHelpers.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/BasicTagHelpers.Prefixed.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/BasicTagHelpers.Prefixed.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/BasicTagHelpers.RemoveTagHelper.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/BasicTagHelpers.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Blocks.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/CSharpCodeBuilder.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/CodeBlock.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/CodeBlockAtEOF.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/CodeBlockWithTextElement.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ComplexTagHelpers.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ComplexTagHelpers.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ConditionalAttributes.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ConditionalAttributes.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/DuplicateTargetTagHelper.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EmptyAttributeTagHelpers.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EmptyAttributeTagHelpers.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EmptyCodeBlock.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EmptyExplicitExpression.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EmptyImplicitExpression.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EmptyImplicitExpressionInCode.Tabs.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EmptyImplicitExpressionInCode.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EscapedTagHelpers.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/EscapedTagHelpers.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ExplicitExpression.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ExplicitExpressionAtEOF.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ExpressionsInCode.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/FunctionsBlock.DesignTime.Tabs.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/FunctionsBlock.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/FunctionsBlock.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/FunctionsBlockMinimal.DesignTime.Tabs.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/FunctionsBlock_Tabs.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/HiddenSpansInCode.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/HtmlCommentWithQuote_Double.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/HtmlCommentWithQuote_Single.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ImplicitExpression.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ImplicitExpressionAtEOF.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Imports.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Imports.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Inherits.Designtime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Inherits.Runtime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/InlineBlocks.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Instrumented.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/MarkupInCodeBlock.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/MinimizedTagHelpers.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/MinimizedTagHelpers.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/NestedCodeBlocks.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/NoLinePragmas.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/NullConditionalExpressions.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/NullConditionalExpressions.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/OpenedIf.DesignTime.Tabs.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/OpenedIf.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ParserError.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/PrefixedAttributeTagHelpers.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/PrefixedAttributeTagHelpers.Reversed.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/PrefixedAttributeTagHelpers.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/RazorComments.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/RazorComments.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/RemoveTagHelperDirective.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/ResolveUrl.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Sections.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/SimpleUnspacedIf.DesignTime.Tabs.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/SingleTagHelper.DesignTime.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/SingleTagHelper.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/TagHelpersInSection.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/Templates.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/UnfinishedExpressionInCode.Tabs.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Output/UnfinishedExpressionInCode.cs (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/AddTagHelperDirective.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/AttributeTargetingTagHelpers.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/Await.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/BasicTagHelpers.Prefixed.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/BasicTagHelpers.RemoveTagHelper.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/BasicTagHelpers.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/Blocks.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/CodeBlock.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/CodeBlockAtEOF.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/CodeBlockWithTextElement.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ComplexTagHelpers.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ConditionalAttributes.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/DesignTime.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/DuplicateTargetTagHelper.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/EmptyAttributeTagHelpers.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/EmptyCodeBlock.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/EmptyExplicitExpression.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/EmptyImplicitExpression.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/EmptyImplicitExpressionInCode.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/EscapedTagHelpers.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ExplicitExpression.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ExplicitExpressionAtEOF.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ExpressionsInCode.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/FunctionsBlock.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/FunctionsBlockMinimal.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/FunctionsBlock_Tabs.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/HiddenSpansInCode.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/HtmlCommentWithQuote_Double.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/HtmlCommentWithQuote_Single.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ImplicitExpression.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ImplicitExpressionAtEOF.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/Imports.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/Inherits.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/InlineBlocks.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/Instrumented.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/MarkupInCodeBlock.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/MinimizedTagHelpers.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/NestedCodeBlocks.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/NoLinePragmas.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/NullConditionalExpressions.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/OpenedIf.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ParserError.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/PrefixedAttributeTagHelpers.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/RazorComments.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/RemoveTagHelperDirective.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/ResolveUrl.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/Sections.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/SimpleUnspacedIf.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/SingleTagHelper.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/TagHelpersInSection.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/Templates.cshtml (100%) rename test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/{CS => }/Source/UnfinishedExpressionInCode.cshtml (100%) diff --git a/src/Microsoft.AspNet.Razor/CSharpRazorCodeLanguage.cs b/src/Microsoft.AspNet.Razor/CSharpRazorCodeLanguage.cs index d718c06180..fba2bd08da 100644 --- a/src/Microsoft.AspNet.Razor/CSharpRazorCodeLanguage.cs +++ b/src/Microsoft.AspNet.Razor/CSharpRazorCodeLanguage.cs @@ -1,9 +1,8 @@ // 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.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser; #if NET45 @@ -35,11 +34,11 @@ namespace Microsoft.AspNet.Razor } /// - /// Constructs a new instance of the code generator for this language with the specified settings + /// Constructs a new instance of the chunk generator for this language with the specified settings /// - public override RazorCodeGenerator CreateCodeGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host) + public override RazorChunkGenerator CreateChunkGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host) { - return new CSharpRazorCodeGenerator(className, rootNamespaceName, sourceFileName, host); + return new RazorChunkGenerator(className, rootNamespaceName, sourceFileName, host); } public override CodeBuilder CreateCodeBuilder(CodeBuilderContext context) diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/AddTagHelperChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/AddTagHelperChunk.cs similarity index 90% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/AddTagHelperChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/AddTagHelperChunk.cs index b88327e810..007aa44ad5 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/AddTagHelperChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/AddTagHelperChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { /// /// A used to look up s. diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/Chunk.cs b/src/Microsoft.AspNet.Razor/Chunks/Chunk.cs similarity index 87% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/Chunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/Chunk.cs index dc854ba2ca..b63733bc99 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/Chunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Chunk.cs @@ -3,7 +3,7 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { public class Chunk { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/CodeTree.cs b/src/Microsoft.AspNet.Razor/Chunks/ChunkTree.cs similarity index 75% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/CodeTree.cs rename to src/Microsoft.AspNet.Razor/Chunks/ChunkTree.cs index 15efd02878..8d45935c3c 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/CodeTree.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/ChunkTree.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class CodeTree + public class ChunkTree { - public CodeTree() + public ChunkTree() { Chunks = new List(); } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/CodeTreeBuilder.cs b/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs similarity index 78% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/CodeTreeBuilder.cs rename to src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs index fa7c68b5a9..b587a993fc 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/CodeTreeBuilder.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/ChunkTreeBuilder.cs @@ -4,20 +4,20 @@ using System.Collections.Generic; using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class CodeTreeBuilder + public class ChunkTreeBuilder { - private readonly Stack _blockChain; + private readonly Stack _parentChain; private Chunk _lastChunk; - public CodeTreeBuilder() + public ChunkTreeBuilder() { - CodeTree = new CodeTree(); - _blockChain = new Stack(); + ChunkTree = new ChunkTree(); + _parentChain = new Stack(); } - public CodeTree CodeTree { get; private set; } + public ChunkTree ChunkTree { get; private set; } public void AddChunk(Chunk chunk, SyntaxTreeNode association, bool topLevel = false) { @@ -27,13 +27,13 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler chunk.Association = association; // If we're not in the middle of a chunk block - if (_blockChain.Count == 0 || topLevel == true) + if (_parentChain.Count == 0 || topLevel == true) { - CodeTree.Chunks.Add(chunk); + ChunkTree.Chunks.Add(chunk); } else { - _blockChain.Peek().Children.Add(chunk); + _parentChain.Peek().Children.Add(chunk); } } @@ -148,30 +148,30 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler }, association, topLevel: true); } - public T StartChunkBlock(SyntaxTreeNode association) where T : ChunkBlock, new() + public T StartParentChunk(SyntaxTreeNode association) where T : ParentChunk, new() { - return StartChunkBlock(association, topLevel: false); + return StartParentChunk(association, topLevel: false); } - public T StartChunkBlock(SyntaxTreeNode association, bool topLevel) where T : ChunkBlock, new() + public T StartParentChunk(SyntaxTreeNode association, bool topLevel) where T : ParentChunk, new() { - var chunkBlock = new T(); + var parentChunk = new T(); - return StartChunkBlock(chunkBlock, association, topLevel); + return StartParentChunk(parentChunk, association, topLevel); } - public T StartChunkBlock(T chunkBlock, SyntaxTreeNode association, bool topLevel) where T : ChunkBlock + public T StartParentChunk(T parentChunk, SyntaxTreeNode association, bool topLevel) where T : ParentChunk { - AddChunk(chunkBlock, association, topLevel); + AddChunk(parentChunk, association, topLevel); - _blockChain.Push(chunkBlock); + _parentChain.Push(parentChunk); - return chunkBlock; + return parentChunk; } - public void EndChunkBlock() + public void EndParentChunk() { - _lastChunk = _blockChain.Pop(); + _lastChunk = _parentChain.Pop(); } } } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/CodeAttributeChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/CodeAttributeChunk.cs similarity index 79% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/CodeAttributeChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/CodeAttributeChunk.cs index 276eba9aa2..cecd46ce19 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/CodeAttributeChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/CodeAttributeChunk.cs @@ -3,9 +3,9 @@ using Microsoft.AspNet.Razor.Text; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class CodeAttributeChunk : ChunkBlock + public class CodeAttributeChunk : ParentChunk { public string Attribute { get; set; } public LocationTagged Prefix { get; set; } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/DynamicCodeAttributeChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/DynamicCodeAttributeChunk.cs similarity index 72% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/DynamicCodeAttributeChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/DynamicCodeAttributeChunk.cs index 00003d4efb..54c0092c02 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/DynamicCodeAttributeChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/DynamicCodeAttributeChunk.cs @@ -3,9 +3,9 @@ using Microsoft.AspNet.Razor.Text; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class DynamicCodeAttributeChunk : ChunkBlock + public class DynamicCodeAttributeChunk : ParentChunk { public LocationTagged Prefix { get; set; } } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ExpressionBlockChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/ExpressionBlockChunk.cs similarity index 64% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ExpressionBlockChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/ExpressionBlockChunk.cs index cf1f1234f7..dc6dc0bc8a 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ExpressionBlockChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/ExpressionBlockChunk.cs @@ -1,9 +1,9 @@ // 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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class ExpressionBlockChunk : ChunkBlock + public class ExpressionBlockChunk : ParentChunk { } } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ExpressionChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/ExpressionChunk.cs similarity index 87% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ExpressionChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/ExpressionChunk.cs index 6ab7e2215c..c783151248 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ExpressionChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/ExpressionChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { public class ExpressionChunk : Chunk { diff --git a/src/Microsoft.AspNet.Razor/Generator/AddImportCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/AddImportChunkGenerator.cs similarity index 73% rename from src/Microsoft.AspNet.Razor/Generator/AddImportCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/AddImportChunkGenerator.cs index 815176654a..27d1ba712a 100644 --- a/src/Microsoft.AspNet.Razor/Generator/AddImportCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/AddImportChunkGenerator.cs @@ -4,18 +4,18 @@ using System; using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class AddImportCodeGenerator : SpanCodeGenerator + public class AddImportChunkGenerator : SpanChunkGenerator { - public AddImportCodeGenerator(string ns) + public AddImportChunkGenerator(string ns) { Namespace = ns; } public string Namespace { get; } - public override void GenerateCode(Span target, CodeGeneratorContext context) + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { var ns = Namespace; @@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Razor.Generator ns = ns.Substring(1); } - context.CodeTreeBuilder.AddUsingChunk(ns, target); + context.ChunkTreeBuilder.AddUsingChunk(ns, target); } public override string ToString() @@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Razor.Generator public override bool Equals(object obj) { - var other = obj as AddImportCodeGenerator; + var other = obj as AddImportChunkGenerator; return other != null && string.Equals(Namespace, other.Namespace, StringComparison.Ordinal); } diff --git a/src/Microsoft.AspNet.Razor/Generator/TagHelpers/AddOrRemoveTagHelperCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/AddOrRemoveTagHelperChunkGenerator.cs similarity index 50% rename from src/Microsoft.AspNet.Razor/Generator/TagHelpers/AddOrRemoveTagHelperCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/AddOrRemoveTagHelperChunkGenerator.cs index 35e559ac17..a0d7396f69 100644 --- a/src/Microsoft.AspNet.Razor/Generator/TagHelpers/AddOrRemoveTagHelperCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/AddOrRemoveTagHelperChunkGenerator.cs @@ -3,21 +3,21 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { /// - /// A responsible for generating s and - /// s. + /// A responsible for generating s and + /// s. /// - public class AddOrRemoveTagHelperCodeGenerator : SpanCodeGenerator + public class AddOrRemoveTagHelperChunkGenerator : SpanChunkGenerator { /// - /// Instantiates a new . + /// Instantiates a new . /// /// /// Text used to look up s that should be added or removed. /// - public AddOrRemoveTagHelperCodeGenerator(bool removeTagHelperDescriptors, string lookupText) + public AddOrRemoveTagHelperChunkGenerator(bool removeTagHelperDescriptors, string lookupText) { RemoveTagHelperDescriptors = removeTagHelperDescriptors; LookupText = lookupText; @@ -32,28 +32,28 @@ namespace Microsoft.AspNet.Razor.Generator /// /// Whether we want to remove s from the Razor page. /// - /// If true generates s, - /// s otherwise. + /// If true generates s, + /// s otherwise. public bool RemoveTagHelperDescriptors { get; } /// - /// Generates s if is - /// true, otherwise s are generated. + /// Generates s if is + /// true, otherwise s are generated. /// /// - /// The responsible for this . + /// The responsible for this . /// - /// A instance that contains information about - /// the current code generation process. - public override void GenerateCode(Span target, CodeGeneratorContext context) + /// A instance that contains information about + /// the current chunk generation process. + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { if (RemoveTagHelperDescriptors) { - context.CodeTreeBuilder.AddRemoveTagHelperChunk(LookupText, target); + context.ChunkTreeBuilder.AddRemoveTagHelperChunk(LookupText, target); } else { - context.CodeTreeBuilder.AddAddTagHelperChunk(LookupText, target); + context.ChunkTreeBuilder.AddAddTagHelperChunk(LookupText, target); } } } diff --git a/src/Microsoft.AspNet.Razor/Generator/AttributeBlockCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/AttributeBlockChunkGenerator.cs similarity index 68% rename from src/Microsoft.AspNet.Razor/Generator/AttributeBlockCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/AttributeBlockChunkGenerator.cs index fac72c0417..16fd47b249 100644 --- a/src/Microsoft.AspNet.Razor/Generator/AttributeBlockCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/AttributeBlockChunkGenerator.cs @@ -3,16 +3,15 @@ using System; using System.Globalization; -using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Text; using Microsoft.Internal.Web.Utils; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class AttributeBlockCodeGenerator : BlockCodeGenerator + public class AttributeBlockChunkGenerator : ParentChunkGenerator { - public AttributeBlockCodeGenerator(string name, LocationTagged prefix, LocationTagged suffix) + public AttributeBlockChunkGenerator(string name, LocationTagged prefix, LocationTagged suffix) { Name = name; Prefix = prefix; @@ -25,18 +24,18 @@ namespace Microsoft.AspNet.Razor.Generator public LocationTagged Suffix { get; } - public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context) + public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) { - var chunk = context.CodeTreeBuilder.StartChunkBlock(target); + var chunk = context.ChunkTreeBuilder.StartParentChunk(target); chunk.Attribute = Name; chunk.Prefix = Prefix; chunk.Suffix = Suffix; } - public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context) + public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.EndChunkBlock(); + context.ChunkTreeBuilder.EndParentChunk(); } public override string ToString() @@ -46,7 +45,7 @@ namespace Microsoft.AspNet.Razor.Generator public override bool Equals(object obj) { - var other = obj as AttributeBlockCodeGenerator; + var other = obj as AttributeBlockChunkGenerator; return other != null && string.Equals(other.Name, Name, StringComparison.Ordinal) && Equals(other.Prefix, Prefix) && diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/ChunkGeneratorContext.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ChunkGeneratorContext.cs new file mode 100644 index 0000000000..9accfb3394 --- /dev/null +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/ChunkGeneratorContext.cs @@ -0,0 +1,44 @@ +// 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.Chunks.Generators +{ + public class ChunkGeneratorContext + { + protected ChunkGeneratorContext(ChunkGeneratorContext context) + : this( + context.Host, + context.ClassName, + context.RootNamespace, + context.SourceFile, + // True because we're pulling from the provided context's source file. + shouldGenerateLinePragmas: true) + { + ChunkTreeBuilder = context.ChunkTreeBuilder; + } + + public ChunkGeneratorContext( + RazorEngineHost host, + string className, + string rootNamespace, + string sourceFile, + bool shouldGenerateLinePragmas) + { + ChunkTreeBuilder = new ChunkTreeBuilder(); + Host = host; + SourceFile = shouldGenerateLinePragmas ? sourceFile : null; + RootNamespace = rootNamespace; + ClassName = className; + } + + public string SourceFile { get; internal set; } + + public string RootNamespace { get; private set; } + + public string ClassName { get; private set; } + + public RazorEngineHost Host { get; private set; } + + public ChunkTreeBuilder ChunkTreeBuilder { get; set; } + } +} diff --git a/src/Microsoft.AspNet.Razor/Generator/DynamicAttributeBlockCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/DynamicAttributeBlockChunkGenerator.cs similarity index 58% rename from src/Microsoft.AspNet.Razor/Generator/DynamicAttributeBlockCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/DynamicAttributeBlockChunkGenerator.cs index 8f8915b352..05879b6da2 100644 --- a/src/Microsoft.AspNet.Razor/Generator/DynamicAttributeBlockCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/DynamicAttributeBlockChunkGenerator.cs @@ -2,20 +2,19 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Globalization; -using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Text; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class DynamicAttributeBlockCodeGenerator : BlockCodeGenerator + public class DynamicAttributeBlockChunkGenerator : ParentChunkGenerator { - public DynamicAttributeBlockCodeGenerator(LocationTagged prefix, int offset, int line, int col) + public DynamicAttributeBlockChunkGenerator(LocationTagged prefix, int offset, int line, int col) : this(prefix, new SourceLocation(offset, line, col)) { } - public DynamicAttributeBlockCodeGenerator(LocationTagged prefix, SourceLocation valueStart) + public DynamicAttributeBlockChunkGenerator(LocationTagged prefix, SourceLocation valueStart) { Prefix = prefix; ValueStart = valueStart; @@ -25,16 +24,16 @@ namespace Microsoft.AspNet.Razor.Generator public SourceLocation ValueStart { get; } - public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context) + public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) { - var chunk = context.CodeTreeBuilder.StartChunkBlock(target); + var chunk = context.ChunkTreeBuilder.StartParentChunk(target); chunk.Start = ValueStart; chunk.Prefix = Prefix; } - public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context) + public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.EndChunkBlock(); + context.ChunkTreeBuilder.EndParentChunk(); } public override string ToString() @@ -44,7 +43,7 @@ namespace Microsoft.AspNet.Razor.Generator public override bool Equals(object obj) { - var other = obj as DynamicAttributeBlockCodeGenerator; + var other = obj as DynamicAttributeBlockChunkGenerator; return other != null && Equals(other.Prefix, Prefix); } diff --git a/src/Microsoft.AspNet.Razor/Generator/ExpressionCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ExpressionChunkGenerator.cs similarity index 50% rename from src/Microsoft.AspNet.Razor/Generator/ExpressionCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/ExpressionChunkGenerator.cs index d0363847f3..210ab287f3 100644 --- a/src/Microsoft.AspNet.Razor/Generator/ExpressionCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/ExpressionChunkGenerator.cs @@ -1,28 +1,27 @@ // 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.Generator.Compiler; using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class ExpressionCodeGenerator : HybridCodeGenerator + public class ExpressionChunkGenerator : HybridChunkGenerator { - private static readonly int TypeHashCode = typeof(ExpressionCodeGenerator).GetHashCode(); + private static readonly int TypeHashCode = typeof(ExpressionChunkGenerator).GetHashCode(); - public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context) + public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.StartChunkBlock(target); + context.ChunkTreeBuilder.StartParentChunk(target); } - public override void GenerateCode(Span target, CodeGeneratorContext context) + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.AddExpressionChunk(target.Content, target); + context.ChunkTreeBuilder.AddExpressionChunk(target.Content, target); } - public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context) + public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.EndChunkBlock(); + context.ChunkTreeBuilder.EndParentChunk(); } public override string ToString() diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/HybridChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/HybridChunkGenerator.cs new file mode 100644 index 0000000000..7a3d368b6a --- /dev/null +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/HybridChunkGenerator.cs @@ -0,0 +1,22 @@ +// 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/IParentChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/IParentChunkGenerator.cs new file mode 100644 index 0000000000..d4a300ba82 --- /dev/null +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/IParentChunkGenerator.cs @@ -0,0 +1,13 @@ +// 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 interface IParentChunkGenerator + { + void GenerateStartParentChunk(Block target, ChunkGeneratorContext context); + void GenerateEndParentChunk(Block target, ChunkGeneratorContext context); + } +} diff --git a/src/Microsoft.AspNet.Razor/Generator/ISpanCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ISpanChunkGenerator.cs similarity index 58% rename from src/Microsoft.AspNet.Razor/Generator/ISpanCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/ISpanChunkGenerator.cs index 78117a47f5..48fcf0faad 100644 --- a/src/Microsoft.AspNet.Razor/Generator/ISpanCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/ISpanChunkGenerator.cs @@ -3,10 +3,10 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public interface ISpanCodeGenerator + public interface ISpanChunkGenerator { - void GenerateCode(Span target, CodeGeneratorContext context); + void GenerateChunk(Span target, ChunkGeneratorContext context); } } diff --git a/src/Microsoft.AspNet.Razor/Generator/LiteralAttributeCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/LiteralAttributeChunkGenerator.cs similarity index 68% rename from src/Microsoft.AspNet.Razor/Generator/LiteralAttributeCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/LiteralAttributeChunkGenerator.cs index 95bf411e39..df020effbd 100644 --- a/src/Microsoft.AspNet.Razor/Generator/LiteralAttributeCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/LiteralAttributeChunkGenerator.cs @@ -2,22 +2,21 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Globalization; -using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Text; using Microsoft.Internal.Web.Utils; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class LiteralAttributeCodeGenerator : SpanCodeGenerator + public class LiteralAttributeChunkGenerator : SpanChunkGenerator { - public LiteralAttributeCodeGenerator(LocationTagged prefix, LocationTagged valueGenerator) + public LiteralAttributeChunkGenerator(LocationTagged prefix, LocationTagged valueGenerator) { Prefix = prefix; ValueGenerator = valueGenerator; } - public LiteralAttributeCodeGenerator(LocationTagged prefix, LocationTagged value) + public LiteralAttributeChunkGenerator(LocationTagged prefix, LocationTagged value) { Prefix = prefix; Value = value; @@ -27,11 +26,11 @@ namespace Microsoft.AspNet.Razor.Generator public LocationTagged Value { get; } - public LocationTagged ValueGenerator { get; } + public LocationTagged ValueGenerator { get; } - public override void GenerateCode(Span target, CodeGeneratorContext context) + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { - var chunk = context.CodeTreeBuilder.StartChunkBlock(target); + var chunk = context.ChunkTreeBuilder.StartParentChunk(target); chunk.Prefix = Prefix; chunk.Value = Value; @@ -39,12 +38,12 @@ namespace Microsoft.AspNet.Razor.Generator { chunk.ValueLocation = ValueGenerator.Location; - ValueGenerator.Value.GenerateCode(target, context); + ValueGenerator.Value.GenerateChunk(target, context); chunk.ValueLocation = ValueGenerator.Location; } - context.CodeTreeBuilder.EndChunkBlock(); + context.ChunkTreeBuilder.EndParentChunk(); } public override string ToString() @@ -61,7 +60,7 @@ namespace Microsoft.AspNet.Razor.Generator public override bool Equals(object obj) { - var other = obj as LiteralAttributeCodeGenerator; + var other = obj as LiteralAttributeChunkGenerator; return other != null && Equals(other.Prefix, Prefix) && Equals(other.Value, Value) && diff --git a/src/Microsoft.AspNet.Razor/Generator/MarkupCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/MarkupChunkGenerator.cs similarity index 55% rename from src/Microsoft.AspNet.Razor/Generator/MarkupCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/MarkupChunkGenerator.cs index f0ab128ab8..26267b29be 100644 --- a/src/Microsoft.AspNet.Razor/Generator/MarkupCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/MarkupChunkGenerator.cs @@ -3,13 +3,13 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class MarkupCodeGenerator : SpanCodeGenerator + public class MarkupChunkGenerator : SpanChunkGenerator { - public override void GenerateCode(Span target, CodeGeneratorContext context) + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.AddLiteralChunk(target.Content, target); + context.ChunkTreeBuilder.AddLiteralChunk(target.Content, target); } public override string ToString() diff --git a/src/Microsoft.AspNet.Razor/Generator/BlockCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ParentChunkGenerator.cs similarity index 54% rename from src/Microsoft.AspNet.Razor/Generator/BlockCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/ParentChunkGenerator.cs index c269435740..4a7de85e44 100644 --- a/src/Microsoft.AspNet.Razor/Generator/BlockCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/ParentChunkGenerator.cs @@ -4,20 +4,20 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public abstract class BlockCodeGenerator : IBlockCodeGenerator + public abstract class ParentChunkGenerator : IParentChunkGenerator { - private static readonly int TypeHashCode = typeof(BlockCodeGenerator).GetHashCode(); + private static readonly int TypeHashCode = typeof(ParentChunkGenerator).GetHashCode(); [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "This class has no instance state")] - public static readonly IBlockCodeGenerator Null = new NullBlockCodeGenerator(); + public static readonly IParentChunkGenerator Null = new NullParentChunkGenerator(); - public virtual void GenerateStartBlockCode(Block target, CodeGeneratorContext context) + public virtual void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) { } - public virtual void GenerateEndBlockCode(Block target, CodeGeneratorContext context) + public virtual void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) { } @@ -32,13 +32,13 @@ namespace Microsoft.AspNet.Razor.Generator return TypeHashCode; } - private class NullBlockCodeGenerator : IBlockCodeGenerator + private class NullParentChunkGenerator : IParentChunkGenerator { - public void GenerateStartBlockCode(Block target, CodeGeneratorContext context) + public void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) { } - public void GenerateEndBlockCode(Block target, CodeGeneratorContext context) + public void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) { } diff --git a/src/Microsoft.AspNet.Razor/Generator/RazorCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/RazorChunkGenerator.cs similarity index 79% rename from src/Microsoft.AspNet.Razor/Generator/RazorCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/RazorChunkGenerator.cs index cf3bff26ee..c9b7a8c25b 100644 --- a/src/Microsoft.AspNet.Razor/Generator/RazorCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/RazorChunkGenerator.cs @@ -6,13 +6,13 @@ using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public abstract class RazorCodeGenerator : ParserVisitor + public class RazorChunkGenerator : ParserVisitor { - private CodeGeneratorContext _context; + private ChunkGeneratorContext _context; - protected RazorCodeGenerator( + public RazorChunkGenerator( string className, [NotNull] string rootNamespaceName, string sourceFileName, @@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Razor.Generator public bool GenerateLinePragmas { get; set; } public bool DesignTimeMode { get; set; } - public CodeGeneratorContext Context + public ChunkGeneratorContext Context { get { @@ -51,24 +51,24 @@ namespace Microsoft.AspNet.Razor.Generator public override void VisitStartBlock(Block block) { - block.CodeGenerator.GenerateStartBlockCode(block, Context); + block.ChunkGenerator.GenerateStartParentChunk(block, Context); } public override void VisitEndBlock(Block block) { - block.CodeGenerator.GenerateEndBlockCode(block, Context); + block.ChunkGenerator.GenerateEndParentChunk(block, Context); } public override void VisitSpan(Span span) { - span.CodeGenerator.GenerateCode(span, Context); + span.ChunkGenerator.GenerateChunk(span, Context); } private void EnsureContextInitialized() { if (_context == null) { - _context = new CodeGeneratorContext(Host, + _context = new ChunkGeneratorContext(Host, ClassName, RootNamespaceName, SourceFileName, @@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Razor.Generator } } - protected virtual void Initialize(CodeGeneratorContext context) + protected virtual void Initialize(ChunkGeneratorContext context) { } } diff --git a/src/Microsoft.AspNet.Razor/Generator/RazorCommentCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/RazorCommentChunkGenerator.cs similarity index 61% rename from src/Microsoft.AspNet.Razor/Generator/RazorCommentCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/RazorCommentChunkGenerator.cs index 99127e4b23..ba0d202987 100644 --- a/src/Microsoft.AspNet.Razor/Generator/RazorCommentCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/RazorCommentChunkGenerator.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class RazorCommentCodeGenerator : BlockCodeGenerator + public class RazorCommentChunkGenerator : ParentChunkGenerator { } } diff --git a/src/Microsoft.AspNet.Razor/Generator/ResolveUrlCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/ResolveUrlChunkGenerator.cs similarity index 55% rename from src/Microsoft.AspNet.Razor/Generator/ResolveUrlCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/ResolveUrlChunkGenerator.cs index 4a1a68e1ac..b0ef82b10d 100644 --- a/src/Microsoft.AspNet.Razor/Generator/ResolveUrlCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/ResolveUrlChunkGenerator.cs @@ -3,21 +3,21 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class ResolveUrlCodeGenerator : SpanCodeGenerator + public class ResolveUrlChunkGenerator : SpanChunkGenerator { - public override void GenerateCode(Span target, CodeGeneratorContext context) + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { // Check if the host supports it if (string.IsNullOrEmpty(context.Host.GeneratedClassContext.ResolveUrlMethodName)) { - // Nope, just use the default MarkupCodeGenerator behavior - new MarkupCodeGenerator().GenerateCode(target, context); + // Nope, just use the default MarkupChunkGenerator behavior + new MarkupChunkGenerator().GenerateChunk(target, context); return; } - context.CodeTreeBuilder.AddResolveUrlChunk(target.Content, target); + context.ChunkTreeBuilder.AddResolveUrlChunk(target.Content, target); } public override string ToString() diff --git a/src/Microsoft.AspNet.Razor/Generator/SectionCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/SectionChunkGenerator.cs similarity index 60% rename from src/Microsoft.AspNet.Razor/Generator/SectionCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/SectionChunkGenerator.cs index c1bab4813b..4ed679c982 100644 --- a/src/Microsoft.AspNet.Razor/Generator/SectionCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/SectionChunkGenerator.cs @@ -2,35 +2,34 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class SectionCodeGenerator : BlockCodeGenerator + public class SectionChunkGenerator : ParentChunkGenerator { - public SectionCodeGenerator(string sectionName) + public SectionChunkGenerator(string sectionName) { SectionName = sectionName; } public string SectionName { get; } - public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context) + public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) { - var chunk = context.CodeTreeBuilder.StartChunkBlock(target); + var chunk = context.ChunkTreeBuilder.StartParentChunk(target); chunk.Name = SectionName; } - public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context) + public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.EndChunkBlock(); + context.ChunkTreeBuilder.EndParentChunk(); } public override bool Equals(object obj) { - var other = obj as SectionCodeGenerator; + var other = obj as SectionChunkGenerator; return base.Equals(other) && string.Equals(SectionName, other.SectionName, StringComparison.Ordinal); } diff --git a/src/Microsoft.AspNet.Razor/Generator/SetBaseTypeCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/SetBaseTypeChunkGenerator.cs similarity index 65% rename from src/Microsoft.AspNet.Razor/Generator/SetBaseTypeCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/SetBaseTypeChunkGenerator.cs index 5510d416d1..4b4384ea38 100644 --- a/src/Microsoft.AspNet.Razor/Generator/SetBaseTypeCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/SetBaseTypeChunkGenerator.cs @@ -4,20 +4,20 @@ using System; using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class SetBaseTypeCodeGenerator : SpanCodeGenerator + public class SetBaseTypeChunkGenerator : SpanChunkGenerator { - public SetBaseTypeCodeGenerator(string baseType) + public SetBaseTypeChunkGenerator(string baseType) { BaseType = baseType; } public string BaseType { get; } - public override void GenerateCode(Span target, CodeGeneratorContext context) + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.AddSetBaseTypeChunk(BaseType, target); + context.ChunkTreeBuilder.AddSetBaseTypeChunk(BaseType, target); } public override string ToString() @@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Razor.Generator public override bool Equals(object obj) { - var other = obj as SetBaseTypeCodeGenerator; + var other = obj as SetBaseTypeChunkGenerator; return other != null && string.Equals(BaseType, other.BaseType, StringComparison.Ordinal); } diff --git a/src/Microsoft.AspNet.Razor/Generator/SpanCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/SpanChunkGenerator.cs similarity index 61% rename from src/Microsoft.AspNet.Razor/Generator/SpanCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/SpanChunkGenerator.cs index 899abfd308..c119889d9c 100644 --- a/src/Microsoft.AspNet.Razor/Generator/SpanCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/SpanChunkGenerator.cs @@ -4,16 +4,16 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public abstract class SpanCodeGenerator : ISpanCodeGenerator + public abstract class SpanChunkGenerator : ISpanChunkGenerator { - private static readonly int TypeHashCode = typeof(SpanCodeGenerator).GetHashCode(); + private static readonly int TypeHashCode = typeof(SpanChunkGenerator).GetHashCode(); [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "This class has no instance state")] - public static readonly ISpanCodeGenerator Null = new NullSpanCodeGenerator(); + public static readonly ISpanChunkGenerator Null = new NullSpanChunkGenerator(); - public virtual void GenerateCode(Span target, CodeGeneratorContext context) + public virtual void GenerateChunk(Span target, ChunkGeneratorContext context) { } @@ -28,9 +28,9 @@ namespace Microsoft.AspNet.Razor.Generator return TypeHashCode; } - private class NullSpanCodeGenerator : ISpanCodeGenerator + private class NullSpanChunkGenerator : ISpanChunkGenerator { - public void GenerateCode(Span target, CodeGeneratorContext context) + public void GenerateChunk(Span target, ChunkGeneratorContext context) { } diff --git a/src/Microsoft.AspNet.Razor/Generator/StatementCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/StatementChunkGenerator.cs similarity index 55% rename from src/Microsoft.AspNet.Razor/Generator/StatementCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/StatementChunkGenerator.cs index 85cfe30d54..7504fefc7e 100644 --- a/src/Microsoft.AspNet.Razor/Generator/StatementCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/StatementChunkGenerator.cs @@ -3,13 +3,13 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class StatementCodeGenerator : SpanCodeGenerator + public class StatementChunkGenerator : SpanChunkGenerator { - public override void GenerateCode(Span target, CodeGeneratorContext context) + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.AddStatementChunk(target.Content, target); + context.ChunkTreeBuilder.AddStatementChunk(target.Content, target); } public override string ToString() diff --git a/src/Microsoft.AspNet.Razor/Generator/TagHelperCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperChunkGenerator.cs similarity index 63% rename from src/Microsoft.AspNet.Razor/Generator/TagHelperCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperChunkGenerator.cs index 84818fc09a..2b889d7db7 100644 --- a/src/Microsoft.AspNet.Razor/Generator/TagHelperCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperChunkGenerator.cs @@ -4,27 +4,26 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { /// - /// A that is responsible for generating valid s. + /// A that is responsible for generating valid s. /// - public class TagHelperCodeGenerator : BlockCodeGenerator + public class TagHelperChunkGenerator : ParentChunkGenerator { private IEnumerable _tagHelperDescriptors; /// - /// Instantiates a new . + /// Instantiates a new . /// /// /// s associated with the current HTML tag. /// - public TagHelperCodeGenerator(IEnumerable tagHelperDescriptors) + public TagHelperChunkGenerator(IEnumerable tagHelperDescriptors) { _tagHelperDescriptors = tagHelperDescriptors; } @@ -33,11 +32,11 @@ namespace Microsoft.AspNet.Razor.Generator /// Starts the generation of a . /// /// - /// The responsible for this . + /// The responsible for this . /// - /// A instance that contains information about - /// the current code generation process. - public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context) + /// A instance that contains information about + /// the current chunk generation process. + public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) { var tagHelperBlock = target as TagHelperBlock; @@ -49,25 +48,25 @@ namespace Microsoft.AspNet.Razor.Generator var attributes = new List>(); - // We need to create a code generator to create chunks for each of the attributes. - var codeGenerator = context.Host.CreateCodeGenerator( + // We need to create a chunk generator to create chunks for each of the attributes. + var chunkGenerator = context.Host.CreateChunkGenerator( context.ClassName, context.RootNamespace, context.SourceFile); foreach (var attribute in tagHelperBlock.Attributes) { - ChunkBlock attributeChunkValue = null; + ParentChunk attributeChunkValue = null; if (attribute.Value != null) { // Populates the code tree with chunks associated with attributes - attribute.Value.Accept(codeGenerator); + attribute.Value.Accept(chunkGenerator); - var chunks = codeGenerator.Context.CodeTreeBuilder.CodeTree.Chunks; + var chunks = chunkGenerator.Context.ChunkTreeBuilder.ChunkTree.Chunks; var first = chunks.FirstOrDefault(); - attributeChunkValue = new ChunkBlock + attributeChunkValue = new ParentChunk { Association = first?.Association, Children = chunks, @@ -78,12 +77,12 @@ namespace Microsoft.AspNet.Razor.Generator attributes.Add(new KeyValuePair(attribute.Key, attributeChunkValue)); // Reset the code tree builder so we can build a new one for the next attribute - codeGenerator.Context.CodeTreeBuilder = new CodeTreeBuilder(); + chunkGenerator.Context.ChunkTreeBuilder = new ChunkTreeBuilder(); } var unprefixedTagName = tagHelperBlock.TagName.Substring(_tagHelperDescriptors.First().Prefix.Length); - context.CodeTreeBuilder.StartChunkBlock( + context.ChunkTreeBuilder.StartParentChunk( new TagHelperChunk( unprefixedTagName, tagHelperBlock.SelfClosing, @@ -95,16 +94,16 @@ namespace Microsoft.AspNet.Razor.Generator /// /// Ends the generation of a capturing all previously visited children - /// since the method was called. + /// since the method was called. /// /// - /// The responsible for this . + /// The responsible for this . /// - /// A instance that contains information about - /// the current code generation process. - public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context) + /// A instance that contains information about + /// the current chunk generation process. + public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.EndChunkBlock(); + context.ChunkTreeBuilder.EndParentChunk(); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Razor/Generator/TagHelpers/TagHelperPrefixDirectiveCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperPrefixDirectiveChunkGenerator.cs similarity index 52% rename from src/Microsoft.AspNet.Razor/Generator/TagHelpers/TagHelperPrefixDirectiveCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperPrefixDirectiveChunkGenerator.cs index ad873bb690..dd00b86540 100644 --- a/src/Microsoft.AspNet.Razor/Generator/TagHelpers/TagHelperPrefixDirectiveCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/TagHelperPrefixDirectiveChunkGenerator.cs @@ -3,21 +3,21 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { /// - /// A responsible for generating - /// s. + /// A responsible for generating + /// s. /// - public class TagHelperPrefixDirectiveCodeGenerator : SpanCodeGenerator + public class TagHelperPrefixDirectiveChunkGenerator : SpanChunkGenerator { /// - /// Instantiates a new . + /// Instantiates a new . /// /// /// Text used as a required prefix when matching HTML. /// - public TagHelperPrefixDirectiveCodeGenerator(string prefix) + public TagHelperPrefixDirectiveChunkGenerator(string prefix) { Prefix = prefix; } @@ -28,16 +28,16 @@ namespace Microsoft.AspNet.Razor.Generator public string Prefix { get; } /// - /// Generates s. + /// Generates s. /// /// - /// The responsible for this . + /// The responsible for this . /// - /// A instance that contains information about - /// the current code generation process. - public override void GenerateCode(Span target, CodeGeneratorContext context) + /// A instance that contains information about + /// the current chunk generation process. + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.AddTagHelperPrefixDirectiveChunk(Prefix, target); + context.ChunkTreeBuilder.AddTagHelperPrefixDirectiveChunk(Prefix, target); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Razor/Chunks/Generators/TemplateBlockChunkGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/TemplateBlockChunkGenerator.cs new file mode 100644 index 0000000000..6874c7b37d --- /dev/null +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/TemplateBlockChunkGenerator.cs @@ -0,0 +1,20 @@ +// 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 class TemplateBlockChunkGenerator : ParentChunkGenerator + { + public override void GenerateStartParentChunk(Block target, ChunkGeneratorContext context) + { + context.ChunkTreeBuilder.StartParentChunk(target); + } + + public override void GenerateEndParentChunk(Block target, ChunkGeneratorContext context) + { + context.ChunkTreeBuilder.EndParentChunk(); + } + } +} diff --git a/src/Microsoft.AspNet.Razor/Generator/TypeMemberCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Chunks/Generators/TypeMemberChunkGenerator.cs similarity index 55% rename from src/Microsoft.AspNet.Razor/Generator/TypeMemberCodeGenerator.cs rename to src/Microsoft.AspNet.Razor/Chunks/Generators/TypeMemberChunkGenerator.cs index ff4cd2a7c2..cfda1aa1ed 100644 --- a/src/Microsoft.AspNet.Razor/Generator/TypeMemberCodeGenerator.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/Generators/TypeMemberChunkGenerator.cs @@ -3,13 +3,13 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class TypeMemberCodeGenerator : SpanCodeGenerator + public class TypeMemberChunkGenerator : SpanChunkGenerator { - public override void GenerateCode(Span target, CodeGeneratorContext context) + public override void GenerateChunk(Span target, ChunkGeneratorContext context) { - context.CodeTreeBuilder.AddTypeMemberChunk(target.Content, target); + context.ChunkTreeBuilder.AddTypeMemberChunk(target.Content, target); } public override string ToString() diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/LiteralChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/LiteralChunk.cs similarity index 87% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/LiteralChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/LiteralChunk.cs index d56a45f297..756e131ee2 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/LiteralChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/LiteralChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { public class LiteralChunk : Chunk { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/LiteralCodeAttributeChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/LiteralCodeAttributeChunk.cs similarity index 80% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/LiteralCodeAttributeChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/LiteralCodeAttributeChunk.cs index e60e09a047..dce9c0d5c6 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/LiteralCodeAttributeChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/LiteralCodeAttributeChunk.cs @@ -3,9 +3,9 @@ using Microsoft.AspNet.Razor.Text; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class LiteralCodeAttributeChunk : ChunkBlock + public class LiteralCodeAttributeChunk : ParentChunk { public string Code { get; set; } public LocationTagged Prefix { get; set; } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ChunkBlock.cs b/src/Microsoft.AspNet.Razor/Chunks/ParentChunk.cs similarity index 74% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ChunkBlock.cs rename to src/Microsoft.AspNet.Razor/Chunks/ParentChunk.cs index eb0c79f1fa..da88454827 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ChunkBlock.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/ParentChunk.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class ChunkBlock : Chunk + public class ParentChunk : Chunk { - public ChunkBlock() + public ParentChunk() { Children = new List(); } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/RemoveTagHelperChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/RemoveTagHelperChunk.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/RemoveTagHelperChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/RemoveTagHelperChunk.cs index 31d39fd65a..63c83c436a 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/RemoveTagHelperChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/RemoveTagHelperChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { /// /// A used to look up s that should be ignored diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ResolveUrlChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/ResolveUrlChunk.cs similarity index 83% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ResolveUrlChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/ResolveUrlChunk.cs index e93b5d06c9..3e9f5ede1a 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/ResolveUrlChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/ResolveUrlChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { public class ResolveUrlChunk : Chunk { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/SectionChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/SectionChunk.cs similarity index 70% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/SectionChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/SectionChunk.cs index 84bf6573db..6262484a22 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/SectionChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/SectionChunk.cs @@ -1,9 +1,9 @@ // 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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class SectionChunk : ChunkBlock + public class SectionChunk : ParentChunk { public string Name { get; set; } } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/SetBaseTypeChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/SetBaseTypeChunk.cs similarity index 83% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/SetBaseTypeChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/SetBaseTypeChunk.cs index 6ac7d583c8..06d9e270d7 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/SetBaseTypeChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/SetBaseTypeChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { public class SetBaseTypeChunk : Chunk { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/StatementChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/StatementChunk.cs similarity index 87% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/StatementChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/StatementChunk.cs index c9bc7fca3d..49e40dc6fa 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/StatementChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/StatementChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { public class StatementChunk : Chunk { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/TagHelperChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/TagHelperChunk.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/TagHelperChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/TagHelperChunk.cs index 40a9904f3f..ed0f4e19df 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/TagHelperChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/TagHelperChunk.cs @@ -4,12 +4,12 @@ using System.Collections.Generic; using Microsoft.AspNet.Razor.TagHelpers; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { /// - /// A that represents a special HTML tag. + /// A that represents a special HTML tag. /// - public class TagHelperChunk : ChunkBlock + public class TagHelperChunk : ParentChunk { /// /// Instantiates a new . diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/TagHelperPrefixDirectiveChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/TagHelperPrefixDirectiveChunk.cs similarity index 91% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/TagHelperPrefixDirectiveChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/TagHelperPrefixDirectiveChunk.cs index 14b01a2a43..a935f2b60a 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TagHelpers/TagHelperPrefixDirectiveChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/TagHelperPrefixDirectiveChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { /// /// A for the @tagHelperPrefix directive. diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TemplateChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/TemplateChunk.cs similarity index 65% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TemplateChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/TemplateChunk.cs index c203eb7b61..4089f96245 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TemplateChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/TemplateChunk.cs @@ -1,9 +1,9 @@ // 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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { - public class TemplateChunk : ChunkBlock + public class TemplateChunk : ParentChunk { } } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TypeMemberChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/TypeMemberChunk.cs similarity index 83% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TypeMemberChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/TypeMemberChunk.cs index 09186e53e4..394ce2a399 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/TypeMemberChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/TypeMemberChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { public class TypeMemberChunk : Chunk { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/UsingChunk.cs b/src/Microsoft.AspNet.Razor/Chunks/UsingChunk.cs similarity index 83% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/UsingChunk.cs rename to src/Microsoft.AspNet.Razor/Chunks/UsingChunk.cs index a5d0752eee..60902ac7c1 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeTree/Chunks/UsingChunk.cs +++ b/src/Microsoft.AspNet.Razor/Chunks/UsingChunk.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.Chunks { public class UsingChunk : Chunk { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeBuilder.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeBuilder.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeBuilder.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeBuilder.cs index 0deb7a55b0..645f8ff920 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeBuilder.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeBuilder.cs @@ -4,9 +4,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNet.Razor.Chunks; +using Microsoft.AspNet.Razor.CodeGeneration.Visitors; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CSharpCodeBuilder : CodeBuilder { @@ -19,7 +21,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp { } - private CodeTree Tree { get { return Context.CodeTreeBuilder.CodeTree; } } + private ChunkTree Tree { get { return Context.ChunkTreeBuilder.ChunkTree; } } public RazorEngineHost Host { get { return Context.Host; } } // Internal for testing @@ -65,7 +67,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp BuildConstructor(writer); - // Add space inbetween constructor and method body + // Add space in-between constructor and method body writer.WriteLine(); using (writer.BuildDisableWarningScope(DisableAsyncWarning)) @@ -109,7 +111,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp }; } - private void AddImports(CodeTree codeTree, CSharpCodeWriter writer, IEnumerable defaultImports) + private void AddImports(ChunkTree chunkTree, CSharpCodeWriter writer, IEnumerable defaultImports) { // Write out using directives var usingVisitor = new CSharpUsingVisitor(writer, Context); diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeWriter.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWriter.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeWriter.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWriter.cs index 7a8d59468c..4c4771f669 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeWriter.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWriter.cs @@ -5,11 +5,12 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Text; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CSharpCodeWriter : CodeWriter { @@ -463,7 +464,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp Write("\""); } - public void WriteStartInstrumentationContext(CodeGeneratorContext 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)); @@ -474,7 +475,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp WriteEndMethodInvocation(); } - public void WriteEndInstrumentationContext(CodeGeneratorContext context) + public void WriteEndInstrumentationContext(ChunkGeneratorContext context) { WriteMethodInvocation(context.Host.GeneratedClassContext.EndContextMethodName); } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeWritingScope.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWritingScope.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeWritingScope.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWritingScope.cs index 5309c3dbb5..c93131f1ed 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpCodeWritingScope.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpCodeWritingScope.cs @@ -4,7 +4,7 @@ using System; using System.Linq; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration { public struct CSharpCodeWritingScope : IDisposable { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpDisableWarningScope.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpDisableWarningScope.cs similarity index 93% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpDisableWarningScope.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CSharpDisableWarningScope.cs index a74c16d185..414a3d58e1 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpDisableWarningScope.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpDisableWarningScope.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration { public struct CSharpDisableWarningScope : IDisposable { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpLineMappingWriter.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpLineMappingWriter.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpLineMappingWriter.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CSharpLineMappingWriter.cs index fd81e91a20..62aa21a40d 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpLineMappingWriter.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpLineMappingWriter.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CSharpLineMappingWriter : IDisposable { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpPaddingBuilder.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpPaddingBuilder.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpPaddingBuilder.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CSharpPaddingBuilder.cs index 0e0636afb1..2e04451c69 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpPaddingBuilder.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/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.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CSharpPaddingBuilder { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpTagHelperCodeRenderer.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpTagHelperCodeRenderer.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpTagHelperCodeRenderer.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CSharpTagHelperCodeRenderer.cs index de072cc497..fdb05a9879 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/CSharpTagHelperCodeRenderer.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CSharpTagHelperCodeRenderer.cs @@ -5,10 +5,12 @@ using System; 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.TagHelpers; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration { /// /// Renders tag helper rendering code. @@ -604,16 +606,16 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp private static bool TryGetPlainTextValue(Chunk chunk, out string plainText) { - var chunkBlock = chunk as ChunkBlock; + var parentChunk = chunk as ParentChunk; plainText = null; - if (chunkBlock == null || chunkBlock.Children.Count != 1) + if (parentChunk == null || parentChunk.Children.Count != 1) { return false; } - var literalChildChunk = chunkBlock.Children[0] as LiteralChunk; + var literalChildChunk = parentChunk.Children[0] as LiteralChunk; if (literalChildChunk == null) { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeBuilder.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilder.cs similarity index 91% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeBuilder.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilder.cs index ec61b80397..b0b5b265ea 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeBuilder.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilder.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.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration { public abstract class CodeBuilder { diff --git a/src/Microsoft.AspNet.Razor/Generator/CodeBuilderContext.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilderContext.cs similarity index 80% rename from src/Microsoft.AspNet.Razor/Generator/CodeBuilderContext.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilderContext.cs index 6c67012374..badceadda2 100644 --- a/src/Microsoft.AspNet.Razor/Generator/CodeBuilderContext.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilderContext.cs @@ -1,22 +1,24 @@ // 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.Generator +using Microsoft.AspNet.Razor.Chunks.Generators; + +namespace Microsoft.AspNet.Razor.CodeGeneration { /// /// Context object with information used to generate a Razor page. /// - public class CodeBuilderContext : CodeGeneratorContext + public class CodeBuilderContext : ChunkGeneratorContext { /// /// Instantiates a new instance of the object. /// - /// A to copy information from. + /// A to copy information from. /// /// The used to collect s encountered /// when parsing the current Razor document. /// - public CodeBuilderContext(CodeGeneratorContext generatorContext, ErrorSink errorSink) + public CodeBuilderContext(ChunkGeneratorContext generatorContext, ErrorSink errorSink) : base(generatorContext) { ErrorSink = errorSink; @@ -41,14 +43,14 @@ namespace Microsoft.AspNet.Razor.Generator /// /// /// forces C# generation to write - /// s to the output page, i.e. WriteLiteral("Hello World"). - /// writes values in their + /// s to the output page, i.e. WriteLiteral("Hello World"). + /// writes values in their /// rawest form, i.g. "Hello World". /// public ExpressionRenderingMode ExpressionRenderingMode { get; set; } /// - /// The C# writer to write information to. + /// The C# writer to write information to. /// /// /// If is null values will be written using a default write method @@ -60,7 +62,7 @@ namespace Microsoft.AspNet.Razor.Generator /// /// Gets or sets the SHA1 based checksum for the file whose location is defined by - /// . + /// . /// public string Checksum { get; set; } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeBuilderResult.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilderResult.cs similarity index 91% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeBuilderResult.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilderResult.cs index ef7353c737..5024c37917 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeBuilderResult.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CodeBuilderResult.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CodeBuilderResult { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeWriter.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/CodeWriter.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeWriter.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/CodeWriter.cs index 9cfd331f1e..f0f43b0027 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeWriter.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/CodeWriter.cs @@ -4,7 +4,7 @@ using System; using System.IO; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CodeWriter : IDisposable { @@ -22,16 +22,16 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler public int CurrentIndent { get; private set; } - public string NewLine - { + public string NewLine + { get { return _writer.NewLine; - } + } set { _writer.NewLine = value; - } + } } public CodeWriter ResetIndent() diff --git a/src/Microsoft.AspNet.Razor/Generator/ExpressionRenderingMode.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/ExpressionRenderingMode.cs similarity index 75% rename from src/Microsoft.AspNet.Razor/Generator/ExpressionRenderingMode.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/ExpressionRenderingMode.cs index 6db6378253..c7a21419f9 100644 --- a/src/Microsoft.AspNet.Razor/Generator/ExpressionRenderingMode.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/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.Generator +namespace Microsoft.AspNet.Razor.CodeGeneration { public enum ExpressionRenderingMode { @@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Razor.Generator /// Indicates that expressions should be written to the output stream /// /// - /// If @foo is rendered with WriteToOutput, the code generator would output the following code: + /// If @foo is rendered with WriteToOutput, the code builder would output the following code: /// /// Write(foo); /// @@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Razor.Generator /// the code exists will be used to render it /// /// - /// If @foo is rendered with InjectCode, the code generator would output the following code: + /// If @foo is rendered with InjectCode, the code builder would output the following code: /// /// foo /// diff --git a/src/Microsoft.AspNet.Razor/Generator/GeneratedClassContext.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedClassContext.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/Generator/GeneratedClassContext.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedClassContext.cs index fcf4dac1b4..3d6232a911 100644 --- a/src/Microsoft.AspNet.Razor/Generator/GeneratedClassContext.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedClassContext.cs @@ -6,7 +6,7 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.Framework.Internal; using Microsoft.Internal.Web.Utils; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.CodeGeneration { public struct GeneratedClassContext { diff --git a/src/Microsoft.AspNet.Razor/Generator/GeneratedTagHelperContext.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedTagHelperContext.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/Generator/GeneratedTagHelperContext.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/GeneratedTagHelperContext.cs index 060d3fd2f9..4f095f7d12 100644 --- a/src/Microsoft.AspNet.Razor/Generator/GeneratedTagHelperContext.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/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.Generator +namespace Microsoft.AspNet.Razor.CodeGeneration { /// /// Contains necessary information for the tag helper code generation process. diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/LineMapping.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/LineMapping.cs similarity index 97% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/LineMapping.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/LineMapping.cs index 92df7bd25b..379416986a 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/LineMapping.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/LineMapping.cs @@ -4,7 +4,7 @@ using System.Globalization; using Microsoft.Internal.Web.Utils; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration { public class LineMapping { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/LineMappingManager.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/LineMappingManager.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/LineMappingManager.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/LineMappingManager.cs index d940820ff7..e14f85cbaa 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/LineMappingManager.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/LineMappingManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration { public class LineMappingManager { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/MappingLocation.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/MappingLocation.cs similarity index 98% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/MappingLocation.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/MappingLocation.cs index f899911ce8..3943f2c273 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/LineMappings/MappingLocation.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/MappingLocation.cs @@ -4,7 +4,7 @@ using System.Globalization; using Microsoft.Internal.Web.Utils; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration { public class MappingLocation { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpBaseTypeVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpBaseTypeVisitor.cs similarity index 87% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpBaseTypeVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpBaseTypeVisitor.cs index a41cdba5aa..7be7a0edaf 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpBaseTypeVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpBaseTypeVisitor.cs @@ -1,9 +1,10 @@ // 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.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public class CSharpBaseTypeVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpCodeVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpCodeVisitor.cs similarity index 99% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpCodeVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpCodeVisitor.cs index 12b2d4e98e..de1a723a99 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpCodeVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpCodeVisitor.cs @@ -3,10 +3,11 @@ using System.Globalization; using System.Linq; +using Microsoft.AspNet.Razor.Chunks; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public class CSharpCodeVisitor : CodeVisitor { @@ -70,7 +71,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp TagHelperRenderer.RenderTagHelper(chunk); } - protected override void Visit(ChunkBlock chunk) + protected override void Visit(ParentChunk chunk) { Accept(chunk.Children); } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpDesignTimeHelpersVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpDesignTimeHelpersVisitor.cs similarity index 96% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpDesignTimeHelpersVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpDesignTimeHelpersVisitor.cs index 70b06ea7eb..79c39d976e 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpDesignTimeHelpersVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpDesignTimeHelpersVisitor.cs @@ -3,9 +3,10 @@ using System.Diagnostics; using System.Globalization; +using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public class CSharpDesignTimeHelpersVisitor : CodeVisitor { @@ -28,7 +29,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp _csharpCodeVisitor = csharpCodeVisitor; } - public void AcceptTree(CodeTree tree) + public void AcceptTree(ChunkTree tree) { if (Context.Host.DesignTimeMode) { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperAttributeValueVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperAttributeValueVisitor.cs similarity index 96% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperAttributeValueVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperAttributeValueVisitor.cs index 62939e2ff4..78be832684 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperAttributeValueVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperAttributeValueVisitor.cs @@ -1,11 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNet.Razor.Chunks; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { /// /// that writes code for a non- tag helper @@ -44,11 +45,11 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp /// /// Writes code for the given . /// - /// The to render. + /// The to render. /// /// Tracks code mappings for all children while writing. /// - protected override void Visit(ChunkBlock chunk) + protected override void Visit(ParentChunk chunk) { // Line mappings are captured in RenderCode(), not this method. _firstChild = true; @@ -97,7 +98,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp /// The to render. /// /// Allowed to support future C# extensions. Likely "~/..." will lead to a C# compilation error but that is up - /// to the compiler. + /// to the . /// protected override void Visit(ResolveUrlChunk chunk) { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs similarity index 84% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs index 0ad56b5802..9bb42da3a7 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs @@ -3,9 +3,10 @@ using System; using System.Collections.Generic; +using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public class CSharpTagHelperFieldDeclarationVisitor : CodeVisitor { @@ -80,20 +81,20 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp public override void Accept(Chunk chunk) { - var chunkBlock = chunk as ChunkBlock; + var parentChunk = chunk as ParentChunk; - // If we're any ChunkBlock other than TagHelperChunk then we want to dive into its Children + // If we're any ParentChunk other than TagHelperChunk then we want to dive into its Children // to search for more TagHelperChunk chunks. This if-statement enables us to not override - // each of the special ChunkBlock types and then dive into their children. - if (chunkBlock != null && !(chunkBlock is TagHelperChunk)) + // each of the special ParentChunk types and then dive into their children. + if (parentChunk != null && !(parentChunk is TagHelperChunk)) { - Accept(chunkBlock.Children); + Accept(parentChunk.Children); } else { - // If we're a TagHelperChunk or any other non ChunkBlock we ".Accept" it. This ensures - // that our overriden Visit(TagHelperChunk) method gets called and is not skipped over. - // If we're a non ChunkBlock or a TagHelperChunk then we want to just invoke the Visit + // If we're a TagHelperChunk or any other non ParentChunk we ".Accept" it. This ensures + // that our overridden Visit(TagHelperChunk) method gets called and is not skipped over. + // If we're a non ParentChunk or a TagHelperChunk then we want to just invoke the Visit // method for that given chunk (base.Accept indirectly calls the Visit method). base.Accept(chunk); } diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs similarity index 95% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs index 7ddd73d8b5..cdee32d516 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTagHelperRunnerInitializationVisitor.cs @@ -1,9 +1,10 @@ // 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.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { /// /// The that generates the code to initialize the TagHelperRunner. diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTypeMemberVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTypeMemberVisitor.cs similarity index 90% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTypeMemberVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTypeMemberVisitor.cs index 29089c2661..e31de3c314 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpTypeMemberVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpTypeMemberVisitor.cs @@ -1,9 +1,10 @@ // 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.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public class CSharpTypeMemberVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpUsingVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpUsingVisitor.cs similarity index 96% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpUsingVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpUsingVisitor.cs index 449b22b6ed..9c36ec6875 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpUsingVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CSharpUsingVisitor.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; +using Microsoft.AspNet.Razor.Chunks; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public class CSharpUsingVisitor : CodeVisitor { diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/ChunkVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/ChunkVisitor.cs similarity index 94% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/ChunkVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/ChunkVisitor.cs index ab7859604c..f2737d35dd 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/ChunkVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/ChunkVisitor.cs @@ -2,9 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; +using Microsoft.AspNet.Razor.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public abstract class ChunkVisitor : IChunkVisitor where TWriter : CodeWriter @@ -96,9 +97,9 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler { Visit((TemplateChunk)chunk); } - else if (chunk is ChunkBlock) + else if (chunk is ParentChunk) { - Visit((ChunkBlock)chunk); + Visit((ParentChunk)chunk); } } @@ -110,7 +111,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler protected abstract void Visit(AddTagHelperChunk chunk); protected abstract void Visit(RemoveTagHelperChunk chunk); protected abstract void Visit(UsingChunk chunk); - protected abstract void Visit(ChunkBlock chunk); + protected abstract void Visit(ParentChunk chunk); protected abstract void Visit(DynamicCodeAttributeChunk chunk); protected abstract void Visit(LiteralCodeAttributeChunk chunk); protected abstract void Visit(CodeAttributeChunk chunk); diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CodeVisitor.cs similarity index 92% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CodeVisitor.cs index ffdbe7ba29..aa2795baf6 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CodeVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/CodeVisitor.cs @@ -1,9 +1,10 @@ // 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.Chunks; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public class CodeVisitor : ChunkVisitor where TWriter : CodeWriter @@ -28,7 +29,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler protected override void Visit(UsingChunk chunk) { } - protected override void Visit(ChunkBlock chunk) + protected override void Visit(ParentChunk chunk) { } protected override void Visit(DynamicCodeAttributeChunk chunk) diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/IChunkVisitor.cs b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/IChunkVisitor.cs similarity index 77% rename from src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/IChunkVisitor.cs rename to src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/IChunkVisitor.cs index b33a32e506..00f97470d6 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/IChunkVisitor.cs +++ b/src/Microsoft.AspNet.Razor/CodeGeneration/Visitors/IChunkVisitor.cs @@ -2,8 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; +using Microsoft.AspNet.Razor.Chunks; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration.Visitors { public interface IChunkVisitor { diff --git a/src/Microsoft.AspNet.Razor/DocumentParseCompleteEventArgs.cs b/src/Microsoft.AspNet.Razor/DocumentParseCompleteEventArgs.cs index 781b9541ad..c1cf0dff67 100644 --- a/src/Microsoft.AspNet.Razor/DocumentParseCompleteEventArgs.cs +++ b/src/Microsoft.AspNet.Razor/DocumentParseCompleteEventArgs.cs @@ -12,17 +12,17 @@ namespace Microsoft.AspNet.Razor public class DocumentParseCompleteEventArgs : EventArgs { /// - /// Indicates if the tree structure has actually changed since the previous reparse. + /// Indicates if the tree structure has actually changed since the previous re-parse. /// public bool TreeStructureChanged { get; set; } /// - /// The results of the code generation and parsing + /// The results of the chunk generation and parsing /// public GeneratorResults GeneratorResults { get; set; } /// - /// The TextChange which triggered the reparse + /// The TextChange which triggered the re-parse /// public TextChange SourceChange { get; set; } } diff --git a/src/Microsoft.AspNet.Razor/Generator/CSharpRazorCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Generator/CSharpRazorCodeGenerator.cs deleted file mode 100644 index a580687563..0000000000 --- a/src/Microsoft.AspNet.Razor/Generator/CSharpRazorCodeGenerator.cs +++ /dev/null @@ -1,24 +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.Framework.Internal; - -namespace Microsoft.AspNet.Razor.Generator -{ - public class CSharpRazorCodeGenerator : RazorCodeGenerator - { - public CSharpRazorCodeGenerator( - string className, - [NotNull] string rootNamespaceName, - string sourceFileName, - [NotNull] RazorEngineHost host) - : base(className, rootNamespaceName, sourceFileName, host) - { - } - - protected override void Initialize(CodeGeneratorContext context) - { - base.Initialize(context); - } - } -} diff --git a/src/Microsoft.AspNet.Razor/Generator/CodeGeneratorContext.cs b/src/Microsoft.AspNet.Razor/Generator/CodeGeneratorContext.cs deleted file mode 100644 index 2499fc7724..0000000000 --- a/src/Microsoft.AspNet.Razor/Generator/CodeGeneratorContext.cs +++ /dev/null @@ -1,44 +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.Generator.Compiler; - -namespace Microsoft.AspNet.Razor.Generator -{ - public class CodeGeneratorContext - { - protected CodeGeneratorContext(CodeGeneratorContext context) - : this(context.Host, - context.ClassName, - context.RootNamespace, - context.SourceFile, - // True because we're pulling from the provided context's source file. - shouldGenerateLinePragmas: true) - { - CodeTreeBuilder = context.CodeTreeBuilder; - } - - public CodeGeneratorContext(RazorEngineHost host, - string className, - string rootNamespace, - string sourceFile, - bool shouldGenerateLinePragmas) - { - CodeTreeBuilder = new CodeTreeBuilder(); - Host = host; - SourceFile = shouldGenerateLinePragmas ? sourceFile : null; - RootNamespace = rootNamespace; - ClassName = className; - } - - public string SourceFile { get; internal set; } - - public string RootNamespace { get; private set; } - - public string ClassName { get; private set; } - - public RazorEngineHost Host { get; private set; } - - public CodeTreeBuilder CodeTreeBuilder { get; set; } - } -} diff --git a/src/Microsoft.AspNet.Razor/Generator/HybridCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Generator/HybridCodeGenerator.cs deleted file mode 100644 index cd791140db..0000000000 --- a/src/Microsoft.AspNet.Razor/Generator/HybridCodeGenerator.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.Generator -{ - public abstract class HybridCodeGenerator : ISpanCodeGenerator, IBlockCodeGenerator - { - public virtual void GenerateStartBlockCode(Block target, CodeGeneratorContext context) - { - } - - public virtual void GenerateEndBlockCode(Block target, CodeGeneratorContext context) - { - } - - public virtual void GenerateCode(Span target, CodeGeneratorContext context) - { - } - } -} diff --git a/src/Microsoft.AspNet.Razor/Generator/IBlockCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Generator/IBlockCodeGenerator.cs deleted file mode 100644 index 2d54e4c040..0000000000 --- a/src/Microsoft.AspNet.Razor/Generator/IBlockCodeGenerator.cs +++ /dev/null @@ -1,13 +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.Generator -{ - public interface IBlockCodeGenerator - { - void GenerateStartBlockCode(Block target, CodeGeneratorContext context); - void GenerateEndBlockCode(Block target, CodeGeneratorContext context); - } -} diff --git a/src/Microsoft.AspNet.Razor/Generator/TemplateBlockCodeGenerator.cs b/src/Microsoft.AspNet.Razor/Generator/TemplateBlockCodeGenerator.cs deleted file mode 100644 index 0a1918ca10..0000000000 --- a/src/Microsoft.AspNet.Razor/Generator/TemplateBlockCodeGenerator.cs +++ /dev/null @@ -1,21 +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.Generator.Compiler; -using Microsoft.AspNet.Razor.Parser.SyntaxTree; - -namespace Microsoft.AspNet.Razor.Generator -{ - public class TemplateBlockCodeGenerator : BlockCodeGenerator - { - public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context) - { - context.CodeTreeBuilder.StartChunkBlock(target); - } - - public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context) - { - context.CodeTreeBuilder.EndChunkBlock(); - } - } -} diff --git a/src/Microsoft.AspNet.Razor/GeneratorResults.cs b/src/Microsoft.AspNet.Razor/GeneratorResults.cs index b93e88b61a..a96f61dd32 100644 --- a/src/Microsoft.AspNet.Razor/GeneratorResults.cs +++ b/src/Microsoft.AspNet.Razor/GeneratorResults.cs @@ -2,7 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator.Compiler; +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; @@ -19,15 +20,15 @@ namespace Microsoft.AspNet.Razor /// /// The results of parsing a document. /// The results of generating code for the document. - /// A for the document. + /// A for the document. public GeneratorResults([NotNull] ParserResults parserResults, [NotNull] CodeBuilderResult codeBuilderResult, - [NotNull] CodeTree codeTree) + [NotNull] ChunkTree chunkTree) : this(parserResults.Document, parserResults.TagHelperDescriptors, parserResults.ErrorSink, codeBuilderResult, - codeTree) + chunkTree) { } @@ -43,17 +44,17 @@ namespace Microsoft.AspNet.Razor /// current Razor document. /// /// The results of generating code for the document. - /// A for the document. + /// A for the document. public GeneratorResults([NotNull] Block document, [NotNull] IEnumerable tagHelperDescriptors, [NotNull] ErrorSink errorSink, [NotNull] CodeBuilderResult codeBuilderResult, - [NotNull] CodeTree codeTree) + [NotNull] ChunkTree chunkTree) : base(document, tagHelperDescriptors, errorSink) { GeneratedCode = codeBuilderResult.Code; DesignTimeLineMappings = codeBuilderResult.DesignTimeLineMappings; - CodeTree = codeTree; + ChunkTree = chunkTree; } /// @@ -67,8 +68,8 @@ namespace Microsoft.AspNet.Razor public IList DesignTimeLineMappings { get; } /// - /// A for the document. + /// A for the document. /// - public CodeTree CodeTree { get; } + public ChunkTree ChunkTree { get; } } } diff --git a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Directives.cs b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Directives.cs index 1f7685a1aa..6075b489d4 100644 --- a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Directives.cs +++ b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Directives.cs @@ -4,7 +4,7 @@ using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Razor.Parser { TagHelperDirective( SyntaxConstants.CSharp.TagHelperPrefixKeyword, - prefix => new TagHelperPrefixDirectiveCodeGenerator(prefix)); + prefix => new TagHelperPrefixDirectiveChunkGenerator(prefix)); } protected virtual void AddTagHelperDirective() @@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Razor.Parser TagHelperDirective( SyntaxConstants.CSharp.AddTagHelperKeyword, lookupText => - new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors: false, lookupText: lookupText)); + new AddOrRemoveTagHelperChunkGenerator(removeTagHelperDescriptors: false, lookupText: lookupText)); } protected virtual void RemoveTagHelperDirective() @@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Razor.Parser TagHelperDirective( SyntaxConstants.CSharp.RemoveTagHelperKeyword, lookupText => - new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors: true, lookupText: lookupText)); + new AddOrRemoveTagHelperChunkGenerator(removeTagHelperDescriptors: true, lookupText: lookupText)); } protected virtual void SectionDirective() @@ -90,7 +90,7 @@ namespace Microsoft.AspNet.Razor.Parser sectionName = CurrentSymbol.Content; AcceptAndMoveNext(); } - Context.CurrentBlock.CodeGenerator = new SectionCodeGenerator(sectionName); + Context.CurrentBlock.ChunkGenerator = new SectionChunkGenerator(sectionName); var errorLocation = CurrentLocation; whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: false)); @@ -128,7 +128,7 @@ namespace Microsoft.AspNet.Razor.Parser Output(SpanKind.MetaCode); SectionBlock("{", "}", caseSensitive: true); - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; // Check for the terminating "}" if (!Optional(CSharpSymbolType.RightBrace)) { @@ -182,7 +182,7 @@ namespace Microsoft.AspNet.Razor.Parser Span.EditHandler = editHandler; Balance(BalancingModes.NoErrorOnFailure, CSharpSymbolType.LeftBrace, CSharpSymbolType.RightBrace, blockStart); - Span.CodeGenerator = new TypeMemberCodeGenerator(); + Span.ChunkGenerator = new TypeMemberChunkGenerator(); if (!At(CSharpSymbolType.RightBrace)) { editHandler.AutoCompleteString = "}"; @@ -194,7 +194,7 @@ namespace Microsoft.AspNet.Razor.Parser { Output(SpanKind.Code); Assert(CSharpSymbolType.RightBrace); - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; AcceptAndMoveNext(); CompleteBlock(); @@ -222,10 +222,10 @@ namespace Microsoft.AspNet.Razor.Parser protected void InheritsDirectiveCore() { - BaseTypeDirective(RazorResources.ParseError_InheritsKeyword_Must_Be_Followed_By_TypeName, baseType => new SetBaseTypeCodeGenerator(baseType)); + BaseTypeDirective(RazorResources.ParseError_InheritsKeyword_Must_Be_Followed_By_TypeName, baseType => new SetBaseTypeChunkGenerator(baseType)); } - protected void BaseTypeDirective(string noTypeNameError, Func createCodeGenerator) + protected void BaseTypeDirective(string noTypeNameError, Func createChunkGenerator) { var keywordStartLocation = Span.Start; @@ -270,15 +270,15 @@ namespace Microsoft.AspNet.Razor.Parser // Pull out the type name string baseType = Span.GetContent(); - // Set up code generation - Span.CodeGenerator = createCodeGenerator(baseType.Trim()); + // Set up chunk generation + Span.ChunkGenerator = createChunkGenerator(baseType.Trim()); // Output the span and finish the block CompleteBlock(); Output(SpanKind.Code, AcceptedCharacters.AnyExceptNewline); } - private void TagHelperDirective(string keyword, Func buildCodeGenerator) + private void TagHelperDirective(string keyword, Func buildChunkGenerator) { AssertDirective(keyword); var keywordStartLocation = CurrentLocation; @@ -321,16 +321,16 @@ namespace Microsoft.AspNet.Razor.Parser // If the value starts with a quote then we should generate appropriate C# code to colorize the value. if (startsWithQuote) { - // Set up code generation - // The generated chunk of this code generator is picked up by CSharpDesignTimeHelpersVisitor which + // Set up chunk generation + // The generated chunk of this chunk generator is picked up by CSharpDesignTimeHelpersVisitor which // renders the C# to colorize the user provided value. We trim the quotes around the user's value // so when we render the code we can project the users value into double quotes to not invoke C# // IntelliSense. - Span.CodeGenerator = buildCodeGenerator(rawValue.Trim('"')); + Span.ChunkGenerator = buildChunkGenerator(rawValue.Trim('"')); } // We expect the directive to be surrounded in quotes. - // The format for taghelper directives are: @directivename "SomeValue" + // The format for tag helper directives are: @directivename "SomeValue" if (!startsWithQuote || !rawValue.EndsWith("\"", StringComparison.OrdinalIgnoreCase)) { diff --git a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Statements.cs b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Statements.cs index 29269ce41b..adc738807e 100644 --- a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Statements.cs +++ b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.Statements.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -29,7 +29,7 @@ namespace Microsoft.AspNet.Razor.Parser Context.OnError(CurrentLocation, RazorResources.FormatParseError_ReservedWord(CurrentSymbol.Content)); AcceptAndMoveNext(); Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Context.CurrentBlock.Type = BlockType.Directive; CompleteBlock(); Output(SpanKind.MetaCode); @@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Razor.Parser HandleKeyword(topLevel, () => { Context.CurrentBlock.Type = BlockType.Expression; - Context.CurrentBlock.CodeGenerator = new ExpressionCodeGenerator(); + Context.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); ImplicitExpression(); }); } @@ -158,7 +158,7 @@ namespace Microsoft.AspNet.Razor.Parser } Span.EditHandler.AcceptedCharacters = AcceptedCharacters.AnyExceptNewline; - Span.CodeGenerator = new AddImportCodeGenerator( + Span.ChunkGenerator = new AddImportChunkGenerator( Span.GetContent(symbols => symbols.Skip(1))); // Optional ";" @@ -510,7 +510,7 @@ namespace Microsoft.AspNet.Razor.Parser // Output "@" as hidden span Accept(transition); - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKind.Code); Assert(CSharpSymbolType.Transition); diff --git a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.cs b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.cs index 6ff789c69e..7d687d49c3 100644 --- a/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.cs +++ b/src/Microsoft.AspNet.Razor/Parser/CSharpCodeParser.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Tokenizer; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -181,7 +181,7 @@ namespace Microsoft.AspNet.Razor.Parser private void DefaultSpanConfig(SpanBuilder span) { span.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); - span.CodeGenerator = new StatementCodeGenerator(); + span.ChunkGenerator = new StatementChunkGenerator(); } private void AtTransition(CSharpSymbol current) @@ -189,7 +189,7 @@ namespace Microsoft.AspNet.Razor.Parser Debug.Assert(current.Type == CSharpSymbolType.Transition); Accept(current); Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; // Output the "@" span and continue here Output(SpanKind.Transition); @@ -209,7 +209,7 @@ namespace Microsoft.AspNet.Razor.Parser if (CurrentSymbol.Type == CSharpSymbolType.LeftParenthesis) { Context.CurrentBlock.Type = BlockType.Expression; - Context.CurrentBlock.CodeGenerator = new ExpressionCodeGenerator(); + Context.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); ExplicitExpression(); return; } @@ -218,14 +218,14 @@ namespace Microsoft.AspNet.Razor.Parser Action handler; if (TryGetDirectiveHandler(CurrentSymbol.Content, out handler)) { - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; handler(); return; } else { Context.CurrentBlock.Type = BlockType.Expression; - Context.CurrentBlock.CodeGenerator = new ExpressionCodeGenerator(); + Context.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); ImplicitExpression(); return; } @@ -244,9 +244,9 @@ namespace Microsoft.AspNet.Razor.Parser // Invalid character Context.CurrentBlock.Type = BlockType.Expression; - Context.CurrentBlock.CodeGenerator = new ExpressionCodeGenerator(); + Context.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); AddMarkerSymbolIfNecessary(); - Span.CodeGenerator = new ExpressionCodeGenerator(); + Span.ChunkGenerator = new ExpressionChunkGenerator(); Span.EditHandler = new ImplicitExpressionEditHandler( Language.TokenizeString, DefaultKeywords, @@ -283,7 +283,7 @@ namespace Microsoft.AspNet.Razor.Parser // Set up the "{" span and output Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKind.MetaCode); // Set up auto-complete and parse the code block @@ -291,7 +291,7 @@ namespace Microsoft.AspNet.Razor.Parser Span.EditHandler = editHandler; CodeBlock(false, block); - Span.CodeGenerator = new StatementCodeGenerator(); + Span.ChunkGenerator = new StatementChunkGenerator(); AddMarkerSymbolIfNecessary(); if (!At(CSharpSymbolType.RightBrace)) { @@ -303,7 +303,7 @@ namespace Microsoft.AspNet.Razor.Parser { // Set up the "}" span Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; } if (!At(CSharpSymbolType.WhiteSpace) && !At(CSharpSymbolType.NewLine)) @@ -330,13 +330,13 @@ namespace Microsoft.AspNet.Razor.Parser private void ImplicitExpression(AcceptedCharacters acceptedCharacters) { Context.CurrentBlock.Type = BlockType.Expression; - Context.CurrentBlock.CodeGenerator = new ExpressionCodeGenerator(); + Context.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); using (PushSpanConfig(span => { span.EditHandler = new ImplicitExpressionEditHandler(Language.TokenizeString, Keywords, acceptTrailingDot: IsNested); span.EditHandler.AcceptedCharacters = acceptedCharacters; - span.CodeGenerator = new ExpressionCodeGenerator(); + span.ChunkGenerator = new ExpressionChunkGenerator(); })) { do @@ -504,7 +504,7 @@ namespace Microsoft.AspNet.Razor.Parser private void ConfigureExplicitExpressionSpan(SpanBuilder sb) { sb.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); - sb.CodeGenerator = new ExpressionCodeGenerator(); + sb.ChunkGenerator = new ExpressionChunkGenerator(); } private void ExplicitExpression() @@ -513,7 +513,7 @@ namespace Microsoft.AspNet.Razor.Parser Assert(CSharpSymbolType.LeftParenthesis); AcceptAndMoveNext(); Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKind.MetaCode); using (PushSpanConfig(ConfigureExplicitExpressionSpan)) { @@ -544,7 +544,7 @@ namespace Microsoft.AspNet.Razor.Parser PutCurrentBack(); } Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; CompleteBlock(insertMarkerIfNecessary: false); Output(SpanKind.MetaCode); } @@ -558,7 +558,7 @@ namespace Microsoft.AspNet.Razor.Parser Output(SpanKind.Code); using (Context.StartBlock(BlockType.Template)) { - Context.CurrentBlock.CodeGenerator = new TemplateBlockCodeGenerator(); + Context.CurrentBlock.ChunkGenerator = new TemplateBlockChunkGenerator(); PutCurrentBack(); OtherParserBlock(); } diff --git a/src/Microsoft.AspNet.Razor/Parser/ConditionalAttributeCollapser.cs b/src/Microsoft.AspNet.Razor/Parser/ConditionalAttributeCollapser.cs index f8fd85396d..73be90198c 100644 --- a/src/Microsoft.AspNet.Razor/Parser/ConditionalAttributeCollapser.cs +++ b/src/Microsoft.AspNet.Razor/Parser/ConditionalAttributeCollapser.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using System.Linq; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Tokenizer; @@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Razor.Parser protected override bool CanRewrite(Block block) { - var gen = block.CodeGenerator as AttributeBlockCodeGenerator; + var gen = block.ChunkGenerator as AttributeBlockChunkGenerator; return gen != null && block.Children.Any() && block.Children.All(IsLiteralAttributeValue); } @@ -44,12 +44,12 @@ namespace Microsoft.AspNet.Razor.Parser var span = node as Span; Debug.Assert(span != null); - var litGen = span.CodeGenerator as LiteralAttributeCodeGenerator; + var litGen = span.ChunkGenerator as LiteralAttributeChunkGenerator; return span != null && ((litGen != null && litGen.ValueGenerator == null) || - span.CodeGenerator == SpanCodeGenerator.Null || - span.CodeGenerator is MarkupCodeGenerator); + span.ChunkGenerator == SpanChunkGenerator.Null || + span.ChunkGenerator is MarkupChunkGenerator); } } } diff --git a/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs b/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs index 70e3fca0bb..ac6521c6e6 100644 --- a/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs +++ b/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.Block.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -50,11 +50,11 @@ namespace Microsoft.AspNet.Razor.Parser Assert(HtmlSymbolType.Transition); AcceptAndMoveNext(); Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKind.Transition); if (At(HtmlSymbolType.Transition)) { - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; AcceptAndMoveNext(); Output(SpanKind.MetaCode); } @@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Razor.Parser private void DefaultMarkupSpan(SpanBuilder span) { - span.CodeGenerator = new MarkupCodeGenerator(); + span.ChunkGenerator = new MarkupChunkGenerator(); span.EditHandler = new SpanEditHandler(Language.TokenizeString, AcceptedCharacters.Any); } @@ -85,7 +85,7 @@ namespace Microsoft.AspNet.Razor.Parser // The first part (left) is added to this span and we return a MetaCode span Accept(split.Item1); - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKind.MetaCode); if (split.Item2 != null) { @@ -368,7 +368,7 @@ namespace Microsoft.AspNet.Razor.Parser Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; } - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; CompleteTagBlockWithSpan(tagBlockWrapper, Span.EditHandler.AcceptedCharacters, SpanKind.Transition); @@ -524,7 +524,7 @@ namespace Microsoft.AspNet.Razor.Parser if (attributeCanBeConditional) { - Span.CodeGenerator = SpanCodeGenerator.Null; // The block code generator will render the prefix + Span.ChunkGenerator = SpanChunkGenerator.Null; // The block chunk generator will render the prefix Output(SpanKind.Markup); // Read the values @@ -543,12 +543,13 @@ namespace Microsoft.AspNet.Razor.Parser if (Span.Symbols.Count > 0) { - Span.CodeGenerator = SpanCodeGenerator.Null; // Again, block code generator will render the suffix + // Again, block chunk generator will render the suffix + Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKind.Markup); } - // Create the block code generator - Context.CurrentBlock.CodeGenerator = new AttributeBlockCodeGenerator( + // Create the block chunk generator + Context.CurrentBlock.ChunkGenerator = new AttributeBlockChunkGenerator( name, prefix, suffix); } else @@ -585,13 +586,13 @@ namespace Microsoft.AspNet.Razor.Parser Accept(prefix); // Render a single "@" in place of "@@". - Span.CodeGenerator = new LiteralAttributeCodeGenerator( + Span.ChunkGenerator = new LiteralAttributeChunkGenerator( prefix.GetContent(prefixStart), new LocationTagged(CurrentSymbol.GetContent(), CurrentLocation)); AcceptAndMoveNext(); Output(SpanKind.Markup, AcceptedCharacters.None); - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; AcceptAndMoveNext(); Output(SpanKind.Markup, AcceptedCharacters.None); } @@ -602,14 +603,14 @@ namespace Microsoft.AspNet.Razor.Parser var valueStart = CurrentLocation; PutCurrentBack(); - // Output the prefix but as a null-span. DynamicAttributeBlockCodeGenerator will render it - Span.CodeGenerator = SpanCodeGenerator.Null; + // Output the prefix but as a null-span. DynamicAttributeBlockChunkGenerator will render it + Span.ChunkGenerator = SpanChunkGenerator.Null; - // Dynamic value, start a new block and set the code generator + // Dynamic value, start a new block and set the chunk generator using (Context.StartBlock(BlockType.Markup)) { - Context.CurrentBlock.CodeGenerator = - new DynamicAttributeBlockCodeGenerator(prefix.GetContent(prefixStart), valueStart); + Context.CurrentBlock.ChunkGenerator = + new DynamicAttributeBlockChunkGenerator(prefix.GetContent(prefixStart), valueStart); OtherParserBlock(); } @@ -625,9 +626,9 @@ namespace Microsoft.AspNet.Razor.Parser // Virtual Path value var valueStart = CurrentLocation; VirtualPath(); - Span.CodeGenerator = new LiteralAttributeCodeGenerator( + Span.ChunkGenerator = new LiteralAttributeChunkGenerator( prefix.GetContent(prefixStart), - new LocationTagged(new ResolveUrlCodeGenerator(), valueStart)); + new LocationTagged(new ResolveUrlChunkGenerator(), valueStart)); } else { @@ -644,7 +645,7 @@ namespace Microsoft.AspNet.Razor.Parser // but for now that's ok) !IsEndOfAttributeValue(quote, sym)); Accept(value); - Span.CodeGenerator = new LiteralAttributeCodeGenerator(prefix.GetContent(prefixStart), value.GetContent(prefixStart)); + Span.ChunkGenerator = new LiteralAttributeChunkGenerator(prefix.GetContent(prefixStart), value.GetContent(prefixStart)); } Output(SpanKind.Markup); } @@ -770,7 +771,7 @@ namespace Microsoft.AspNet.Razor.Parser string.Equals(tag.Item1.Content, SyntaxConstants.TextTagName, StringComparison.OrdinalIgnoreCase)) { Output(SpanKind.Markup); - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Accept(_bufferedOpenAngle); Assert(HtmlSymbolType.Text); @@ -1058,7 +1059,7 @@ namespace Microsoft.AspNet.Razor.Parser // Accept and mark the whitespace at the end of a tag as code. AcceptWhile(HtmlSymbolType.WhiteSpace); - Span.CodeGenerator = new StatementCodeGenerator(); + Span.ChunkGenerator = new StatementChunkGenerator(); Output(SpanKind.Code); } else diff --git a/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.cs b/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.cs index e0c1e51bed..5486d3d4e8 100644 --- a/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.cs +++ b/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Tokenizer; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Razor.Parser public override void BuildSpan(SpanBuilder span, SourceLocation start, string content) { span.Kind = SpanKind.Markup; - span.CodeGenerator = new MarkupCodeGenerator(); + span.ChunkGenerator = new MarkupChunkGenerator(); base.BuildSpan(span, start, content); } @@ -96,7 +96,7 @@ namespace Microsoft.AspNet.Razor.Parser } Output(SpanKind.Markup); Accept(transition); - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKind.Markup); AcceptAndMoveNext(); continue; // while @@ -212,7 +212,7 @@ namespace Microsoft.AspNet.Razor.Parser AcceptAndMoveNext(); // Setup the metacode span that we will be outputing. - Span.CodeGenerator = SpanCodeGenerator.Null; + Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKind.MetaCode, AcceptedCharacters.None); } } diff --git a/src/Microsoft.AspNet.Razor/Parser/MarkupCollapser.cs b/src/Microsoft.AspNet.Razor/Parser/MarkupCollapser.cs index bef610b895..96a59a9842 100644 --- a/src/Microsoft.AspNet.Razor/Parser/MarkupCollapser.cs +++ b/src/Microsoft.AspNet.Razor/Parser/MarkupCollapser.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; namespace Microsoft.AspNet.Razor.Parser @@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Razor.Parser protected override bool CanRewrite(Span span) { - return span.Kind == SpanKind.Markup && span.CodeGenerator is MarkupCodeGenerator; + return span.Kind == SpanKind.Markup && span.ChunkGenerator is MarkupChunkGenerator; } protected override SyntaxTreeNode RewriteSpan(BlockBuilder parent, Span span) diff --git a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Block.cs b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Block.cs index d9666f48a7..0e0a2e0ed9 100644 --- a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Block.cs +++ b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Block.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Text; using Microsoft.Internal.Web.Utils; @@ -15,12 +15,12 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree public class Block : SyntaxTreeNode { public Block(BlockBuilder source) - : this(source.Type, source.Children, source.CodeGenerator) + : this(source.Type, source.Children, source.ChunkGenerator) { source.Reset(); } - protected Block(BlockType? type, IEnumerable contents, IBlockCodeGenerator generator) + protected Block(BlockType? type, IEnumerable contents, IParentChunkGenerator generator) { if (type == null) { @@ -29,7 +29,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree Type = type.Value; Children = contents; - CodeGenerator = generator; + ChunkGenerator = generator; foreach (SyntaxTreeNode node in Children) { @@ -38,10 +38,10 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree } // A Test constructor - internal Block(BlockType type, IEnumerable contents, IBlockCodeGenerator generator) + internal Block(BlockType type, IEnumerable contents, IParentChunkGenerator generator) { Type = type; - CodeGenerator = generator; + ChunkGenerator = generator; Children = contents; } @@ -50,7 +50,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree public IEnumerable Children { get; } - public IBlockCodeGenerator CodeGenerator { get; } + public IParentChunkGenerator ChunkGenerator { get; } public override bool IsBlock { @@ -105,7 +105,7 @@ 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, CodeGenerator); + return string.Format(CultureInfo.CurrentCulture, "{0} Block at {1}::{2} (Gen:{3})", Type, Start, Length, ChunkGenerator); } public override bool Equals(object obj) @@ -113,7 +113,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree var other = obj as Block; return other != null && Type == other.Type && - Equals(CodeGenerator, other.CodeGenerator) && + Equals(ChunkGenerator, other.ChunkGenerator) && ChildrenEqual(Children, other.Children); } @@ -121,7 +121,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree { return HashCodeCombiner.Start() .Add(Type) - .Add(CodeGenerator) + .Add(ChunkGenerator) .Add(Children) .CombinedHash; } diff --git a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/BlockBuilder.cs b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/BlockBuilder.cs index 07bd821ac6..51eb9cd357 100644 --- a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/BlockBuilder.cs +++ b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/BlockBuilder.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; namespace Microsoft.AspNet.Razor.Parser.SyntaxTree { @@ -18,13 +18,13 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree { Type = original.Type; Children = new List(original.Children); - CodeGenerator = original.CodeGenerator; + 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")] public BlockType? Type { get; set; } public IList Children { get; private set; } - public IBlockCodeGenerator CodeGenerator { get; set; } + public IParentChunkGenerator ChunkGenerator { get; set; } public virtual Block Build() { @@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree { Type = null; Children = new List(); - CodeGenerator = BlockCodeGenerator.Null; + ChunkGenerator = ParentChunkGenerator.Null; } } } diff --git a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Span.cs b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Span.cs index 33d4e71d1e..66d346402a 100644 --- a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Span.cs +++ b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/Span.cs @@ -7,7 +7,7 @@ using System.Diagnostics; using System.Linq; using System.Text; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree public Span Next { get; protected internal set; } public SpanEditHandler EditHandler { get; protected set; } - public ISpanCodeGenerator CodeGenerator { get; protected set; } + public ISpanChunkGenerator ChunkGenerator { get; protected set; } public override bool IsBlock { @@ -64,7 +64,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree Kind = builder.Kind; Symbols = builder.Symbols; EditHandler = builder.EditHandler; - CodeGenerator = builder.CodeGenerator ?? SpanCodeGenerator.Null; + ChunkGenerator = builder.ChunkGenerator ?? SpanChunkGenerator.Null; _start = builder.Start; // Since we took references to the values in SpanBuilder, clear its references out @@ -94,7 +94,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree builder.Append(EditHandler.ToString()); builder.Append(">"); builder.Append(" Gen: <"); - builder.Append(CodeGenerator.ToString()); + builder.Append(ChunkGenerator.ToString()); builder.Append("> {"); builder.Append(string.Join(";", Symbols.GroupBy(sym => sym.GetType()).Select(grp => string.Concat(grp.Key.Name, ":", grp.Count())))); builder.Append("}"); @@ -144,7 +144,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree return other != null && Kind.Equals(other.Kind) && EditHandler.Equals(other.EditHandler) && - CodeGenerator.Equals(other.CodeGenerator) && + ChunkGenerator.Equals(other.ChunkGenerator) && Symbols.SequenceEqual(other.Symbols); } diff --git a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/SpanBuilder.cs b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/SpanBuilder.cs index 6b77f5f1c9..ce25e39baa 100644 --- a/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/SpanBuilder.cs +++ b/src/Microsoft.AspNet.Razor/Parser/SyntaxTree/SpanBuilder.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree Kind = original.Kind; _symbols = new List(original.Symbols); EditHandler = original.EditHandler; - CodeGenerator = original.CodeGenerator; + ChunkGenerator = original.ChunkGenerator; Start = original.Start; } @@ -39,13 +39,13 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree } public SpanEditHandler EditHandler { get; set; } - public ISpanCodeGenerator CodeGenerator { get; set; } + public ISpanChunkGenerator ChunkGenerator { get; set; } public void Reset() { _symbols = new List(); EditHandler = SpanEditHandler.CreateDefault(s => Enumerable.Empty()); - CodeGenerator = SpanCodeGenerator.Null; + ChunkGenerator = SpanChunkGenerator.Null; Start = SourceLocation.Zero; } diff --git a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlock.cs b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlock.cs index 6b3f5f3362..5a43a26d04 100644 --- a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlock.cs +++ b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlock.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers /// A used to construct a valid /// . public TagHelperBlock(TagHelperBlockBuilder source) - : base(source.Type, source.Children, source.CodeGenerator) + : base(source.Type, source.Children, source.ChunkGenerator) { TagName = source.TagName; Descriptors = source.Descriptors; @@ -103,12 +103,12 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers { return string.Format(CultureInfo.CurrentCulture, "'{0}' (Attrs: {1}) Tag Helper Block at {2}::{3} (Gen:{4})", - TagName, Attributes.Count, Start, Length, CodeGenerator); + TagName, Attributes.Count, Start, Length, ChunkGenerator); } /// /// Determines whether two s are equal by comparing the , - /// , , and + /// , , and /// . /// /// The to check equality against. diff --git a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlockBuilder.cs b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlockBuilder.cs index abc1b1a124..ebed3bb2da 100644 --- a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlockBuilder.cs +++ b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlockBuilder.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.TagHelpers; @@ -52,7 +52,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers Descriptors = descriptors; Attributes = new List>(attributes); Type = BlockType.Tag; - CodeGenerator = new TagHelperCodeGenerator(descriptors); + ChunkGenerator = new TagHelperChunkGenerator(descriptors); } // Internal for testing @@ -66,7 +66,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers SelfClosing = selfClosing; Attributes = attributes; Type = BlockType.Tag; - CodeGenerator = new TagHelperCodeGenerator(tagHelperDescriptors: null); + ChunkGenerator = new TagHelperChunkGenerator(tagHelperDescriptors: null); // Children is IList, no AddRange foreach (var child in children) diff --git a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlockRewriter.cs b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlockRewriter.cs index 7ba4c97e06..4032206bb1 100644 --- a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlockRewriter.cs +++ b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperBlockRewriter.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -126,7 +126,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal var afterEquals = false; var builder = new SpanBuilder { - CodeGenerator = span.CodeGenerator, + ChunkGenerator = span.ChunkGenerator, EditHandler = span.EditHandler, Kind = span.Kind }; @@ -322,9 +322,9 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal } } - // We need to rebuild the code generators of the builder and its children (this is needed to - // ensure we don't do special attribute code generation since this is a tag helper). - block = RebuildCodeGenerators(builder.Build()); + // We need to rebuild the chunk generators of the builder and its children (this is needed to + // ensure we don't do special attribute chunk generation since this is a tag helper). + block = RebuildChunkGenerators(builder.Build()); // If there's only 1 child at this point its value could be a simple markup span (treated differently than // block level elements for attributes). @@ -348,16 +348,16 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal return result; } - private static Block RebuildCodeGenerators(Block block) + private static Block RebuildChunkGenerators(Block block) { var builder = new BlockBuilder(block); - var isDynamic = builder.CodeGenerator is DynamicAttributeBlockCodeGenerator; + var isDynamic = builder.ChunkGenerator is DynamicAttributeBlockChunkGenerator; - // We don't want any attribute specific logic here, null out the block code generator. - if (isDynamic || builder.CodeGenerator is AttributeBlockCodeGenerator) + // We don't want any attribute specific logic here, null out the block chunk generator. + if (isDynamic || builder.ChunkGenerator is AttributeBlockChunkGenerator) { - builder.CodeGenerator = BlockCodeGenerator.Null; + builder.ChunkGenerator = ParentChunkGenerator.Null; } for (var i = 0; i < builder.Children.Count; i++) @@ -367,40 +367,40 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal if (child.IsBlock) { // The child is a block, recurse down into the block to rebuild its children - builder.Children[i] = RebuildCodeGenerators((Block)child); + builder.Children[i] = RebuildChunkGenerators((Block)child); } else { var childSpan = (Span)child; - ISpanCodeGenerator newCodeGenerator = null; - var literalGenerator = childSpan.CodeGenerator as LiteralAttributeCodeGenerator; + ISpanChunkGenerator newChunkGenerator = null; + var literalGenerator = childSpan.ChunkGenerator as LiteralAttributeChunkGenerator; if (literalGenerator != null) { if (literalGenerator.ValueGenerator == null || literalGenerator.ValueGenerator.Value == null) { - newCodeGenerator = new MarkupCodeGenerator(); + newChunkGenerator = new MarkupChunkGenerator(); } else { - newCodeGenerator = literalGenerator.ValueGenerator.Value; + newChunkGenerator = literalGenerator.ValueGenerator.Value; } } - else if (isDynamic && childSpan.CodeGenerator == SpanCodeGenerator.Null) + else if (isDynamic && childSpan.ChunkGenerator == SpanChunkGenerator.Null) { - // Usually the dynamic code generator handles rendering the null code generators underneath + // Usually the dynamic chunk generator handles creating the null chunk generators underneath // it. This doesn't make sense in terms of tag helpers though, we need to change null code - // generators to markup code generators. + // generators to markup chunk generators. - newCodeGenerator = new MarkupCodeGenerator(); + newChunkGenerator = new MarkupChunkGenerator(); } - // If we have a new code generator we'll need to re-build the child - if (newCodeGenerator != null) + // If we have a new chunk generator we'll need to re-build the child + if (newChunkGenerator != null) { var childSpanBuilder = new SpanBuilder(childSpan) { - CodeGenerator = newCodeGenerator + ChunkGenerator = newChunkGenerator }; builder.Children[i] = childSpanBuilder.Build(); diff --git a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperDirectiveSpanVisitor.cs b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperDirectiveSpanVisitor.cs index 13e9dac764..e118745e14 100644 --- a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperDirectiveSpanVisitor.cs +++ b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperDirectiveSpanVisitor.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.Framework.Internal; @@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers { /// /// A that generates s from - /// tag helper code generators in a Razor document. + /// tag helper chunk generators in a Razor document. /// public class TagHelperDirectiveSpanVisitor : ParserVisitor { @@ -57,30 +57,30 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers public override void VisitSpan(Span span) { - // We're only interested in spans with an AddOrRemoveTagHelperCodeGenerator. + // We're only interested in spans with an AddOrRemoveTagHelperChunkGenerator. - if (span.CodeGenerator is AddOrRemoveTagHelperCodeGenerator) + if (span.ChunkGenerator is AddOrRemoveTagHelperChunkGenerator) { - var codeGenerator = (AddOrRemoveTagHelperCodeGenerator)span.CodeGenerator; + var chunkGenerator = (AddOrRemoveTagHelperChunkGenerator)span.ChunkGenerator; var directive = - codeGenerator.RemoveTagHelperDescriptors ? + chunkGenerator.RemoveTagHelperDescriptors ? TagHelperDirectiveType.RemoveTagHelper : TagHelperDirectiveType.AddTagHelper; var directiveDescriptor = new TagHelperDirectiveDescriptor( - codeGenerator.LookupText, + chunkGenerator.LookupText, span.Start, directive); _directiveDescriptors.Add(directiveDescriptor); } - else if (span.CodeGenerator is TagHelperPrefixDirectiveCodeGenerator) + else if (span.ChunkGenerator is TagHelperPrefixDirectiveChunkGenerator) { - var codeGenerator = (TagHelperPrefixDirectiveCodeGenerator)span.CodeGenerator; + var chunkGenerator = (TagHelperPrefixDirectiveChunkGenerator)span.ChunkGenerator; var directiveDescriptor = new TagHelperDirectiveDescriptor( - codeGenerator.Prefix, + chunkGenerator.Prefix, span.Start, TagHelperDirectiveType.TagHelperPrefix); diff --git a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperParseTreeRewriter.cs b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperParseTreeRewriter.cs index fadd49e62e..869969b7bf 100644 --- a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperParseTreeRewriter.cs +++ b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperParseTreeRewriter.cs @@ -38,7 +38,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal TrackBlock(new BlockBuilder { Type = input.Type, - CodeGenerator = input.CodeGenerator + ChunkGenerator = input.ChunkGenerator }); var activeTagHelpers = _trackerStack.Count; diff --git a/src/Microsoft.AspNet.Razor/Parser/TokenizerBackedParser.Helpers.cs b/src/Microsoft.AspNet.Razor/Parser/TokenizerBackedParser.Helpers.cs index 64f03c983c..e50d17fd56 100644 --- a/src/Microsoft.AspNet.Razor/Parser/TokenizerBackedParser.Helpers.cs +++ b/src/Microsoft.AspNet.Razor/Parser/TokenizerBackedParser.Helpers.cs @@ -7,7 +7,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Tokenizer; using Microsoft.AspNet.Razor.Tokenizer.Symbols; @@ -487,7 +487,7 @@ namespace Microsoft.AspNet.Razor.Parser private void CommentSpanConfig(SpanBuilder span) { - span.CodeGenerator = SpanCodeGenerator.Null; + span.ChunkGenerator = SpanChunkGenerator.Null; span.EditHandler = SpanEditHandler.CreateDefault(Language.TokenizeString); } @@ -504,7 +504,7 @@ namespace Microsoft.AspNet.Razor.Parser { using (Context.StartBlock(BlockType.Comment)) { - Context.CurrentBlock.CodeGenerator = new RazorCommentCodeGenerator(); + Context.CurrentBlock.ChunkGenerator = new RazorCommentChunkGenerator(); var start = CurrentLocation; Expected(KnownSymbolType.CommentStart); diff --git a/src/Microsoft.AspNet.Razor/Properties/RazorResources.Designer.cs b/src/Microsoft.AspNet.Razor/Properties/RazorResources.Designer.cs index 2dda1a87a6..1345e2b627 100644 --- a/src/Microsoft.AspNet.Razor/Properties/RazorResources.Designer.cs +++ b/src/Microsoft.AspNet.Razor/Properties/RazorResources.Designer.cs @@ -1287,7 +1287,7 @@ namespace Microsoft.AspNet.Razor } /// - /// A TagHelperCodeGenerator must only be used with TagHelperBlocks. + /// A TagHelperChunkGenerator must only be used with TagHelperBlocks. /// internal static string TagHelpers_TagHelperCodeGeneartorMustBeAssociatedWithATagHelperBlock { @@ -1295,7 +1295,7 @@ namespace Microsoft.AspNet.Razor } /// - /// A TagHelperCodeGenerator must only be used with TagHelperBlocks. + /// A TagHelperChunkGenerator must only be used with TagHelperBlocks. /// internal static string FormatTagHelpers_TagHelperCodeGeneartorMustBeAssociatedWithATagHelperBlock() { diff --git a/src/Microsoft.AspNet.Razor/RazorCodeLanguage.cs b/src/Microsoft.AspNet.Razor/RazorCodeLanguage.cs index 1d4008ebfd..86cc0c850e 100644 --- a/src/Microsoft.AspNet.Razor/RazorCodeLanguage.cs +++ b/src/Microsoft.AspNet.Razor/RazorCodeLanguage.cs @@ -3,8 +3,8 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser; namespace Microsoft.AspNet.Razor @@ -50,10 +50,10 @@ namespace Microsoft.AspNet.Razor public abstract ParserBase CreateCodeParser(); /// - /// Constructs the code generator. Must return a new instance on EVERY call to ensure thread-safety + /// Constructs the chunk generator. Must return a new instance on EVERY call to ensure thread-safety /// - public abstract RazorCodeGenerator CreateCodeGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host); + public abstract RazorChunkGenerator CreateChunkGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host); - public abstract CodeBuilder CreateCodeBuilder(CodeBuilderContext codeGeneratorContext); + public abstract CodeBuilder CreateCodeBuilder(CodeBuilderContext chunkGeneratorContext); } } diff --git a/src/Microsoft.AspNet.Razor/RazorEngineHost.cs b/src/Microsoft.AspNet.Razor/RazorEngineHost.cs index 2903092041..3fadd05254 100644 --- a/src/Microsoft.AspNet.Razor/RazorEngineHost.cs +++ b/src/Microsoft.AspNet.Razor/RazorEngineHost.cs @@ -4,8 +4,8 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.Framework.Internal; @@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Razor /// * The default Base Class to inherit the generated class from /// * The default Class Name and Namespace for the generated class (can be overridden by parameters in RazorTemplateEngine.GeneratedCode) /// * The language of the code in a Razor page - /// * The markup, code parsers and code generators to use (the system will select defaults, but a Host gets a change to augment them) + /// * The markup, code parsers and chunk generators to use (the system will select defaults, but a Host gets a change to augment them) /// ** See DecorateNNN methods /// * Additional code to add to the generated code (see PostProcessGeneratedCode) /// @@ -82,7 +82,7 @@ namespace Microsoft.AspNet.Razor public virtual string DefaultBaseClass { get; set; } /// - /// Indiciates if the parser and code generator should run in design-time mode + /// Indicates if the parser and chunk generator should run in design-time mode /// public virtual bool DesignTimeMode { get; set; } @@ -194,13 +194,13 @@ namespace Microsoft.AspNet.Razor } /// - /// Gets an instance of the code generator and is provided an opportunity to decorate or replace it + /// Gets an instance of the chunk generator and is provided an opportunity to decorate or replace it /// - /// The code generator - /// Either the same code generator, after modifications, or a different code generator - public virtual RazorCodeGenerator DecorateCodeGenerator([NotNull] RazorCodeGenerator incomingCodeGenerator) + /// The chunk generator + /// Either the same chunk generator, after modifications, or a different chunk generator + public virtual RazorChunkGenerator DecorateChunkGenerator([NotNull] RazorChunkGenerator incomingChunkGenerator) { - return incomingCodeGenerator; + return incomingChunkGenerator; } /// @@ -215,12 +215,12 @@ namespace Microsoft.AspNet.Razor return incomingBuilder; } - // If a user wants to modify the code generation process they do it via the DecorateCodeGenerator method which - // is why this is internal. - internal RazorCodeGenerator CreateCodeGenerator(string className, string rootNamespace, string sourceFileName) + // If a user wants to modify the chunk generation process they do it via the DecorateChunkGenerator method + // which is why this is internal. + internal RazorChunkGenerator CreateChunkGenerator(string className, string rootNamespace, string sourceFileName) { - return DecorateCodeGenerator( - CodeLanguage.CreateCodeGenerator(className, rootNamespace, sourceFileName, host: this)); + return DecorateChunkGenerator( + CodeLanguage.CreateChunkGenerator(className, rootNamespace, sourceFileName, host: this)); } } } diff --git a/src/Microsoft.AspNet.Razor/RazorResources.resx b/src/Microsoft.AspNet.Razor/RazorResources.resx index 2286330599..12446cda67 100644 --- a/src/Microsoft.AspNet.Razor/RazorResources.resx +++ b/src/Microsoft.AspNet.Razor/RazorResources.resx @@ -376,7 +376,7 @@ Instead, wrap the contents of the block in "{{}}": The tag helper '{0}' must not have C# in the element's attribute declaration area. - A TagHelperCodeGenerator must only be used with TagHelperBlocks. + 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 8b189d5df4..e99cf8bdeb 100644 --- a/src/Microsoft.AspNet.Razor/RazorTemplateEngine.cs +++ b/src/Microsoft.AspNet.Razor/RazorTemplateEngine.cs @@ -7,8 +7,8 @@ using System.IO; using System.Security.Cryptography; using System.Text; using System.Threading; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Text; using Microsoft.Framework.Internal; @@ -313,7 +313,7 @@ namespace Microsoft.AspNet.Razor var results = parser.Parse(input); // Generate code - var generator = CreateCodeGenerator(className, rootNamespace, sourceFileName); + var generator = CreateChunkGenerator(className, rootNamespace, sourceFileName); generator.DesignTimeMode = Host.DesignTimeMode; generator.Visit(results); @@ -323,16 +323,16 @@ namespace Microsoft.AspNet.Razor var builderResult = builder.Build(); // Collect results and return - return new GeneratorResults(results, builderResult, codeBuilderContext.CodeTreeBuilder.CodeTree); + return new GeneratorResults(results, builderResult, codeBuilderContext.ChunkTreeBuilder.ChunkTree); } - protected internal virtual RazorCodeGenerator CreateCodeGenerator( + protected internal virtual RazorChunkGenerator CreateChunkGenerator( string className, string rootNamespace, string sourceFileName) { - return Host.DecorateCodeGenerator( - Host.CodeLanguage.CreateCodeGenerator(className, rootNamespace, sourceFileName, Host)); + return Host.DecorateChunkGenerator( + Host.CodeLanguage.CreateChunkGenerator(className, rootNamespace, sourceFileName, Host)); } protected internal virtual RazorParser CreateParser(string sourceFileName) diff --git a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeValueCodeRenderer.cs b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeValueCodeRenderer.cs index 299223ef1c..da19c8249a 100644 --- a/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeValueCodeRenderer.cs +++ b/src/Microsoft.AspNet.Razor/TagHelpers/TagHelperAttributeValueCodeRenderer.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Razor.TagHelpers @@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers /// The to generate code for. /// /// The that's used to write code. - /// A instance that contains information about + /// A instance that contains information about /// the current code generation process. /// /// that renders the raw value of the HTML attribute. diff --git a/test/Microsoft.AspNet.Razor.Test/CSharpRazorCodeLanguageTest.cs b/test/Microsoft.AspNet.Razor.Test/CSharpRazorCodeLanguageTest.cs index 2560f1adaa..39fc112139 100644 --- a/test/Microsoft.AspNet.Razor.Test/CSharpRazorCodeLanguageTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CSharpRazorCodeLanguageTest.cs @@ -1,8 +1,9 @@ // 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.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser; using Xunit; @@ -25,18 +26,18 @@ namespace Microsoft.AspNet.Razor.Test } [Fact] - public void CreateCodeGeneratorParserListenerReturnsNewCSharpCodeGeneratorParserListener() + public void CreateChunkGeneratorParserListenerReturnsNewCSharpChunkGeneratorParserListener() { // Arrange var service = new CSharpRazorCodeLanguage(); // Act var host = new RazorEngineHost(service); - var generator = service.CreateCodeGenerator("Foo", "Bar", "Baz", host); + var generator = service.CreateChunkGenerator("Foo", "Bar", "Baz", host); // Assert Assert.NotNull(generator); - Assert.IsType(generator); + Assert.IsType(generator); Assert.Equal("Foo", generator.ClassName); Assert.Equal("Bar", generator.RootNamespaceName); Assert.Equal("Baz", generator.SourceFileName); diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpCodeBuilderTests.cs b/test/Microsoft.AspNet.Razor.Test/Chunks/CSharpCodeBuilderTests.cs similarity index 70% rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpCodeBuilderTests.cs rename to test/Microsoft.AspNet.Razor.Test/Chunks/CSharpCodeBuilderTests.cs index 90ce60a856..83128f15a0 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpCodeBuilderTests.cs +++ b/test/Microsoft.AspNet.Razor.Test/Chunks/CSharpCodeBuilderTests.cs @@ -2,18 +2,20 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. #if !DNXCORE50 -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser.SyntaxTree; +using Microsoft.AspNet.Razor.Test; +using Microsoft.AspNet.Razor.Test.Generator; using Microsoft.AspNet.Razor.Test.Utils; using Moq; using Xunit; -namespace Microsoft.AspNet.Razor.Test.Generator.CodeTree +namespace Microsoft.AspNet.Razor.Chunks { public class CSharpCodeBuilderTests { [Fact] - public void CodeTreeWithUsings() + public void ChunkTreeWithUsings() { var syntaxTreeNode = new Mock(new SpanBuilder()); var language = new CSharpRazorCodeLanguage(); @@ -25,18 +27,18 @@ namespace Microsoft.AspNet.Razor.Test.Generator.CodeTree "Foo.cs", shouldGenerateLinePragmas: false, errorSink: new ErrorSink()); - codeBuilderContext.CodeTreeBuilder.AddUsingChunk("FakeNamespace1", syntaxTreeNode.Object); - codeBuilderContext.CodeTreeBuilder.AddUsingChunk("FakeNamespace2.SubNamespace", syntaxTreeNode.Object); + codeBuilderContext.ChunkTreeBuilder.AddUsingChunk("FakeNamespace1", syntaxTreeNode.Object); + codeBuilderContext.ChunkTreeBuilder.AddUsingChunk("FakeNamespace2.SubNamespace", syntaxTreeNode.Object); var codeBuilder = new CodeGenTestCodeBuilder(codeBuilderContext); // Act var result = codeBuilder.Build(); BaselineWriter.WriteBaseline( - @"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\CS\Output\CSharpCodeBuilder.cs", + @"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\Output\CSharpCodeBuilder.cs", result.Code); - var expectedOutput = TestFile.Create("TestFiles/CodeGenerator/CS/Output/CSharpCodeBuilder.cs").ReadAllText(); + var expectedOutput = TestFile.Create("TestFiles/CodeGenerator/Output/CSharpCodeBuilder.cs").ReadAllText(); // Assert Assert.Equal(expectedOutput, result.Code); diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeBuilderTest.cs b/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkTreeBuilderTest.cs similarity index 71% rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeBuilderTest.cs rename to test/Microsoft.AspNet.Razor.Test/Chunks/ChunkTreeBuilderTest.cs index 7bf0296c35..705c9d6df7 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeBuilderTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkTreeBuilderTest.cs @@ -2,77 +2,76 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Linq; -using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; using Xunit; -namespace Microsoft.AspNet.Razor +namespace Microsoft.AspNet.Razor.Chunks { - public class CodeTreeBuilderTest + public class ChunkTreeBuilderTest { [Fact] - public void AddAddTagHelperChunk_AddsChunkToTopLevelCodeTree() + public void AddAddTagHelperChunk_AddsChunkToTopLevelChunkTree() { // Arrange var spanFactory = SpanFactory.CreateCsHtml(); - var builder = new CodeTreeBuilder(); + var builder = new ChunkTreeBuilder(); var block = new ExpressionBlock(); var addTagHelperDirective = spanFactory.MetaCode(SyntaxConstants.CSharp.AddTagHelperKeyword + " "); // Act - builder.StartChunkBlock(block); + builder.StartParentChunk(block); builder.AddAddTagHelperChunk("some text", addTagHelperDirective); - builder.EndChunkBlock(); + builder.EndParentChunk(); // Assert - Assert.Equal(2, builder.CodeTree.Chunks.Count); + Assert.Equal(2, builder.ChunkTree.Chunks.Count); - var chunkBlock = Assert.IsType(builder.CodeTree.Chunks.First()); - Assert.Empty(chunkBlock.Children); + var parentChunk = Assert.IsType(builder.ChunkTree.Chunks.First()); + Assert.Empty(parentChunk.Children); - var addTagHelperChunk = Assert.IsType(builder.CodeTree.Chunks.Last()); + var addTagHelperChunk = Assert.IsType(builder.ChunkTree.Chunks.Last()); Assert.Equal(addTagHelperChunk.LookupText, "some text"); } [Fact] - public void AddRemoveTagHelperChunk_AddsChunkToTopLevelCodeTree() + public void AddRemoveTagHelperChunk_AddsChunkToTopLevelChunkTree() { // Arrange var spanFactory = SpanFactory.CreateCsHtml(); - var builder = new CodeTreeBuilder(); + var builder = new ChunkTreeBuilder(); var block = new ExpressionBlock(); var removeTagHelperDirective = spanFactory.MetaCode(SyntaxConstants.CSharp.RemoveTagHelperKeyword + " "); // Act - builder.StartChunkBlock(block); + builder.StartParentChunk(block); builder.AddRemoveTagHelperChunk("some text", removeTagHelperDirective); - builder.EndChunkBlock(); + builder.EndParentChunk(); // Assert - Assert.Equal(2, builder.CodeTree.Chunks.Count); + Assert.Equal(2, builder.ChunkTree.Chunks.Count); - var chunkBlock = Assert.IsType(builder.CodeTree.Chunks.First()); - Assert.Empty(chunkBlock.Children); + var parentChunk = Assert.IsType(builder.ChunkTree.Chunks.First()); + Assert.Empty(parentChunk.Children); - var removeTagHelperChunk = Assert.IsType(builder.CodeTree.Chunks.Last()); + var removeTagHelperChunk = Assert.IsType(builder.ChunkTree.Chunks.Last()); Assert.Equal(removeTagHelperChunk.LookupText, "some text"); } [Fact] - public void AddLiteralChunk_AddsChunkToCodeTree() + public void AddLiteralChunk_AddsChunkToChunkTree() { // Arrange var spanFactory = SpanFactory.CreateCsHtml(); var previousSpan = spanFactory.EmptyHtml().Builder.Build(); - var builder = new CodeTreeBuilder(); + var builder = new ChunkTreeBuilder(); // Act builder.AddLiteralChunk("some text", previousSpan); // Assert - var chunk = Assert.Single(builder.CodeTree.Chunks); + var chunk = Assert.Single(builder.ChunkTree.Chunks); var literalChunk = Assert.IsType(chunk); Assert.Equal("some text", literalChunk.Text); Assert.Same(previousSpan, literalChunk.Association); @@ -85,14 +84,14 @@ namespace Microsoft.AspNet.Razor var spanFactory = SpanFactory.CreateCsHtml(); var previousSpan = spanFactory.Markup("").Builder.Build(); var newSpan = spanFactory.Markup("

").Builder.Build(); - var builder = new CodeTreeBuilder(); + var builder = new ChunkTreeBuilder(); // Act builder.AddLiteralChunk("", previousSpan); builder.AddLiteralChunk("

", newSpan); // Assert - var chunk = Assert.Single(builder.CodeTree.Chunks); + var chunk = Assert.Single(builder.ChunkTree.Chunks); var literalChunk = Assert.IsType(chunk); Assert.Equal("

", literalChunk.Text); var span = Assert.IsType(literalChunk.Association); @@ -100,7 +99,7 @@ namespace Microsoft.AspNet.Razor } [Fact] - public void AddLiteralChunk_AddsChunkToCodeTree_IfPreviousChunkWasNotLiteral() + public void AddLiteralChunk_AddsChunkToChunkTree_IfPreviousChunkWasNotLiteral() { // Arrange var spanFactory = SpanFactory.CreateCsHtml(); @@ -108,14 +107,14 @@ namespace Microsoft.AspNet.Razor .AsStatement() .Builder.Build(); var literalSpan = spanFactory.Markup("

").Builder.Build(); - var builder = new CodeTreeBuilder(); + var builder = new ChunkTreeBuilder(); // Act builder.AddStatementChunk("int a = 10;", codeSpan); builder.AddLiteralChunk("

", literalSpan); // Assert - var chunks = builder.CodeTree.Chunks; + var chunks = builder.ChunkTree.Chunks; Assert.Equal(2, chunks.Count); var statementChunk = Assert.IsType(chunks[0]); Assert.Equal("int a = 10;", statementChunk.Code); diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/ChunkVisitorTests.cs b/test/Microsoft.AspNet.Razor.Test/Chunks/ChunkVisitorTests.cs similarity index 90% rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/ChunkVisitorTests.cs rename to test/Microsoft.AspNet.Razor.Test/Chunks/ChunkVisitorTests.cs index 509c4b973c..e32986c169 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/ChunkVisitorTests.cs +++ b/test/Microsoft.AspNet.Razor.Test/Chunks/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.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; +using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGeneration.Visitors; using Moq; using Moq.Protected; using Xunit; -namespace Microsoft.AspNet.Razor +namespace Microsoft.AspNet.Razor.Chunks { public class ChunkVisitorTests { diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/AddImportCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AddImportChunkGeneratorTest.cs similarity index 51% rename from test/Microsoft.AspNet.Razor.Test/Generator/AddImportCodeGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/AddImportChunkGeneratorTest.cs index c0a5cb7994..66993ef8af 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/AddImportCodeGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AddImportChunkGeneratorTest.cs @@ -3,63 +3,63 @@ using Xunit; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class AddImportCodeGeneratorTest + public class AddImportChunkGeneratorTest { - public static TheoryData MatchingTestDataSet + public static TheoryData MatchingTestDataSet { get { - return new TheoryData + return new TheoryData { { - new AddImportCodeGenerator(ns: null), - new AddImportCodeGenerator(ns: null) + new AddImportChunkGenerator(ns: null), + new AddImportChunkGenerator(ns: null) }, { - new AddImportCodeGenerator(ns: "Fred"), - new AddImportCodeGenerator(ns: "Fred") + new AddImportChunkGenerator(ns: "Fred"), + new AddImportChunkGenerator(ns: "Fred") }, }; } } - public static TheoryData NonMatchingTestDataSet + public static TheoryData NonMatchingTestDataSet { get { - return new TheoryData + return new TheoryData { { - new AddImportCodeGenerator(ns: null), + new AddImportChunkGenerator(ns: null), null }, { - new AddImportCodeGenerator(ns: "Fred"), + new AddImportChunkGenerator(ns: "Fred"), null }, { - new AddImportCodeGenerator(ns: "Fred"), + new AddImportChunkGenerator(ns: "Fred"), new object() }, { - new AddImportCodeGenerator(ns: "Fred"), - SpanCodeGenerator.Null + new AddImportChunkGenerator(ns: "Fred"), + SpanChunkGenerator.Null }, { - new AddImportCodeGenerator(ns: "Fred"), - new StatementCodeGenerator() + new AddImportChunkGenerator(ns: "Fred"), + new StatementChunkGenerator() }, { // Different Namespace. - new AddImportCodeGenerator(ns: "Fred"), - new AddImportCodeGenerator(ns: "Ginger") + new AddImportChunkGenerator(ns: "Fred"), + new AddImportChunkGenerator(ns: "Ginger") }, { // Different Namespace (case sensitive). - new AddImportCodeGenerator(ns: "fred"), - new AddImportCodeGenerator(ns: "FRED") + new AddImportChunkGenerator(ns: "fred"), + new AddImportChunkGenerator(ns: "FRED") } }; } @@ -67,7 +67,7 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(MatchingTestDataSet))] - public void Equals_True_WhenExpected(AddImportCodeGenerator leftObject, AddImportCodeGenerator rightObject) + public void Equals_True_WhenExpected(AddImportChunkGenerator leftObject, AddImportChunkGenerator rightObject) { // Arrange & Act var result = leftObject.Equals(rightObject); @@ -78,7 +78,7 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(NonMatchingTestDataSet))] - public void Equals_False_WhenExpected(AddImportCodeGenerator leftObject, object rightObject) + public void Equals_False_WhenExpected(AddImportChunkGenerator leftObject, object rightObject) { // Arrange & Act var result = leftObject.Equals(rightObject); @@ -90,8 +90,8 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(MatchingTestDataSet))] public void GetHashCode_ReturnsSameValue_WhenEqual( - AddImportCodeGenerator leftObject, - AddImportCodeGenerator rightObject) + AddImportChunkGenerator leftObject, + AddImportChunkGenerator rightObject) { // Arrange & Act var leftResult = leftObject.GetHashCode(); diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/AttributeBlockCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AttributeBlockChunkGeneratorTest.cs similarity index 69% rename from test/Microsoft.AspNet.Razor.Test/Generator/AttributeBlockCodeGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/AttributeBlockChunkGeneratorTest.cs index 3910e0ac69..34e1122b6a 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/AttributeBlockCodeGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/AttributeBlockChunkGeneratorTest.cs @@ -4,36 +4,36 @@ using Microsoft.AspNet.Razor.Text; using Xunit; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class AttributeBlockCodeGeneratorTest + public class AttributeBlockChunkGeneratorTest { - public static TheoryData MatchingTestDataSet + public static TheoryData MatchingTestDataSet { get { - return new TheoryData + return new TheoryData { { - new AttributeBlockCodeGenerator(name: null, prefix: null, suffix: null), - new AttributeBlockCodeGenerator(name: null, prefix: null, suffix: null) + new AttributeBlockChunkGenerator(name: null, prefix: null, suffix: null), + new AttributeBlockChunkGenerator(name: null, prefix: null, suffix: null) }, { - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 0, line: 0, col: 0), suffix: new LocationTagged(value: "George", offset: 0, line: 0, col: 0)), - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 0, line: 0, col: 0), suffix: new LocationTagged(value: "George", offset: 0, line: 0, col: 0)) }, { - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)), - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)) @@ -42,72 +42,72 @@ namespace Microsoft.AspNet.Razor.Generator } } - public static TheoryData NonMatchingTestDataSet + public static TheoryData NonMatchingTestDataSet { get { - return new TheoryData + return new TheoryData { { - new AttributeBlockCodeGenerator(name: null, prefix: null, suffix: null), + new AttributeBlockChunkGenerator(name: null, prefix: null, suffix: null), null }, { - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 0, line: 0, col: 0), suffix: new LocationTagged(value: "George", offset: 0, line: 0, col: 0)), null }, { - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)), null }, { - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)), new object() }, { - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)), - new RazorCommentCodeGenerator() + new RazorCommentChunkGenerator() }, { // Different Name. - new AttributeBlockCodeGenerator(name: "Fred", prefix: null, suffix: null), - new AttributeBlockCodeGenerator(name: "Ginger", prefix: null, suffix: null) + new AttributeBlockChunkGenerator(name: "Fred", prefix: null, suffix: null), + new AttributeBlockChunkGenerator(name: "Ginger", prefix: null, suffix: null) }, { // Different Name (case sensitive). - new AttributeBlockCodeGenerator(name: "fred", prefix: null, suffix: null), - new AttributeBlockCodeGenerator(name: "FRED", prefix: null, suffix: null) + new AttributeBlockChunkGenerator(name: "fred", prefix: null, suffix: null), + new AttributeBlockChunkGenerator(name: "FRED", prefix: null, suffix: null) }, { // Different Prefix. - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: null, prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), suffix: null), - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: null, prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12), suffix: null) }, { // Different Suffix. - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: null, prefix: null, suffix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12)), - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: null, prefix: null, suffix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12)) @@ -119,8 +119,8 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(MatchingTestDataSet))] public void Equals_True_WhenExpected( - AttributeBlockCodeGenerator leftObject, - AttributeBlockCodeGenerator rightObject) + AttributeBlockChunkGenerator leftObject, + AttributeBlockChunkGenerator rightObject) { // Arrange & Act var result = leftObject.Equals(rightObject); @@ -131,7 +131,7 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(NonMatchingTestDataSet))] - public void Equals_False_WhenExpected(AttributeBlockCodeGenerator leftObject, object rightObject) + public void Equals_False_WhenExpected(AttributeBlockChunkGenerator leftObject, object rightObject) { // Arrange & Act var result = leftObject.Equals(rightObject); @@ -143,8 +143,8 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(MatchingTestDataSet))] public void GetHashCode_ReturnsSameValue_WhenEqual( - AttributeBlockCodeGenerator leftObject, - AttributeBlockCodeGenerator rightObject) + AttributeBlockChunkGenerator leftObject, + AttributeBlockChunkGenerator rightObject) { // Arrange & Act var leftResult = leftObject.GetHashCode(); diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharp/CSharpCodeWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs similarity index 96% rename from test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharp/CSharpCodeWriterTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs index 80cc314eea..85a79789eb 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharp/CSharpCodeWriterTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpCodeWriterTest.cs @@ -3,7 +3,7 @@ using Xunit; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CSharpCodeWriterTest { diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharpLineMappingWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs similarity index 98% rename from test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharpLineMappingWriterTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs index 04e1a0ab8a..964aebdf12 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CSharpLineMappingWriterTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpLineMappingWriterTest.cs @@ -4,7 +4,7 @@ using System; using Xunit; -namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CSharpLineMappingWriterTest { diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpPaddingBuilderTests.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs similarity index 99% rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpPaddingBuilderTests.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs index 808ba93f00..6526a77aef 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CSharpPaddingBuilderTests.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpPaddingBuilderTests.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Xunit; diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpRazorCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs similarity index 85% rename from test/Microsoft.AspNet.Razor.Test/Generator/CSharpRazorCodeGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs index 417c48c2c9..d32205c80f 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpRazorCodeGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpRazorChunkGeneratorTest.cs @@ -3,14 +3,14 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Xunit; namespace Microsoft.AspNet.Razor.Test.Generator { - public class CSharpRazorCodeGeneratorTest : RazorCodeGeneratorTest + public class RazorCodeGeneratorTest : RazorCodeGeneratorTest { protected override string FileExtension { @@ -33,19 +33,19 @@ namespace Microsoft.AspNet.Razor.Test.Generator [Fact] public void ConstructorRequiresNonNullClassName() { - Assert.Throws("className", () => new CSharpRazorCodeGenerator(null, TestRootNamespaceName, TestPhysicalPath, CreateHost())); + Assert.Throws("className", () => new RazorChunkGenerator(null, TestRootNamespaceName, TestPhysicalPath, CreateHost())); } [Fact] public void ConstructorRequiresNonEmptyClassName() { - Assert.Throws("className", () => new CSharpRazorCodeGenerator(string.Empty, TestRootNamespaceName, TestPhysicalPath, CreateHost())); + Assert.Throws("className", () => new RazorChunkGenerator(string.Empty, TestRootNamespaceName, TestPhysicalPath, CreateHost())); } [Fact] public void ConstructorAllowsEmptyRootNamespaceName() { - new CSharpRazorCodeGenerator("Foo", string.Empty, TestPhysicalPath, CreateHost()); + new RazorChunkGenerator("Foo", string.Empty, TestPhysicalPath, CreateHost()); } [Theory] @@ -68,13 +68,13 @@ namespace Microsoft.AspNet.Razor.Test.Generator [InlineData("ResolveUrl")] [InlineData("Await")] [InlineData("CodeBlockWithTextElement")] - public void CSharpCodeGeneratorCorrectlyGeneratesRunTimeCode(string testType) + public void CSharpChunkGeneratorCorrectlyGeneratesRunTimeCode(string testType) { RunTest(testType); } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForNullConditionalOperator() + public void CSharpChunkGeneratorCorrectlyGeneratesMappingsForNullConditionalOperator() { RunTest("NullConditionalExpressions", "NullConditionalExpressions.DesignTime", @@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForAwait() + public void CSharpChunkGeneratorCorrectlyGeneratesMappingsForAwait() { RunTest("Await", "Await.DesignTime", @@ -128,7 +128,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForSimpleUnspacedIf() + public void CSharpChunkGeneratorCorrectlyGeneratesMappingsForSimpleUnspacedIf() { RunTest("SimpleUnspacedIf", "SimpleUnspacedIf.DesignTime.Tabs", @@ -142,7 +142,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForRazorCommentsAtDesignTime() + public void CSharpChunkGeneratorCorrectlyGeneratesMappingsForRazorCommentsAtDesignTime() { RunTest("RazorComments", "RazorComments.DesignTime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List() @@ -157,19 +157,19 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGenerateMappingForOpenedCurlyIf() + public void CSharpChunkGeneratorCorrectlyGenerateMappingForOpenedCurlyIf() { OpenedIf(withTabs: true); } [Fact] - public void CSharpCodeGeneratorCorrectlyGenerateMappingForOpenedCurlyIfSpaces() + public void CSharpChunkGeneratorCorrectlyGenerateMappingForOpenedCurlyIfSpaces() { OpenedIf(withTabs: false); } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesImportStatementsAtDesignTime() + public void CSharpChunkGeneratorCorrectlyGeneratesImportStatementsAtDesignTime() { RunTest("Imports", "Imports.DesignTime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List() { @@ -185,7 +185,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTime() + public void CSharpChunkGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTime() { RunTest("FunctionsBlock", "FunctionsBlock.DesignTime", @@ -200,7 +200,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTimeTabs() + public void CSharpChunkGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTimeTabs() { RunTest("FunctionsBlock", "FunctionsBlock.DesignTime.Tabs", @@ -215,7 +215,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesMinimalFunctionsBlocksAtDesignTimeTabs() + public void CSharpChunkGeneratorCorrectlyGeneratesMinimalFunctionsBlocksAtDesignTimeTabs() { RunTest("FunctionsBlockMinimal", "FunctionsBlockMinimal.DesignTime.Tabs", @@ -228,7 +228,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesHiddenSpansWithinCode() + public void CSharpChunkGeneratorCorrectlyGeneratesHiddenSpansWithinCode() { RunTest("HiddenSpansInCode", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List { @@ -238,7 +238,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorGeneratesCodeWithParserErrorsInDesignTimeMode() + public void CSharpChunkGeneratorGeneratesCodeWithParserErrorsInDesignTimeMode() { RunTest("ParserError", designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -247,13 +247,13 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesInheritsAtRuntime() + public void CSharpChunkGeneratorCorrectlyGeneratesInheritsAtRuntime() { RunTest("Inherits", baselineName: "Inherits.Runtime"); } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesInheritsAtDesigntime() + public void CSharpChunkGeneratorCorrectlyGeneratesInheritsAtDesigntime() { RunTest("Inherits", baselineName: "Inherits.Designtime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List() { @@ -263,7 +263,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCode() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCode() { RunTest("UnfinishedExpressionInCode", tabTest: TabTest.NoTabs, designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -274,7 +274,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCodeTabs() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCodeTabs() { RunTest("UnfinishedExpressionInCode", "UnfinishedExpressionInCode.Tabs", @@ -288,7 +288,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasMarkupAndExpressions() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasMarkupAndExpressions() { RunTest("DesignTime", designTimeMode: true, @@ -307,7 +307,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForImplicitExpressionStartedAtEOF() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForImplicitExpressionStartedAtEOF() { RunTest("ImplicitExpressionAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -316,7 +316,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForExplicitExpressionStartedAtEOF() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForExplicitExpressionStartedAtEOF() { RunTest("ExplicitExpressionAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -325,7 +325,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForCodeBlockStartedAtEOF() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForCodeBlockStartedAtEOF() { RunTest("CodeBlockAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -334,7 +334,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpression() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpression() { RunTest("EmptyImplicitExpression", designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -343,7 +343,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCode() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCode() { RunTest("EmptyImplicitExpressionInCode", tabTest: TabTest.NoTabs, designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -354,7 +354,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCodeTabs() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCodeTabs() { RunTest("EmptyImplicitExpressionInCode", "EmptyImplicitExpressionInCode.Tabs", @@ -368,7 +368,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyExplicitExpression() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyExplicitExpression() { RunTest("EmptyExplicitExpression", designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -377,7 +377,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyCodeBlock() + public void CSharpChunkGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyCodeBlock() { RunTest("EmptyCodeBlock", designTimeMode: true, expectedDesignTimePragmas: new List() { @@ -386,13 +386,13 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorDoesNotRenderLinePragmasIfGenerateLinePragmasIsSetToFalse() + public void CSharpChunkGeneratorDoesNotRenderLinePragmasIfGenerateLinePragmasIsSetToFalse() { RunTest("NoLinePragmas", generatePragmas: false); } [Fact] - public void CSharpCodeGeneratorCorrectlyInstrumentsRazorCodeWhenInstrumentationRequested() + public void CSharpChunkGeneratorCorrectlyInstrumentsRazorCodeWhenInstrumentationRequested() { RunTest("Instrumented", hostConfig: host => { @@ -403,7 +403,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGeneratorGeneratesUrlsCorrectlyWithCommentsAndQuotes() + public void CSharpChunkGeneratorGeneratesUrlsCorrectlyWithCommentsAndQuotes() { RunTest("HtmlCommentWithQuote_Single", tabTest: TabTest.NoTabs); @@ -413,7 +413,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGenerator_CorrectlyGeneratesAttributes_AtDesignTime() + public void CSharpChunkGenerator_CorrectlyGeneratesAttributes_AtDesignTime() { var expectedDesignTimePragmas = new[] { diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs similarity index 99% rename from test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs index c2cc94699f..79ecc674e5 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingTest.cs @@ -6,7 +6,7 @@ using System.Linq; #if DNXCORE50 using System.Reflection; #endif -using Microsoft.AspNet.Razor.Generator.Compiler; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.TagHelpers; using Xunit; @@ -728,7 +728,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGenerator_CorrectlyGeneratesMappings_ForRemoveTagHelperDirective() + public void CSharpChunkGenerator_CorrectlyGeneratesMappings_ForRemoveTagHelperDirective() { // Act & Assert RunTagHelperTest("RemoveTagHelperDirective", @@ -745,7 +745,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator } [Fact] - public void CSharpCodeGenerator_CorrectlyGeneratesMappings_ForAddTagHelperDirective() + public void CSharpChunkGenerator_CorrectlyGeneratesMappings_ForAddTagHelperDirective() { // Act & Assert RunTagHelperTest("AddTagHelperDirective", diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingUnitTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs similarity index 96% rename from test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingUnitTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs index 82dc9efbc3..be072c84ac 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CSharpTagHelperRenderingUnitTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CSharpTagHelperRenderingUnitTest.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +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.TagHelpers; using Xunit; @@ -189,7 +190,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator private static CodeBuilderContext CreateContext() { return new CodeBuilderContext( - new CodeGeneratorContext( + new ChunkGeneratorContext( new RazorEngineHost(new CSharpRazorCodeLanguage()), "MyClass", "MyNamespace", diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestCodeBuilder.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeBuilder.cs similarity index 81% rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestCodeBuilder.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeBuilder.cs index f1aec04927..ed128492f3 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestCodeBuilder.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestCodeBuilder.cs @@ -1,8 +1,8 @@ // 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.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; namespace Microsoft.AspNet.Razor.Test.Generator { @@ -22,8 +22,8 @@ namespace Microsoft.AspNet.Razor.Test.Generator { public TestCodeWriter() { - // We normalize newlines so no matter what platform we're on they're consistent - // (for code generation tests). + // We normalize newlines so no matter what platform we're on they're consistent (for code generation + // tests). NewLine = "\r\n"; } } diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestHost.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs similarity index 88% rename from test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestHost.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs index 129e241f95..f518c3076e 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeGenTestHost.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeGenTestHost.cs @@ -1,8 +1,8 @@ // 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.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; namespace Microsoft.AspNet.Razor.Test.Generator { diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CodeWriterTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs similarity index 99% rename from test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CodeWriterTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs index ecde0633bc..2b170c7ed9 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/Compiler/CodeWriterTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/CodeWriterTest.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Xunit; -namespace Microsoft.AspNet.Razor.Generator.Compiler +namespace Microsoft.AspNet.Razor.CodeGeneration { public class CodeWriterTest { diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/DynamicAttributeBlockCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs similarity index 72% rename from test/Microsoft.AspNet.Razor.Test/Generator/DynamicAttributeBlockCodeGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs index ea41510955..acc27333f4 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/DynamicAttributeBlockCodeGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/DynamicAttributeBlockChunkGeneratorTest.cs @@ -4,27 +4,27 @@ using Microsoft.AspNet.Razor.Text; using Xunit; -namespace Microsoft.AspNet.Razor.Generator +namespace Microsoft.AspNet.Razor.Chunks.Generators { - public class DynamicAttributeBlockCodeGeneratorTest + public class DynamicAttributeBlockChunkGeneratorTest { - public static TheoryData MatchingTestDataSet + public static TheoryData MatchingTestDataSet { get { - return new TheoryData + return new TheoryData { { - new DynamicAttributeBlockCodeGenerator(prefix: null, offset: 0, line: 0, col: 0), - new DynamicAttributeBlockCodeGenerator(prefix: null, offset: 0, line: 0, col: 0) + new DynamicAttributeBlockChunkGenerator(prefix: null, offset: 0, line: 0, col: 0), + new DynamicAttributeBlockChunkGenerator(prefix: null, offset: 0, line: 0, col: 0) }, { - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Fred", offset: 0, line: 0, col: 0), offset: 10, line: 11, col: 12), - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Fred", offset: 0, line: 0, col: 0), offset: 10, line: 11, @@ -32,36 +32,36 @@ namespace Microsoft.AspNet.Razor.Generator }, // ValueStart not involved in equality check or hash code calculation. { - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), offset: 10, line: 11, col: 12), - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), offset: 100, line: 11, col: 12) }, { - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12), offset: 10, line: 11, col: 12), - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12), offset: 10, line: 110, col: 12) }, { - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Dean", offset: 10, line: 11, col: 12), offset: 10, line: 11, col: 12), - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Dean", offset: 10, line: 11, col: 12), offset: 10, line: 11, @@ -71,18 +71,18 @@ namespace Microsoft.AspNet.Razor.Generator } } - public static TheoryData NonMatchingTestDataSet + public static TheoryData NonMatchingTestDataSet { get { - return new TheoryData + return new TheoryData { { - new DynamicAttributeBlockCodeGenerator(prefix: null, offset: 0, line: 0, col: 0), + new DynamicAttributeBlockChunkGenerator(prefix: null, offset: 0, line: 0, col: 0), null }, { - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Ginger", offset: 0, line: 0, col: 0), offset: 10, line: 11, @@ -90,7 +90,7 @@ namespace Microsoft.AspNet.Razor.Generator null }, { - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), offset: 10, line: 11, @@ -98,24 +98,24 @@ namespace Microsoft.AspNet.Razor.Generator new object() }, { - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12), offset: 10, line: 11, col: 12), - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "Fred", prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), suffix: new LocationTagged(value: "George", offset: 13, line: 14, col: 15)) }, { // Different Prefix. - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "Ginger", offset: 10, line: 11, col: 12), offset: 10, line: 11, col: 12), - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( prefix: new LocationTagged(value: "George", offset: 10, line: 11, col: 12), offset: 10, line: 11, @@ -128,8 +128,8 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(MatchingTestDataSet))] public void Equals_True_WhenExpected( - DynamicAttributeBlockCodeGenerator leftObject, - DynamicAttributeBlockCodeGenerator rightObject) + DynamicAttributeBlockChunkGenerator leftObject, + DynamicAttributeBlockChunkGenerator rightObject) { // Arrange & Act var result = leftObject.Equals(rightObject); @@ -140,7 +140,7 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(NonMatchingTestDataSet))] - public void Equals_False_WhenExpected(DynamicAttributeBlockCodeGenerator leftObject, object rightObject) + public void Equals_False_WhenExpected(DynamicAttributeBlockChunkGenerator leftObject, object rightObject) { // Arrange & Act var result = leftObject.Equals(rightObject); @@ -152,8 +152,8 @@ namespace Microsoft.AspNet.Razor.Generator [Theory] [MemberData(nameof(MatchingTestDataSet))] public void GetHashCode_ReturnsSameValue_WhenEqual( - DynamicAttributeBlockCodeGenerator leftObject, - DynamicAttributeBlockCodeGenerator rightObject) + DynamicAttributeBlockChunkGenerator leftObject, + DynamicAttributeBlockChunkGenerator rightObject) { // Arrange & Act var leftResult = leftObject.GetHashCode(); diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/LineMappingTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/LineMappingTest.cs similarity index 98% rename from test/Microsoft.AspNet.Razor.Test/Generator/LineMappingTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/LineMappingTest.cs index adcd0db6d5..dc24749169 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/LineMappingTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/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.Generator.Compiler; +using Microsoft.AspNet.Razor.CodeGeneration; using Xunit; namespace Microsoft.AspNet.Razor.Test.Generator diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/RazorCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs similarity index 95% rename from test/Microsoft.AspNet.Razor.Test/Generator/RazorCodeGeneratorTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs index 672479889e..4ff127896f 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/RazorCodeGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorChunkGeneratorTest.cs @@ -6,8 +6,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Utils; using Microsoft.AspNet.Testing; @@ -128,8 +128,8 @@ namespace Microsoft.AspNet.Razor.Test.Generator baselineName = name; } - var sourceLocation = string.Format("TestFiles/CodeGenerator/{1}/Source/{0}.{2}", name, LanguageName, FileExtension); - var expectedOutput = TestFile.Create(string.Format("TestFiles/CodeGenerator/CS/Output/{0}.{1}", baselineName, BaselineExtension)).ReadAllText(); + 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(); // Set up the host and engine var host = CreateHost(); @@ -176,7 +176,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator 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\CodeGenerator\{0}\Output\{1}.{2}", LanguageName, 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/CodeGeneration/RazorCommentChunkGeneratorTest.cs new file mode 100644 index 0000000000..30f1df927a --- /dev/null +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/RazorCommentChunkGeneratorTest.cs @@ -0,0 +1,92 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Linq; +using Microsoft.AspNet.Razor.TagHelpers; +using Xunit; + +namespace Microsoft.AspNet.Razor.Chunks.Generators +{ + // Really tests underlying ParentChunkGenerator + public class RazorCommentChunkGeneratorTest + { + public static TheoryData MatchingTestDataSet + { + get + { + return new TheoryData + { + { new RazorCommentChunkGenerator(), new RazorCommentChunkGenerator() }, + }; + } + } + + public static TheoryData NonMatchingTestDataSet + { + get + { + return new TheoryData + { + { new RazorCommentChunkGenerator(), null }, + { new RazorCommentChunkGenerator(), new object() }, + { new RazorCommentChunkGenerator(), ParentChunkGenerator.Null }, + { + new RazorCommentChunkGenerator(), + new AttributeBlockChunkGenerator(name: null, prefix: null, suffix: null) + }, + { + new RazorCommentChunkGenerator(), + new DynamicAttributeBlockChunkGenerator(prefix: null, offset: 0, line: 0, col: 0) + }, + { new RazorCommentChunkGenerator(), new ExpressionChunkGenerator() }, + { new RazorCommentChunkGenerator(), new SectionChunkGenerator(sectionName: null) }, + { + new RazorCommentChunkGenerator(), + new TagHelperChunkGenerator(Enumerable.Empty()) + }, + { new RazorCommentChunkGenerator(), new TemplateBlockChunkGenerator() }, + { + new RazorCommentChunkGenerator(), + new AddImportChunkGenerator(ns: "Fred") + }, + }; + } + } + + [Theory] + [MemberData(nameof(MatchingTestDataSet))] + public void Equals_True_WhenExpected(RazorCommentChunkGenerator leftObject, IParentChunkGenerator rightObject) + { + // Arrange & Act + var result = leftObject.Equals(rightObject); + + // Assert + Assert.True(result); + } + + [Theory] + [MemberData(nameof(NonMatchingTestDataSet))] + public void Equals_False_WhenExpected(IParentChunkGenerator leftObject, object rightObject) + { + // Arrange & Act + var result = leftObject.Equals(rightObject); + + // Assert + Assert.False(result); + } + + [Theory] + [MemberData(nameof(MatchingTestDataSet))] + public void GetHashCode_ReturnsSameValue_WhenEqual( + RazorCommentChunkGenerator leftObject, + IParentChunkGenerator rightObject) + { + // Arrange & Act + var leftResult = leftObject.GetHashCode(); + var rightResult = rightObject.GetHashCode(); + + // Assert + Assert.Equal(leftResult, rightResult); + } + } +} diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/TabTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TabTest.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/Generator/TabTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/TabTest.cs diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/TagHelperAttributeValueCodeRendererTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs similarity index 88% rename from test/Microsoft.AspNet.Razor.Test/Generator/TagHelperAttributeValueCodeRendererTest.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs index 07b64e0fd1..1a581d433e 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/TagHelperAttributeValueCodeRendererTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperAttributeValueCodeRendererTest.cs @@ -5,9 +5,8 @@ using System; #if DNXCORE50 using System.Reflection; #endif -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGeneration.Visitors; using Microsoft.AspNet.Razor.TagHelpers; using Xunit; @@ -16,7 +15,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator public class TagHelperAttributeValueCodeRendererTest : TagHelperTestBase { [Fact] - public void TagHelpers_CanReplaceAttributeCodeGeneratorLogic() + public void TagHelpers_CanReplaceAttributeChunkGeneratorLogic() { // Arrange var inputTypePropertyInfo = typeof(TestType).GetProperty("Type"); @@ -43,7 +42,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator // Act & Assert RunTagHelperTest(testName: "BasicTagHelpers", - baseLineName: "BasicTagHelpers.CustomAttributeCodeGenerator", + baseLineName: "BasicTagHelpers.CustomAttributeCodeBuilder", tagHelperDescriptors: tagHelperDescriptors, hostConfig: (host) => { @@ -61,13 +60,13 @@ namespace Microsoft.AspNet.Razor.Test.Generator public override CodeBuilder DecorateCodeBuilder(CodeBuilder incomingBuilder, CodeBuilderContext context) { - return new AttributeCodeGeneratorReplacingCodeBuilder(context); + return new AttributeChunkGeneratorReplacingCodeBuilder(context); } } - private class AttributeCodeGeneratorReplacingCodeBuilder : TestCSharpCodeBuilder + private class AttributeChunkGeneratorReplacingCodeBuilder : TestCSharpCodeBuilder { - public AttributeCodeGeneratorReplacingCodeBuilder(CodeBuilderContext context) + public AttributeChunkGeneratorReplacingCodeBuilder(CodeBuilderContext context) : base(context) { } diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/TagHelperTestBase.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs similarity index 96% rename from test/Microsoft.AspNet.Razor.Test/Generator/TagHelperTestBase.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs index 60b60268da..4ce3802aab 100644 --- a/test/Microsoft.AspNet.Razor.Test/Generator/TagHelperTestBase.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TagHelperTestBase.cs @@ -4,15 +4,14 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +using Microsoft.AspNet.Razor.CodeGeneration; +using Microsoft.AspNet.Razor.CodeGeneration.Visitors; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.TagHelpers; namespace Microsoft.AspNet.Razor.Test.Generator { - public class TagHelperTestBase : CSharpRazorCodeGeneratorTest + public class TagHelperTestBase : RazorCodeGeneratorTest { protected void RunTagHelperTest(string testName, string baseLineName = null, diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/TestSpan.cs b/test/Microsoft.AspNet.Razor.Test/CodeGeneration/TestSpan.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/Generator/TestSpan.cs rename to test/Microsoft.AspNet.Razor.Test/CodeGeneration/TestSpan.cs diff --git a/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs b/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs index e743fa2d91..8fee4c95c3 100644 --- a/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs +++ b/test/Microsoft.AspNet.Razor.Test/Framework/BlockTypes.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.TagHelpers; @@ -14,23 +14,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Statement; - public StatementBlock(IBlockCodeGenerator codeGenerator, IEnumerable children) - : base(ThisBlockType, children, codeGenerator) + public StatementBlock(IParentChunkGenerator chunkGenerator, IEnumerable children) + : base(ThisBlockType, children, chunkGenerator) { } - public StatementBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children) - : this(codeGenerator, (IEnumerable)children) + public StatementBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children) + : this(chunkGenerator, (IEnumerable)children) { } public StatementBlock(params SyntaxTreeNode[] children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } public StatementBlock(IEnumerable children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } } @@ -39,23 +39,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Directive; - public DirectiveBlock(IBlockCodeGenerator codeGenerator, IEnumerable children) - : base(ThisBlockType, children, codeGenerator) + public DirectiveBlock(IParentChunkGenerator chunkGenerator, IEnumerable children) + : base(ThisBlockType, children, chunkGenerator) { } - public DirectiveBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children) - : this(codeGenerator, (IEnumerable)children) + public DirectiveBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children) + : this(chunkGenerator, (IEnumerable)children) { } public DirectiveBlock(params SyntaxTreeNode[] children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } public DirectiveBlock(IEnumerable children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } } @@ -64,23 +64,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Functions; - public FunctionsBlock(IBlockCodeGenerator codeGenerator, IEnumerable children) - : base(ThisBlockType, children, codeGenerator) + public FunctionsBlock(IParentChunkGenerator chunkGenerator, IEnumerable children) + : base(ThisBlockType, children, chunkGenerator) { } - public FunctionsBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children) - : this(codeGenerator, (IEnumerable)children) + public FunctionsBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children) + : this(chunkGenerator, (IEnumerable)children) { } public FunctionsBlock(params SyntaxTreeNode[] children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } public FunctionsBlock(IEnumerable children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } } @@ -89,23 +89,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Expression; - public ExpressionBlock(IBlockCodeGenerator codeGenerator, IEnumerable children) - : base(ThisBlockType, children, codeGenerator) + public ExpressionBlock(IParentChunkGenerator chunkGenerator, IEnumerable children) + : base(ThisBlockType, children, chunkGenerator) { } - public ExpressionBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children) - : this(codeGenerator, (IEnumerable)children) + public ExpressionBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children) + : this(chunkGenerator, (IEnumerable)children) { } public ExpressionBlock(params SyntaxTreeNode[] children) - : this(new ExpressionCodeGenerator(), children) + : this(new ExpressionChunkGenerator(), children) { } public ExpressionBlock(IEnumerable children) - : this(new ExpressionCodeGenerator(), children) + : this(new ExpressionChunkGenerator(), children) { } } @@ -115,7 +115,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework private const BlockType ThisBlockType = BlockType.Tag; public MarkupTagBlock(params SyntaxTreeNode[] children) - : base(ThisBlockType, children, BlockCodeGenerator.Null) + : base(ThisBlockType, children, ParentChunkGenerator.Null) { } } @@ -124,28 +124,28 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Markup; - public MarkupBlock(BlockType blockType, IBlockCodeGenerator codeGenerator, IEnumerable children) - : base(blockType, children, codeGenerator) + public MarkupBlock(BlockType blockType, IParentChunkGenerator chunkGenerator, IEnumerable children) + : base(blockType, children, chunkGenerator) { } - public MarkupBlock(IBlockCodeGenerator codeGenerator, IEnumerable children) - : this(ThisBlockType, codeGenerator, children) + public MarkupBlock(IParentChunkGenerator chunkGenerator, IEnumerable children) + : this(ThisBlockType, chunkGenerator, children) { } - public MarkupBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children) - : this(codeGenerator, (IEnumerable)children) + public MarkupBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children) + : this(chunkGenerator, (IEnumerable)children) { } public MarkupBlock(params SyntaxTreeNode[] children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } public MarkupBlock(IEnumerable children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } } @@ -213,23 +213,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Section; - public SectionBlock(IBlockCodeGenerator codeGenerator, IEnumerable children) - : base(ThisBlockType, children, codeGenerator) + public SectionBlock(IParentChunkGenerator chunkGenerator, IEnumerable children) + : base(ThisBlockType, children, chunkGenerator) { } - public SectionBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children) - : this(codeGenerator, (IEnumerable)children) + public SectionBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children) + : this(chunkGenerator, (IEnumerable)children) { } public SectionBlock(params SyntaxTreeNode[] children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } public SectionBlock(IEnumerable children) - : this(BlockCodeGenerator.Null, children) + : this(ParentChunkGenerator.Null, children) { } } @@ -238,23 +238,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Template; - public TemplateBlock(IBlockCodeGenerator codeGenerator, IEnumerable children) - : base(ThisBlockType, children, codeGenerator) + public TemplateBlock(IParentChunkGenerator chunkGenerator, IEnumerable children) + : base(ThisBlockType, children, chunkGenerator) { } - public TemplateBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children) - : this(codeGenerator, (IEnumerable)children) + public TemplateBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children) + : this(chunkGenerator, (IEnumerable)children) { } public TemplateBlock(params SyntaxTreeNode[] children) - : this(new TemplateBlockCodeGenerator(), children) + : this(new TemplateBlockChunkGenerator(), children) { } public TemplateBlock(IEnumerable children) - : this(new TemplateBlockCodeGenerator(), children) + : this(new TemplateBlockChunkGenerator(), children) { } } @@ -263,23 +263,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework { private const BlockType ThisBlockType = BlockType.Comment; - public CommentBlock(IBlockCodeGenerator codeGenerator, IEnumerable children) - : base(ThisBlockType, children, codeGenerator) + public CommentBlock(IParentChunkGenerator chunkGenerator, IEnumerable children) + : base(ThisBlockType, children, chunkGenerator) { } - public CommentBlock(IBlockCodeGenerator codeGenerator, params SyntaxTreeNode[] children) - : this(codeGenerator, (IEnumerable)children) + public CommentBlock(IParentChunkGenerator chunkGenerator, params SyntaxTreeNode[] children) + : this(chunkGenerator, (IEnumerable)children) { } public CommentBlock(params SyntaxTreeNode[] children) - : this(new RazorCommentCodeGenerator(), children) + : this(new RazorCommentChunkGenerator(), children) { } public CommentBlock(IEnumerable children) - : this(new RazorCommentCodeGenerator(), children) + : this(new RazorCommentChunkGenerator(), children) { } } diff --git a/test/Microsoft.AspNet.Razor.Test/Framework/ParserTestBase.cs b/test/Microsoft.AspNet.Razor.Test/Framework/ParserTestBase.cs index 8c0f89a323..a3d8ddd1fc 100644 --- a/test/Microsoft.AspNet.Razor.Test/Framework/ParserTestBase.cs +++ b/test/Microsoft.AspNet.Razor.Test/Framework/ParserTestBase.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.TagHelpers; @@ -360,7 +360,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework private static void EvaluateBlock(ErrorCollector collector, Block actual, Block expected) { - if (actual.Type != expected.Type || !expected.CodeGenerator.Equals(actual.CodeGenerator)) + if (actual.Type != expected.Type || !expected.ChunkGenerator.Equals(actual.ChunkGenerator)) { AddMismatchError(collector, actual, expected); } @@ -516,14 +516,14 @@ namespace Microsoft.AspNet.Razor.Test.Framework switch (block.Type) { case BlockType.Markup: - span.With(new MarkupCodeGenerator()); + span.With(new MarkupChunkGenerator()); break; case BlockType.Statement: - span.With(new StatementCodeGenerator()); + span.With(new StatementChunkGenerator()); break; case BlockType.Expression: - block.CodeGenerator = new ExpressionCodeGenerator(); - span.With(new ExpressionCodeGenerator()); + block.ChunkGenerator = new ExpressionChunkGenerator(); + span.With(new ExpressionChunkGenerator()); break; } block.Children.Add(span); diff --git a/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs b/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs index 4446ade9df..1d01af7f05 100644 --- a/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs +++ b/test/Microsoft.AspNet.Razor.Test/Framework/TestSpanBuilder.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Text; @@ -25,7 +25,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework public static SpanConstructor EmptyHtml(this SpanFactory self) { return self.Span(SpanKind.Markup, new HtmlSymbol(self.LocationTracker.CurrentLocation, string.Empty, HtmlSymbolType.Unknown)) - .With(new MarkupCodeGenerator()); + .With(new MarkupChunkGenerator()); } public static UnclassifiedCodeSpanConstructor Code(this SpanFactory self, string content) @@ -108,23 +108,23 @@ namespace Microsoft.AspNet.Razor.Test.Framework { return self .Span(SpanKind.MetaCode, "!", markup: true) - .With(SpanCodeGenerator.Null) + .With(SpanChunkGenerator.Null) .Accepts(AcceptedCharacters.None); } public static SpanConstructor Markup(this SpanFactory self, string content) { - return self.Span(SpanKind.Markup, content, markup: true).With(new MarkupCodeGenerator()); + return self.Span(SpanKind.Markup, content, markup: true).With(new MarkupChunkGenerator()); } public static SpanConstructor Markup(this SpanFactory self, params string[] content) { - return self.Span(SpanKind.Markup, content, markup: true).With(new MarkupCodeGenerator()); + return self.Span(SpanKind.Markup, content, markup: true).With(new MarkupChunkGenerator()); } public static SpanConstructor CodeMarkup(this SpanFactory self, params string[] content) { - return self.Span(SpanKind.Code, content, markup: true).With(new MarkupCodeGenerator()); + return self.Span(SpanKind.Code, content, markup: true).With(new MarkupChunkGenerator()); } public static SourceLocation GetLocationAndAdvance(this SourceLocationTracker self, string content) @@ -274,12 +274,12 @@ namespace Microsoft.AspNet.Razor.Test.Framework public SpanConstructor AsStatement() { - return _self.With(new StatementCodeGenerator()); + return _self.With(new StatementChunkGenerator()); } public SpanConstructor AsExpression() { - return _self.With(new ExpressionCodeGenerator()); + return _self.With(new ExpressionChunkGenerator()); } public SpanConstructor AsImplicitExpression(ISet keywords) @@ -290,28 +290,28 @@ namespace Microsoft.AspNet.Razor.Test.Framework public SpanConstructor AsImplicitExpression(ISet keywords, bool acceptTrailingDot) { return _self.With(new ImplicitExpressionEditHandler(SpanConstructor.TestTokenizer, keywords, acceptTrailingDot)) - .With(new ExpressionCodeGenerator()); + .With(new ExpressionChunkGenerator()); } public SpanConstructor AsFunctionsBody() { - return _self.With(new TypeMemberCodeGenerator()); + return _self.With(new TypeMemberChunkGenerator()); } public SpanConstructor AsNamespaceImport(string ns) { - return _self.With(new AddImportCodeGenerator(ns)); + return _self.With(new AddImportChunkGenerator(ns)); } public SpanConstructor Hidden() { - return _self.With(SpanCodeGenerator.Null); + return _self.With(SpanChunkGenerator.Null); } public SpanConstructor AsBaseType(string baseType) { return _self - .With(new SetBaseTypeCodeGenerator(baseType)) + .With(new SetBaseTypeChunkGenerator(baseType)) .Accepts(AcceptedCharacters.AnyExceptNewline); } @@ -319,27 +319,27 @@ namespace Microsoft.AspNet.Razor.Test.Framework { return _self .With( - new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors: false, lookupText: lookupText)) + new AddOrRemoveTagHelperChunkGenerator(removeTagHelperDescriptors: false, lookupText: lookupText)) .Accepts(AcceptedCharacters.AnyExceptNewline); } public SpanConstructor AsRemoveTagHelper(string lookupText) { return _self - .With(new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors: true, lookupText: lookupText)) + .With(new AddOrRemoveTagHelperChunkGenerator(removeTagHelperDescriptors: true, lookupText: lookupText)) .Accepts(AcceptedCharacters.AnyExceptNewline); } public SpanConstructor AsTagHelperPrefixDirective(string prefix) { return _self - .With(new TagHelperPrefixDirectiveCodeGenerator(prefix)) + .With(new TagHelperPrefixDirectiveChunkGenerator(prefix)) .Accepts(AcceptedCharacters.AnyExceptNewline); } - public SpanConstructor As(ISpanCodeGenerator codeGenerator) + public SpanConstructor As(ISpanChunkGenerator chunkGenerator) { - return _self.With(codeGenerator); + return _self.With(chunkGenerator); } } @@ -368,9 +368,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework return Builder.Build(); } - public SpanConstructor With(ISpanCodeGenerator generator) + public SpanConstructor With(ISpanChunkGenerator generator) { - Builder.CodeGenerator = generator; + Builder.ChunkGenerator = generator; return this; } @@ -380,9 +380,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework return this; } - public SpanConstructor With(Action generatorConfigurer) + public SpanConstructor With(Action generatorConfigurer) { - generatorConfigurer(Builder.CodeGenerator); + generatorConfigurer(Builder.ChunkGenerator); return this; } @@ -399,7 +399,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework public SpanConstructor Hidden() { - Builder.CodeGenerator = SpanCodeGenerator.Null; + Builder.ChunkGenerator = SpanChunkGenerator.Null; return this; } } diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeGenerationTest.cs b/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeGenerationTest.cs deleted file mode 100644 index e045301571..0000000000 --- a/test/Microsoft.AspNet.Razor.Test/Generator/CodeTree/CodeTreeGenerationTest.cs +++ /dev/null @@ -1,18 +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 Xunit; - -namespace Microsoft.AspNet.Razor.Test.Generator -{ - public class CodeTreeGenerationTest : CSharpRazorCodeGeneratorTest - { - [Fact] - public void CodeTreeComparisonTest() - { - RunTest("CodeTree", onResults: (results) => - { - }, designTimeMode: true); - } - } -} diff --git a/test/Microsoft.AspNet.Razor.Test/Generator/RazorCommentCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/Generator/RazorCommentCodeGeneratorTest.cs deleted file mode 100644 index 814fd04f4a..0000000000 --- a/test/Microsoft.AspNet.Razor.Test/Generator/RazorCommentCodeGeneratorTest.cs +++ /dev/null @@ -1,92 +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 System.Linq; -using Microsoft.AspNet.Razor.TagHelpers; -using Xunit; - -namespace Microsoft.AspNet.Razor.Generator -{ - // Really tests underlying BlockCodeGenerator - public class RazorCommentCodeGeneratorTest - { - public static TheoryData MatchingTestDataSet - { - get - { - return new TheoryData - { - { new RazorCommentCodeGenerator(), new RazorCommentCodeGenerator() }, - }; - } - } - - public static TheoryData NonMatchingTestDataSet - { - get - { - return new TheoryData - { - { new RazorCommentCodeGenerator(), null }, - { new RazorCommentCodeGenerator(), new object() }, - { new RazorCommentCodeGenerator(), BlockCodeGenerator.Null }, - { - new RazorCommentCodeGenerator(), - new AttributeBlockCodeGenerator(name: null, prefix: null, suffix: null) - }, - { - new RazorCommentCodeGenerator(), - new DynamicAttributeBlockCodeGenerator(prefix: null, offset: 0, line: 0, col: 0) - }, - { new RazorCommentCodeGenerator(), new ExpressionCodeGenerator() }, - { new RazorCommentCodeGenerator(), new SectionCodeGenerator(sectionName: null) }, - { - new RazorCommentCodeGenerator(), - new TagHelperCodeGenerator(Enumerable.Empty()) - }, - { new RazorCommentCodeGenerator(), new TemplateBlockCodeGenerator() }, - { - new RazorCommentCodeGenerator(), - new AddImportCodeGenerator(ns: "Fred") - }, - }; - } - } - - [Theory] - [MemberData(nameof(MatchingTestDataSet))] - public void Equals_True_WhenExpected(RazorCommentCodeGenerator leftObject, IBlockCodeGenerator rightObject) - { - // Arrange & Act - var result = leftObject.Equals(rightObject); - - // Assert - Assert.True(result); - } - - [Theory] - [MemberData(nameof(NonMatchingTestDataSet))] - public void Equals_False_WhenExpected(IBlockCodeGenerator leftObject, object rightObject) - { - // Arrange & Act - var result = leftObject.Equals(rightObject); - - // Assert - Assert.False(result); - } - - [Theory] - [MemberData(nameof(MatchingTestDataSet))] - public void GetHashCode_ReturnsSameValue_WhenEqual( - RazorCommentCodeGenerator leftObject, - IBlockCodeGenerator rightObject) - { - // Arrange & Act - var leftResult = leftObject.GetHashCode(); - var rightResult = rightObject.GetHashCode(); - - // Assert - Assert.Equal(leftResult, rightResult); - } - } -} diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/BlockTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/BlockTest.cs index 56550ce1f3..bf065b2d6a 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/BlockTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/BlockTest.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Web.WebPages.TestUtils; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Text; @@ -29,21 +29,21 @@ namespace Microsoft.AspNet.Razor.Test.Parser } [Fact] - public void ConstructorTransfersInstanceOfCodeGeneratorFromBlockBuilder() + public void ConstructorTransfersInstanceOfChunkGeneratorFromBlockBuilder() { // Arrange - var expected = new ExpressionCodeGenerator(); + var expected = new ExpressionChunkGenerator(); var builder = new BlockBuilder() { Type = BlockType.Helper, - CodeGenerator = expected + ChunkGenerator = expected }; // Act var actual = builder.Build(); // Assert - Assert.Same(expected, actual.CodeGenerator); + Assert.Same(expected, actual.ChunkGenerator); } [Fact] diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpAutoCompleteTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpAutoCompleteTest.cs index c579a2ce6a..9705cd37f4 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpAutoCompleteTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpAutoCompleteTest.cs @@ -2,7 +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.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp public void SectionDirectiveAutoCompleteAtEOF() { ParseBlockTest("@section Header {", - new SectionBlock(new SectionCodeGenerator("Header"), + new SectionBlock(new SectionChunkGenerator("Header"), Factory.CodeTransition(), Factory.MetaCode("section Header {") .AutoCompleteWith("}", atEndOfSpan: true) @@ -87,7 +87,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp { ParseBlockTest("@section Header {" + Environment.NewLine + "

Foo

", - new SectionBlock(new SectionCodeGenerator("Header"), + new SectionBlock(new SectionChunkGenerator("Header"), Factory.CodeTransition(), Factory.MetaCode("section Header {") .AutoCompleteWith("}", atEndOfSpan: true) @@ -120,7 +120,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp new MarkupTagBlock( Factory.Markup("

").Accepts(AcceptedCharacters.None))), Factory.Span(SpanKind.Code, new CSharpSymbol(Factory.LocationTracker.CurrentLocation, string.Empty, CSharpSymbolType.Unknown)) - .With(new StatementCodeGenerator()) + .With(new StatementChunkGenerator()) ), new RazorError(RazorResources.FormatParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"), 1, 0, 1)); diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs index 5640a9d137..6aa62d5fea 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpBlockTest.cs @@ -2,7 +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.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -704,20 +704,20 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( Factory.Markup("(" href=\"", 183 + Environment.NewLine.Length * 5, 5, 30), new LocationTagged("\"", 246 + Environment.NewLine.Length * 5, 5, 93)), - Factory.Markup(" href=\"").With(SpanCodeGenerator.Null), + Factory.Markup(" href=\"").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( new LocationTagged(string.Empty, 190 + Environment.NewLine.Length * 5, 5, 37), 190 + Environment.NewLine.Length * 5, 5, 37), new ExpressionBlock( Factory.CodeTransition(), Factory.Code("Html.ActionUrl(\"Products\", \"Detail\", new { id = p.Id })") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("\"").With(SpanCodeGenerator.Null)), + Factory.Markup("\"").With(SpanChunkGenerator.Null)), Factory.Markup(">").Accepts(AcceptedCharacters.None)), Factory.EmptyHtml(), new ExpressionBlock( @@ -758,12 +758,12 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 14, 0, 14)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 14, 0, 14)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -774,13 +774,13 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 17, 0, 17)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), - factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 17, 0, 17)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), + factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -791,13 +791,13 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 17, 0, 17)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 17, 0, 17)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("def").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 14, 0, 14), new LocationTagged("def", 14, 0, 14))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("def").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 14, 0, 14), new LocationTagged("def", 14, 0, 14))), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -808,14 +808,14 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 22, 0, 22)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), - factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 22, 0, 22)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), + factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 15, 0, 15), new LocationTagged("@", 16, 0, 16))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup(" def").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 18, 0, 18), new LocationTagged("def", 19, 0, 19))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 15, 0, 15), new LocationTagged("@", 16, 0, 16))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup(" def").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 18, 0, 18), new LocationTagged("def", 19, 0, 19))), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -826,16 +826,16 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 14, 0, 14), 14, 0, 14), - factory.EmptyHtml().With(SpanCodeGenerator.Null), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 14, 0, 14), 14, 0, 14), + factory.EmptyHtml().With(SpanChunkGenerator.Null), datetimeBlock), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -845,15 +845,15 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 28, 0, 28)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 28, 0, 28)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12), datetimeBlock), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 25, 0, 25), new LocationTagged("@", 26, 0, 26))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 25, 0, 25), new LocationTagged("@", 26, 0, 26))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -863,15 +863,15 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12), datetimeBlock), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 25, 0, 25), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 25, 0, 25), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -881,23 +881,23 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 33, 0, 33)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 33, 0, 33)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12), new ExpressionBlock( factory.CodeTransition(), - factory.MetaCode("(").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None), + factory.MetaCode("(").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None), factory.Code("2+3").AsExpression(), - factory.MetaCode(")").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None))), + factory.MetaCode(")").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("@", 18, 0, 18))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("@", 18, 0, 18))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 20, 0, 20), 20, 0, 20), - factory.EmptyHtml().With(SpanCodeGenerator.Null), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 20, 0, 20), 20, 0, 20), + factory.EmptyHtml().With(SpanChunkGenerator.Null), datetimeBlock), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -907,20 +907,20 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 20, 0, 20)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 20, 0, 20)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 14, 0, 14), 14, 0, 14), - factory.EmptyHtml().With(SpanCodeGenerator.Null), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 14, 0, 14), 14, 0, 14), + factory.EmptyHtml().With(SpanChunkGenerator.Null), new ExpressionBlock( factory.CodeTransition(), - factory.MetaCode("(").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None), + factory.MetaCode("(").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None), factory.Code("2+3").AsExpression(), - factory.MetaCode(")").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.MetaCode(")").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None))), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -931,13 +931,13 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 26, 0, 26)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), - factory.Markup("abc@def.com").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc@def.com", 12, 0, 12))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 26, 0, 26)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), + factory.Markup("abc@def.com").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc@def.com", 12, 0, 12))), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 23, 0, 23), new LocationTagged("@", 24, 0, 24))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 23, 0, 23), new LocationTagged("@", 24, 0, 24))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -947,17 +947,17 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), - factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 27, 0, 27)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), + factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("abc", 12, 0, 12))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("def.com").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 17, 0, 17), new LocationTagged("def.com", 17, 0, 17))), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("def.com").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 17, 0, 17), new LocationTagged("def.com", 17, 0, 17))), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 24, 0, 24), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 24, 0, 24), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, { @@ -968,14 +968,14 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( factory.Markup("(" foo=\"", 6, 0, 6), new LocationTagged("\"", 112, 0, 112)), - factory.Markup(" foo=\"").With(SpanCodeGenerator.Null), - factory.Markup(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+", 12, 0, 12))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo=\"", 6, 0, 6), new LocationTagged("\"", 112, 0, 112)), + factory.Markup(" foo=\"").With(SpanChunkGenerator.Null), + factory.Markup(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+", 12, 0, 12))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 44, 0, 44), new LocationTagged("@", 44, 0, 44))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 46, 0, 46), new LocationTagged(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i", 46, 0, 46))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 44, 0, 44), new LocationTagged("@", 44, 0, 44))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 46, 0, 46), new LocationTagged(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i", 46, 0, 46))), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(" />").Accepts(AcceptedCharacters.None)))) }, }; @@ -1000,11 +1000,11 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( Factory.Markup("(" foo='", 6, 0, 6), new LocationTagged(string.Empty, 14, 0, 14)), - Factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged(string.Empty, 14, 0, 14)), + Factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - Factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), - Factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)))), + Factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), new LocationTagged("@", 12, 0, 12))).Accepts(AcceptedCharacters.None), + Factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)))), Factory.EmptyHtml())); var expectedErrors = new RazorError[] { @@ -1026,20 +1026,20 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code); new MarkupTagBlock( Factory.Markup("(" foo='", 6, 0, 6), new LocationTagged("'", 15, 0, 15)), - Factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 6, 0, 6), new LocationTagged("'", 15, 0, 15)), + Factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 12, 0, 12), 12, 0, 12), new ExpressionBlock( Factory.CodeTransition(), Factory.EmptyCSharp().AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace))), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(" ", 13, 0, 13), 13, 0, 13), - Factory.Markup(" ").With(SpanCodeGenerator.Null), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(" ", 13, 0, 13), 13, 0, 13), + Factory.Markup(" ").With(SpanChunkGenerator.Null), new ExpressionBlock( Factory.CodeTransition(), Factory.EmptyCSharp().AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None))), Factory.EmptyCSharp().AsStatement(), Factory.MetaCode("}").Accepts(AcceptedCharacters.None)); diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpDirectivesTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpDirectivesTest.cs index f323c36f27..ac25e18729 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpDirectivesTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpDirectivesTest.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.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -402,7 +402,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp public void SectionDirective() { ParseBlockTest("@section Header {

F{o}o

}", - new SectionBlock(new SectionCodeGenerator("Header"), + new SectionBlock(new SectionChunkGenerator("Header"), Factory.CodeTransition(), Factory.MetaCode("section Header {") .AutoCompleteWith(null, atEndOfSpan: true) diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpSectionTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpSectionTest.cs index 2c8f9754dc..3959cf2540 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpSectionTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpSectionTest.cs @@ -2,7 +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.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section" + Environment.NewLine, new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator(string.Empty), + new SectionBlock(new SectionChunkGenerator(string.Empty), Factory.CodeTransition(), Factory.MetaCode("section" + Environment.NewLine))), new RazorError( @@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp + " ", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo " + Environment.NewLine)), Factory.Markup(" ")), @@ -49,7 +49,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp + " ", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator(string.Empty), + new SectionBlock(new SectionChunkGenerator(string.Empty), Factory.CodeTransition(), Factory.MetaCode("section " + Environment.NewLine)), Factory.Markup(" ")), @@ -78,7 +78,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section 9 {

Foo

}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator(string.Empty), + new SectionBlock(new SectionChunkGenerator(string.Empty), Factory.CodeTransition(), Factory.MetaCode("section ")), Factory.Markup("9 { "), @@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo-bar {

Foo

}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo")), Factory.Markup("-bar { "), @@ -118,13 +118,13 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo { @section bar {

Foo

} }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo {") .AutoCompleteWith(null, atEndOfSpan: true), new MarkupBlock( Factory.Markup(" "), - new SectionBlock(new SectionCodeGenerator("bar"), + new SectionBlock(new SectionChunkGenerator("bar"), Factory.CodeTransition(), Factory.MetaCode("section bar {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo {", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo {") .AutoCompleteWith("}", atEndOfSpan: true), @@ -168,7 +168,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo {

Foo{}

", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo {") .AutoCompleteWith("}", atEndOfSpan: true), @@ -191,7 +191,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo " + Environment.NewLine, new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo " + Environment.NewLine))), new RazorError(RazorResources.ParseError_MissingOpenBraceAfterSection, 12, 0, 12)); @@ -211,7 +211,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp + "}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode(string.Format("section foo {0}{0}{0}{0}{0}{0}{{", Environment.NewLine)) .AutoCompleteWith(null, atEndOfSpan: true), @@ -233,7 +233,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo {

Foo

}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -255,7 +255,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo{

Foo

}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo{") .AutoCompleteWith(null, atEndOfSpan: true), @@ -277,7 +277,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo { }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -299,7 +299,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo { I really want to render a close brace, so here I go: @(\"}\") }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -324,7 +324,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp + "}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -346,7 +346,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp + "}}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -366,7 +366,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section foo {something}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -382,7 +382,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section s {}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("s"), + new SectionBlock(new SectionChunkGenerator("s"), Factory.CodeTransition(), Factory.MetaCode("section s {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -400,7 +400,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp ParseDocumentTest("@section s {}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("s"), + new SectionBlock(new SectionChunkGenerator("s"), Factory.CodeTransition(), Factory.MetaCode("section s {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -417,7 +417,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp "@section s {" + Environment.NewLine + " \" '-->}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("s"), + new SectionBlock(new SectionChunkGenerator("s"), Factory.CodeTransition(), Factory.MetaCode("section s {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -437,7 +437,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp "@section s { }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("s"), + new SectionBlock(new SectionChunkGenerator("s"), Factory.CodeTransition(), Factory.MetaCode("section s {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -459,7 +459,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp "@section s {}", new MarkupBlock( factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("s"), + new SectionBlock(new SectionChunkGenerator("s"), factory.CodeTransition(), factory.MetaCode("section s {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -467,12 +467,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp new MarkupTagBlock( factory.Markup("(" foo='", 17, 0, 17), new LocationTagged("'", 25, 0, 25)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 17, 0, 17), new LocationTagged("'", 25, 0, 25)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 23, 0, 23), new LocationTagged("@", 23, 0, 23))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 23, 0, 23), new LocationTagged("@", 23, 0, 23))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))), factory.MetaCode("}").Accepts(AcceptedCharacters.None)), factory.EmptyHtml()) @@ -481,7 +481,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp "@section s {}", new MarkupBlock( factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("s"), + new SectionBlock(new SectionChunkGenerator("s"), factory.CodeTransition(), factory.MetaCode("section s {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -489,19 +489,19 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp new MarkupTagBlock( factory.Markup("(" foo='", 17, 0, 17), new LocationTagged("'", 39, 0, 39)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 17, 0, 17), new LocationTagged("'", 39, 0, 39)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 23, 0, 23), 23, 0, 23), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 23, 0, 23), 23, 0, 23), new ExpressionBlock( factory.CodeTransition(), factory.Code("DateTime.Now") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 36, 0, 36), new LocationTagged("@", 37, 0, 37))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 36, 0, 36), new LocationTagged("@", 37, 0, 37))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))), factory.MetaCode("}").Accepts(AcceptedCharacters.None)), factory.EmptyHtml()) diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpStatementTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpStatementTest.cs index e46b76850d..bbf4494d50 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpStatementTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpStatementTest.cs @@ -2,7 +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.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -248,7 +248,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp public void NonBlockKeywordTreatedAsImplicitExpression() { ParseBlockTest("@is foo", - new ExpressionBlock(new ExpressionCodeGenerator(), + new ExpressionBlock(new ExpressionChunkGenerator(), Factory.CodeTransition(), Factory.Code("is") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpTemplateTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpTemplateTest.cs index 95d2ed8d98..30159d5836 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpTemplateTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpTemplateTest.cs @@ -3,7 +3,7 @@ using System; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -285,12 +285,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp new MarkupTagBlock( Factory.Markup("(" foo='", 46, 0, 46), new LocationTagged("'", 54, 0, 54)), - Factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 46, 0, 46), new LocationTagged("'", 54, 0, 54)), + Factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - Factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 52, 0, 52), new LocationTagged("@", 52, 0, 52))).Accepts(AcceptedCharacters.None), - Factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + Factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 52, 0, 52), new LocationTagged("@", 52, 0, 52))).Accepts(AcceptedCharacters.None), + Factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(">").Accepts(AcceptedCharacters.None)), Factory.Markup("Foo #"), new ExpressionBlock( diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpToMarkupSwitchTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpToMarkupSwitchTest.cs index f71905d19a..54e85983e8 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpToMarkupSwitchTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CSharp/CSharpToMarkupSwitchTest.cs @@ -3,7 +3,7 @@ using System; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -584,7 +584,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp Factory.Markup(";").Accepts(AcceptedCharacters.None), new MarkupTagBlock( Factory.MarkupTransition("").Accepts(AcceptedCharacters.None)), - Factory.CodeMarkup(" ").With(new StatementCodeGenerator()).Accepts(AcceptedCharacters.None) + Factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None) ), Factory.Code("}").AsStatement())); } @@ -604,7 +604,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp Factory.Markup(";").Accepts(AcceptedCharacters.None), new MarkupTagBlock( Factory.MarkupTransition("").Accepts(AcceptedCharacters.None)), - Factory.CodeMarkup(" ").With(new StatementCodeGenerator()).Accepts(AcceptedCharacters.None) + Factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None) ), Factory.Code("} ").AsStatement(), Factory.MetaCode("}").Accepts(AcceptedCharacters.None))); diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlAttributeTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlAttributeTest.cs index 26f44600af..d2a285bb87 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlAttributeTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlAttributeTest.cs @@ -3,7 +3,7 @@ using System.Linq; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -21,10 +21,10 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), suffix: new LocationTagged("'", 12, 0, 12)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), - Factory.Markup("Foo").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(string.Empty, 9, 0, 9), value: new LocationTagged("Foo", 9, 0, 9))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "href", prefix: new LocationTagged(" href='", 2, 0, 2), suffix: new LocationTagged("'", 12, 0, 12)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), + Factory.Markup("Foo").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(string.Empty, 9, 0, 9), value: new LocationTagged("Foo", 9, 0, 9))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -35,12 +35,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), suffix: new LocationTagged("'", 20, 0, 20)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), - Factory.Markup("Foo").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(string.Empty, 9, 0, 9), value: new LocationTagged("Foo", 9, 0, 9))), - Factory.Markup(" Bar").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(" ", 12, 0, 12), value: new LocationTagged("Bar", 13, 0, 13))), - Factory.Markup(" Baz").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(" ", 16, 0, 16), value: new LocationTagged("Baz", 17, 0, 17))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "href", prefix: new LocationTagged(" href='", 2, 0, 2), suffix: new LocationTagged("'", 20, 0, 20)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), + Factory.Markup("Foo").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(string.Empty, 9, 0, 9), value: new LocationTagged("Foo", 9, 0, 9))), + Factory.Markup(" Bar").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(" ", 12, 0, 12), value: new LocationTagged("Bar", 13, 0, 13))), + Factory.Markup(" Baz").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(" ", 16, 0, 16), value: new LocationTagged("Baz", 17, 0, 17))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -51,12 +51,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href=\"", 2, 0, 2), suffix: new LocationTagged("\"", 20, 0, 20)), - Factory.Markup(" href=\"").With(SpanCodeGenerator.Null), - Factory.Markup("Foo").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(string.Empty, 9, 0, 9), value: new LocationTagged("Foo", 9, 0, 9))), - Factory.Markup(" Bar").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(" ", 12, 0, 12), value: new LocationTagged("Bar", 13, 0, 13))), - Factory.Markup(" Baz").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(" ", 16, 0, 16), value: new LocationTagged("Baz", 17, 0, 17))), - Factory.Markup("\"").With(SpanCodeGenerator.Null)), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "href", prefix: new LocationTagged(" href=\"", 2, 0, 2), suffix: new LocationTagged("\"", 20, 0, 20)), + Factory.Markup(" href=\"").With(SpanChunkGenerator.Null), + Factory.Markup("Foo").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(string.Empty, 9, 0, 9), value: new LocationTagged("Foo", 9, 0, 9))), + Factory.Markup(" Bar").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(" ", 12, 0, 12), value: new LocationTagged("Bar", 13, 0, 13))), + Factory.Markup(" Baz").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(" ", 16, 0, 16), value: new LocationTagged("Baz", 17, 0, 17))), + Factory.Markup("\"").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -67,9 +67,9 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href=", 2, 0, 2), suffix: new LocationTagged(string.Empty, 11, 0, 11)), - Factory.Markup(" href=").With(SpanCodeGenerator.Null), - Factory.Markup("Foo").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(string.Empty, 8, 0, 8), value: new LocationTagged("Foo", 8, 0, 8)))), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "href", prefix: new LocationTagged(" href=", 2, 0, 2), suffix: new LocationTagged(string.Empty, 11, 0, 11)), + Factory.Markup(" href=").With(SpanChunkGenerator.Null), + Factory.Markup("Foo").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(string.Empty, 8, 0, 8), value: new LocationTagged("Foo", 8, 0, 8)))), new MarkupBlock(Factory.Markup(" Bar")), new MarkupBlock(Factory.Markup(" Baz")), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); @@ -82,15 +82,15 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), suffix: new LocationTagged("'", 13, 0, 13)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 9, 0, 9), 9, 0, 9), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "href", prefix: new LocationTagged(" href='", 2, 0, 2), suffix: new LocationTagged("'", 13, 0, 13)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 9, 0, 9), 9, 0, 9), new ExpressionBlock( Factory.CodeTransition(), Factory.Code("foo") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -101,23 +101,23 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), suffix: new LocationTagged("'", 22, 0, 22)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 9, 0, 9), 9, 0, 9), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "href", prefix: new LocationTagged(" href='", 2, 0, 2), suffix: new LocationTagged("'", 22, 0, 22)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 9, 0, 9), 9, 0, 9), new ExpressionBlock( Factory.CodeTransition(), Factory.Code("foo") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup(" bar").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 13, 0, 13), new LocationTagged("bar", 14, 0, 14))), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(" ", 17, 0, 17), 18, 0, 18), - Factory.Markup(" ").With(SpanCodeGenerator.Null), + Factory.Markup(" bar").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 13, 0, 13), new LocationTagged("bar", 14, 0, 14))), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(" ", 17, 0, 17), 18, 0, 18), + Factory.Markup(" ").With(SpanChunkGenerator.Null), new ExpressionBlock( Factory.CodeTransition(), Factory.Code("baz") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -128,9 +128,9 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), suffix: new LocationTagged("'", 23, 0, 23)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 9, 0, 9), 9, 0, 9), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "href", prefix: new LocationTagged(" href='", 2, 0, 2), suffix: new LocationTagged("'", 23, 0, 23)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 9, 0, 9), 9, 0, 9), new ExpressionBlock( Factory.CodeTransition(), Factory.Code("foo") @@ -138,10 +138,10 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html .Accepts(AcceptedCharacters.NonWhiteSpace))), Factory.Markup(" ~/Foo/Bar") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(" ", 13, 0, 13), - new LocationTagged(new ResolveUrlCodeGenerator(), 14, 0, 14))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new LocationTagged(new ResolveUrlChunkGenerator(), 14, 0, 14))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -152,9 +152,9 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" value=", 6, 0, 6), suffix: new LocationTagged(string.Empty, 17, 0, 17)), - Factory.Markup(" value=").With(SpanCodeGenerator.Null), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 13, 0, 13), 13, 0, 13), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "value", prefix: new LocationTagged(" value=", 6, 0, 6), suffix: new LocationTagged(string.Empty, 17, 0, 17)), + Factory.Markup(" value=").With(SpanChunkGenerator.Null), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 13, 0, 13), 13, 0, 13), new ExpressionBlock( Factory.CodeTransition(), Factory.Code("foo") @@ -170,9 +170,9 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" value=", 6, 0, 6), suffix: new LocationTagged(string.Empty, 17, 0, 17)), - Factory.Markup(" value=").With(SpanCodeGenerator.Null), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 13, 0, 13), 13, 0, 13), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "value", prefix: new LocationTagged(" value=", 6, 0, 6), suffix: new LocationTagged(string.Empty, 17, 0, 17)), + Factory.Markup(" value=").With(SpanChunkGenerator.Null), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 13, 0, 13), 13, 0, 13), new ExpressionBlock( Factory.CodeTransition(), Factory.Code("foo") @@ -197,14 +197,14 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), suffix: new LocationTagged("'", 18, 0, 18)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator(name: "href", prefix: new LocationTagged(" href='", 2, 0, 2), suffix: new LocationTagged("'", 18, 0, 18)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo/Bar") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 9, 0, 9), - new LocationTagged(new ResolveUrlCodeGenerator(), 9, 0, 9))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />")))); } @@ -224,12 +224,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( Factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 13, 0, 13)), - Factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 13, 0, 13)), + Factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - Factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), - Factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + Factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), + Factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />")))); } diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlBlockTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlBlockTest.cs index a815119462..20ae58c978 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlBlockTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlBlockTest.cs @@ -3,7 +3,7 @@ using System; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -217,18 +217,18 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" bar=\"", 4, 0, 4), new LocationTagged("\"", 13, 0, 13)), - Factory.Markup(" bar=\"").With(SpanCodeGenerator.Null), - Factory.Markup("baz").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 10, 0, 10), new LocationTagged("baz", 10, 0, 10))), - Factory.Markup("\"").With(SpanCodeGenerator.Null)), + new MarkupBlock(new AttributeBlockChunkGenerator("bar", new LocationTagged(" bar=\"", 4, 0, 4), new LocationTagged("\"", 13, 0, 13)), + Factory.Markup(" bar=\"").With(SpanChunkGenerator.Null), + Factory.Markup("baz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 10, 0, 10), new LocationTagged("baz", 10, 0, 10))), + Factory.Markup("\"").With(SpanChunkGenerator.Null)), Factory.Markup(">").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("(" zoop=", 24, 0, 24), new LocationTagged(string.Empty, 34, 0, 34)), - Factory.Markup(" zoop=").With(SpanCodeGenerator.Null), - Factory.Markup("zork").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 30, 0, 30), new LocationTagged("zork", 30, 0, 30)))), + new MarkupBlock(new AttributeBlockChunkGenerator("zoop", new LocationTagged(" zoop=", 24, 0, 24), new LocationTagged(string.Empty, 34, 0, 34)), + Factory.Markup(" zoop=").With(SpanChunkGenerator.Null), + Factory.Markup("zork").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 30, 0, 30), new LocationTagged("zork", 30, 0, 30)))), Factory.Markup("/>").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharacters.None)), @@ -245,10 +245,10 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup("").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("(" baz=\"", 9, 0, 9), new LocationTagged("\"", 16, 0, 16)), - Factory.Markup(" baz=\"").With(SpanCodeGenerator.Null), - Factory.Markup(">").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged(">", 15, 0, 15))), - Factory.Markup("\"").With(SpanCodeGenerator.Null)), + new MarkupBlock(new AttributeBlockChunkGenerator("baz", new LocationTagged(" baz=\"", 9, 0, 9), new LocationTagged("\"", 16, 0, 16)), + Factory.Markup(" baz=\"").With(SpanChunkGenerator.Null), + Factory.Markup(">").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged(">", 15, 0, 15))), + Factory.Markup("\"").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharacters.None)))); @@ -263,10 +263,10 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup("").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("(" baz='", 9, 0, 9), new LocationTagged("'", 16, 0, 16)), - Factory.Markup(" baz='").With(SpanCodeGenerator.Null), - Factory.Markup(">").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged(">", 15, 0, 15))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new MarkupBlock(new AttributeBlockChunkGenerator("baz", new LocationTagged(" baz='", 9, 0, 9), new LocationTagged("'", 16, 0, 16)), + Factory.Markup(" baz='").With(SpanChunkGenerator.Null), + Factory.Markup(">").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged(">", 15, 0, 15))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharacters.None)))); @@ -281,10 +281,10 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup("").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("(" baz=\"", 9, 0, 9), new LocationTagged("\"", 16, 0, 16)), - Factory.Markup(" baz=\"").With(SpanCodeGenerator.Null), - Factory.Markup("/").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("/", 15, 0, 15))), - Factory.Markup("\"").With(SpanCodeGenerator.Null)), + new MarkupBlock(new AttributeBlockChunkGenerator("baz", new LocationTagged(" baz=\"", 9, 0, 9), new LocationTagged("\"", 16, 0, 16)), + Factory.Markup(" baz=\"").With(SpanChunkGenerator.Null), + Factory.Markup("/").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("/", 15, 0, 15))), + Factory.Markup("\"").With(SpanChunkGenerator.Null)), Factory.Markup(">").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharacters.None)), @@ -301,10 +301,10 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup("").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("(" baz='", 9, 0, 9), new LocationTagged("'", 16, 0, 16)), - Factory.Markup(" baz='").With(SpanCodeGenerator.Null), - Factory.Markup("/").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("/", 15, 0, 15))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new MarkupBlock(new AttributeBlockChunkGenerator("baz", new LocationTagged(" baz='", 9, 0, 9), new LocationTagged("'", 16, 0, 16)), + Factory.Markup(" baz='").With(SpanChunkGenerator.Null), + Factory.Markup("/").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), new LocationTagged("/", 15, 0, 15))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(">").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.Markup("").Accepts(AcceptedCharacters.None)), @@ -495,7 +495,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup(" Baz"), new MarkupTagBlock( Factory.MarkupTransition("")), - Factory.CodeMarkup(" ").With(new StatementCodeGenerator()).Accepts(AcceptedCharacters.None) + Factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None) )); } @@ -516,7 +516,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup("").Accepts(AcceptedCharacters.None)), new MarkupTagBlock( Factory.MarkupTransition("")), - Factory.CodeMarkup(" ").With(new StatementCodeGenerator()).Accepts(AcceptedCharacters.None) + Factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None) )); } diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlDocumentTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlDocumentTest.cs index 81776a164e..58311731b3 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlDocumentTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlDocumentTest.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -104,7 +104,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html + "}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -179,11 +179,11 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href=\"", 2, 0, 2), new LocationTagged("\"", 36, 0, 36)), - Factory.Markup(" href=\"").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href=\"", 2, 0, 2), new LocationTagged("\"", 36, 0, 36)), + Factory.Markup(" href=\"").With(SpanChunkGenerator.Null), Factory.Markup("mailto:anurse@microsoft.com") - .With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 9, 0, 9), new LocationTagged("mailto:anurse@microsoft.com", 9, 0, 9))), - Factory.Markup("\"").With(SpanCodeGenerator.Null)), + .With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 9, 0, 9), new LocationTagged("mailto:anurse@microsoft.com", 9, 0, 9))), + Factory.Markup("\"").With(SpanChunkGenerator.Null)), Factory.Markup(">")), Factory.Markup("Email me"), BlockFactory.MarkupTagBlock("
"))); @@ -261,7 +261,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html ParseDocumentTest(@"@section Foo { }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {") .AutoCompleteWith(autoCompleteString: null, atEndOfSpan: true), @@ -308,12 +308,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 13, 0, 13)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 13, 0, 13)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -323,13 +323,13 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 16, 0, 16)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), - factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("abc", 11, 0, 11))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 16, 0, 16)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), + factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("abc", 11, 0, 11))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 14, 0, 14), new LocationTagged("@", 14, 0, 14))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 14, 0, 14), new LocationTagged("@", 14, 0, 14))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -339,13 +339,13 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 16, 0, 16)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 16, 0, 16)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("def").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 13, 0, 13), new LocationTagged("def", 13, 0, 13))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("def").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 13, 0, 13), new LocationTagged("def", 13, 0, 13))), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -355,14 +355,14 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 21, 0, 21)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), - factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("abc", 11, 0, 11))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 21, 0, 21)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), + factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("abc", 11, 0, 11))), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 14, 0, 14), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup(" def").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 17, 0, 17), new LocationTagged("def", 18, 0, 18))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 14, 0, 14), new LocationTagged("@", 15, 0, 15))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup(" def").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 17, 0, 17), new LocationTagged("def", 18, 0, 18))), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -372,16 +372,16 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 26, 0, 26)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 26, 0, 26)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 13, 0, 13), 13, 0, 13), - factory.EmptyHtml().With(SpanCodeGenerator.Null), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 13, 0, 13), 13, 0, 13), + factory.EmptyHtml().With(SpanChunkGenerator.Null), datetimeBlock), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -390,15 +390,15 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 27, 0, 27)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 27, 0, 27)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), 11, 0, 11), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), 11, 0, 11), datetimeBlock), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 24, 0, 24), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 24, 0, 24), new LocationTagged("@", 25, 0, 25))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -407,23 +407,23 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 32, 0, 32)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 32, 0, 32)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), 11, 0, 11), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), 11, 0, 11), new ExpressionBlock( factory.CodeTransition(), - factory.MetaCode("(").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None), + factory.MetaCode("(").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None), factory.Code("2+3").AsExpression(), - factory.MetaCode(")").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None))), + factory.MetaCode(")").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 17, 0, 17), new LocationTagged("@", 17, 0, 17))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 17, 0, 17), new LocationTagged("@", 17, 0, 17))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 19, 0, 19), 19, 0, 19), - factory.EmptyHtml().With(SpanCodeGenerator.Null), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 19, 0, 19), 19, 0, 19), + factory.EmptyHtml().With(SpanChunkGenerator.Null), datetimeBlock), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -432,20 +432,20 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 19, 0, 19)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 19, 0, 19)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 13, 0, 13), 13, 0, 13), - factory.EmptyHtml().With(SpanCodeGenerator.Null), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 13, 0, 13), 13, 0, 13), + factory.EmptyHtml().With(SpanChunkGenerator.Null), new ExpressionBlock( factory.CodeTransition(), - factory.MetaCode("(").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None), + factory.MetaCode("(").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None), factory.Code("2+3").AsExpression(), - factory.MetaCode(")").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.MetaCode(")").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None))), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -454,15 +454,15 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 26, 0, 26)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 26, 0, 26)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), 11, 0, 11), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), 11, 0, 11), datetimeBlock), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 24, 0, 24), new LocationTagged("@", 24, 0, 24))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 24, 0, 24), new LocationTagged("@", 24, 0, 24))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -472,13 +472,13 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 25, 0, 25)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), - factory.Markup("abc@def.com").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("abc@def.com", 11, 0, 11))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 25, 0, 25)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), + factory.Markup("abc@def.com").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("abc@def.com", 11, 0, 11))), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 22, 0, 22), new LocationTagged("@", 23, 0, 23))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 22, 0, 22), new LocationTagged("@", 23, 0, 23))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -487,17 +487,17 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 26, 0, 26)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), - factory.Markup("abc").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("abc", 11, 0, 11))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 26, 0, 26)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), + factory.Markup("abc").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("abc", 11, 0, 11))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 14, 0, 14), new LocationTagged("@", 14, 0, 14))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("def.com").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 16, 0, 16), new LocationTagged("def.com", 16, 0, 16))), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 14, 0, 14), new LocationTagged("@", 14, 0, 14))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("def.com").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 16, 0, 16), new LocationTagged("def.com", 16, 0, 16))), new MarkupBlock( - factory.Markup(" @").With(new LiteralAttributeCodeGenerator(new LocationTagged(" ", 23, 0, 23), new LocationTagged("@", 24, 0, 24))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup(" @").With(new LiteralAttributeChunkGenerator(new LocationTagged(" ", 23, 0, 23), new LocationTagged("@", 24, 0, 24))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -507,11 +507,11 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo='", 5, 0, 5), new LocationTagged(string.Empty, 13, 0, 13)), - factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged(string.Empty, 13, 0, 13)), + factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)))), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged("@", 11, 0, 11))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)))), factory.EmptyHtml()) }, { @@ -521,14 +521,14 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( factory.Markup("(" foo=\"", 5, 0, 5), new LocationTagged("\"", 111, 0, 111)), - factory.Markup(" foo=\"").With(SpanCodeGenerator.Null), - factory.Markup(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+", 11, 0, 11))), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo=\"", 5, 0, 5), new LocationTagged("\"", 111, 0, 111)), + factory.Markup(" foo=\"").With(SpanChunkGenerator.Null), + factory.Markup(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), new LocationTagged(@"/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+", 11, 0, 11))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 43, 0, 43), new LocationTagged("@", 43, 0, 43))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 45, 0, 45), new LocationTagged(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i", 45, 0, 45))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 43, 0, 43), new LocationTagged("@", 43, 0, 43))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 45, 0, 45), new LocationTagged(@"[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i", 45, 0, 45))), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, }; @@ -551,20 +551,20 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupTagBlock( Factory.Markup("(" foo='", 5, 0, 5), new LocationTagged("'", 14, 0, 14)), - Factory.Markup(" foo='").With(SpanCodeGenerator.Null), + new AttributeBlockChunkGenerator("foo", new LocationTagged(" foo='", 5, 0, 5), new LocationTagged("'", 14, 0, 14)), + Factory.Markup(" foo='").With(SpanChunkGenerator.Null), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 11, 0, 11), 11, 0, 11), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 11, 0, 11), 11, 0, 11), new ExpressionBlock( Factory.CodeTransition(), Factory.EmptyCSharp().AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace))), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator(new LocationTagged(" ", 12, 0, 12), 12, 0, 12), - Factory.Markup(" ").With(SpanCodeGenerator.Null), + new DynamicAttributeBlockChunkGenerator(new LocationTagged(" ", 12, 0, 12), 12, 0, 12), + Factory.Markup(" ").With(SpanChunkGenerator.Null), new ExpressionBlock( - Factory.CodeTransition().Accepts(AcceptedCharacters.None).With(SpanCodeGenerator.Null), + Factory.CodeTransition().Accepts(AcceptedCharacters.None).With(SpanChunkGenerator.Null), Factory.EmptyCSharp().AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />"))); var expectedErrors = new RazorError[] { diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlErrorTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlErrorTest.cs index 20c4da9afd..8484707a3a 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlErrorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlErrorTest.cs @@ -2,7 +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.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Text; @@ -99,9 +99,9 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" bar=", 4, 0, 4), new LocationTagged(string.Empty, 12, 0, 12)), - Factory.Markup(" bar=").With(SpanCodeGenerator.Null), - Factory.Markup("baz").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 9, 0, 9), new LocationTagged("baz", 9, 0, 9)))))), + new MarkupBlock(new AttributeBlockChunkGenerator("bar", new LocationTagged(" bar=", 4, 0, 4), new LocationTagged(string.Empty, 12, 0, 12)), + Factory.Markup(" bar=").With(SpanChunkGenerator.Null), + Factory.Markup("baz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 9, 0, 9), new LocationTagged("baz", 9, 0, 9)))))), new RazorError(RazorResources.FormatParseError_UnfinishedTag("foo"), new SourceLocation(0, 0, 0))); } } diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlToCodeSwitchTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlToCodeSwitchTest.cs index ae127f50ee..ac5eb912fb 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlToCodeSwitchTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlToCodeSwitchTest.cs @@ -3,7 +3,7 @@ using System; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -52,15 +52,15 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" bar=\"", 4, 0, 4), new LocationTagged("\"", 14, 0, 14)), - Factory.Markup(" bar=\"").With(SpanCodeGenerator.Null), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 10, 0, 10), 10, 0, 10), + new MarkupBlock(new AttributeBlockChunkGenerator("bar", new LocationTagged(" bar=\"", 4, 0, 4), new LocationTagged("\"", 14, 0, 14)), + Factory.Markup(" bar=\"").With(SpanChunkGenerator.Null), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 10, 0, 10), 10, 0, 10), new ExpressionBlock( Factory.CodeTransition(), Factory.Code("baz") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("\"").With(SpanCodeGenerator.Null)), + Factory.Markup("\"").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -201,11 +201,11 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href=\"", 2, 0, 2), new LocationTagged("\"", 36, 0, 36)), - Factory.Markup(" href=\"").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href=\"", 2, 0, 2), new LocationTagged("\"", 36, 0, 36)), + Factory.Markup(" href=\"").With(SpanChunkGenerator.Null), Factory.Markup("mailto:anurse@microsoft.com") - .With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 9, 0, 9), new LocationTagged("mailto:anurse@microsoft.com", 9, 0, 9))), - Factory.Markup("\"").With(SpanCodeGenerator.Null)), + .With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 9, 0, 9), new LocationTagged("mailto:anurse@microsoft.com", 9, 0, 9))), + Factory.Markup("\"").With(SpanChunkGenerator.Null)), Factory.Markup(">").Accepts(AcceptedCharacters.None)), Factory.Markup("Email me"), new MarkupTagBlock( @@ -296,7 +296,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html + "}", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("foo"), + new SectionBlock(new SectionChunkGenerator("foo"), Factory.CodeTransition(), Factory.MetaCode("section foo {").AutoCompleteWith(null, atEndOfSpan: true), new MarkupBlock( @@ -393,7 +393,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html ParseDocumentTest("@section Foo { @@bar }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {").AutoCompleteWith(null, atEndOfSpan: true), new MarkupBlock( @@ -415,7 +415,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html ParseDocumentTest("@section Foo { @@@@@bar }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {").AutoCompleteWith(null, atEndOfSpan: true), new MarkupBlock( diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlUrlAttributeTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlUrlAttributeTest.cs index b631c188ce..88e0bf7162 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlUrlAttributeTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/Html/HtmlUrlAttributeTest.cs @@ -3,7 +3,7 @@ using System; using Microsoft.AspNet.Razor.Editor; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; @@ -21,14 +21,14 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo/Bar/Baz") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 9, 0, 9), - new LocationTagged(new ResolveUrlCodeGenerator(), 9, 0, 9))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -39,14 +39,14 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo/Bar/Baz") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 9, 0, 9), - new LocationTagged(new ResolveUrlCodeGenerator(), 9, 0, 9))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />")))); } @@ -56,7 +56,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html ParseDocumentTest("@section Foo { }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {") .AutoCompleteWith(null, atEndOfSpan: true) @@ -65,14 +65,14 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup(" "), new MarkupTagBlock( Factory.Markup("(" href='", 17, 0, 17), new LocationTagged("'", 37, 0, 37)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href='", 17, 0, 17), new LocationTagged("'", 37, 0, 37)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo/Bar/Baz") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 24, 0, 24), - new LocationTagged(new ResolveUrlCodeGenerator(), 24, 0, 24))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new LocationTagged(new ResolveUrlChunkGenerator(), 24, 0, 24))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />")), Factory.Markup(" ") ), @@ -87,22 +87,22 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo/") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 9, 0, 9), - new LocationTagged(new ResolveUrlCodeGenerator(), 9, 0, 9))), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), 15, 0, 15), + new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), 15, 0, 15), new ExpressionBlock( Factory.CodeTransition().Accepts(AcceptedCharacters.None), Factory.Code("id") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), Factory.Markup("/Baz") - .With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("/Baz", 18, 0, 18))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + .With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("/Baz", 18, 0, 18))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -113,22 +113,22 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href='", 2, 0, 2), new LocationTagged("'", 22, 0, 22)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo/") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 9, 0, 9), - new LocationTagged(new ResolveUrlCodeGenerator(), 9, 0, 9))), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 15, 0, 15), 15, 0, 15), + new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 15, 0, 15), 15, 0, 15), new ExpressionBlock( Factory.CodeTransition().Accepts(AcceptedCharacters.None), Factory.Code("id") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), Factory.Markup("/Baz") - .With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("/Baz", 18, 0, 18))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + .With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 18, 0, 18), new LocationTagged("/Baz", 18, 0, 18))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />")))); } @@ -138,7 +138,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html ParseDocumentTest("@section Foo { }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -146,22 +146,22 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup(" "), new MarkupTagBlock( Factory.Markup("(" href='", 17, 0, 17), new LocationTagged("'", 37, 0, 37)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href='", 17, 0, 17), new LocationTagged("'", 37, 0, 37)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo/") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 24, 0, 24), - new LocationTagged(new ResolveUrlCodeGenerator(), 24, 0, 24))), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 30, 0, 30), 30, 0, 30), + new LocationTagged(new ResolveUrlChunkGenerator(), 24, 0, 24))), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 30, 0, 30), 30, 0, 30), new ExpressionBlock( Factory.CodeTransition().Accepts(AcceptedCharacters.None), Factory.Code("id") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), Factory.Markup("/Baz") - .With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 33, 0, 33), new LocationTagged("/Baz", 33, 0, 33))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + .With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 33, 0, 33), new LocationTagged("/Baz", 33, 0, 33))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />")), Factory.Markup(" ") ), @@ -176,14 +176,14 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 31, 0, 31)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href='", 2, 0, 2), new LocationTagged("'", 31, 0, 31)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo+Bar:Baz(Biz),Boz") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 9, 0, 9), - new LocationTagged(new ResolveUrlCodeGenerator(), 9, 0, 9))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -194,14 +194,14 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href='", 2, 0, 2), new LocationTagged("'", 31, 0, 31)), - Factory.Markup(" href='").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href='", 2, 0, 2), new LocationTagged("'", 31, 0, 31)), + Factory.Markup(" href='").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo+Bar:Baz(Biz),Boz") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 9, 0, 9), - new LocationTagged(new ResolveUrlCodeGenerator(), 9, 0, 9))), - Factory.Markup("'").With(SpanCodeGenerator.Null)), + new LocationTagged(new ResolveUrlChunkGenerator(), 9, 0, 9))), + Factory.Markup("'").With(SpanChunkGenerator.Null)), Factory.Markup(" />")))); } @@ -212,21 +212,21 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href=", 2, 0, 2), new LocationTagged(string.Empty, 38, 0, 38)), - Factory.Markup(" href=").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href=", 2, 0, 2), new LocationTagged(string.Empty, 38, 0, 38)), + Factory.Markup(" href=").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo+Bar:Baz(Biz),Boz/") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 8, 0, 8), - new LocationTagged(new ResolveUrlCodeGenerator(), 8, 0, 8))), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 31, 0, 31), 31, 0, 31), + new LocationTagged(new ResolveUrlChunkGenerator(), 8, 0, 8))), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 31, 0, 31), 31, 0, 31), new ExpressionBlock( Factory.CodeTransition() .Accepts(AcceptedCharacters.None), Factory.Code("id") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("/Boz").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 34, 0, 34), new LocationTagged("/Boz", 34, 0, 34)))), + Factory.Markup("/Boz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 34, 0, 34), new LocationTagged("/Boz", 34, 0, 34)))), Factory.Markup(" />").Accepts(AcceptedCharacters.None)))); } @@ -237,21 +237,21 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html new MarkupBlock( new MarkupTagBlock( Factory.Markup("(" href=", 2, 0, 2), new LocationTagged(string.Empty, 38, 0, 38)), - Factory.Markup(" href=").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href=", 2, 0, 2), new LocationTagged(string.Empty, 38, 0, 38)), + Factory.Markup(" href=").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo+Bar:Baz(Biz),Boz/") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 8, 0, 8), - new LocationTagged(new ResolveUrlCodeGenerator(), 8, 0, 8))), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 31, 0, 31), 31, 0, 31), + new LocationTagged(new ResolveUrlChunkGenerator(), 8, 0, 8))), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 31, 0, 31), 31, 0, 31), new ExpressionBlock( Factory.CodeTransition() .Accepts(AcceptedCharacters.None), Factory.Code("id") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("/Boz").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 34, 0, 34), new LocationTagged("/Boz", 34, 0, 34)))), + Factory.Markup("/Boz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 34, 0, 34), new LocationTagged("/Boz", 34, 0, 34)))), Factory.Markup(" />")))); } @@ -261,7 +261,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html ParseDocumentTest("@section Foo { }", new MarkupBlock( Factory.EmptyHtml(), - new SectionBlock(new SectionCodeGenerator("Foo"), + new SectionBlock(new SectionChunkGenerator("Foo"), Factory.CodeTransition(), Factory.MetaCode("section Foo {") .AutoCompleteWith(null, atEndOfSpan: true), @@ -269,21 +269,21 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html Factory.Markup(" "), new MarkupTagBlock( Factory.Markup("(" href=", 17, 0, 17), new LocationTagged(string.Empty, 53, 0, 53)), - Factory.Markup(" href=").With(SpanCodeGenerator.Null), + new MarkupBlock(new AttributeBlockChunkGenerator("href", new LocationTagged(" href=", 17, 0, 17), new LocationTagged(string.Empty, 53, 0, 53)), + Factory.Markup(" href=").With(SpanChunkGenerator.Null), Factory.Markup("~/Foo+Bar:Baz(Biz),Boz/") .WithEditorHints(EditorHints.VirtualPath) - .With(new LiteralAttributeCodeGenerator( + .With(new LiteralAttributeChunkGenerator( new LocationTagged(string.Empty, 23, 0, 23), - new LocationTagged(new ResolveUrlCodeGenerator(), 23, 0, 23))), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 46, 0, 46), 46, 0, 46), + new LocationTagged(new ResolveUrlChunkGenerator(), 23, 0, 23))), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 46, 0, 46), 46, 0, 46), new ExpressionBlock( Factory.CodeTransition() .Accepts(AcceptedCharacters.None), Factory.Code("id") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - Factory.Markup("/Boz").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 49, 0, 49), new LocationTagged("/Boz", 49, 0, 49)))), + Factory.Markup("/Boz").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 49, 0, 49), new LocationTagged("/Boz", 49, 0, 49)))), Factory.Markup(" />")), Factory.Markup(" ") ), diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/PartialParsing/PartialParsingTestBase.cs b/test/Microsoft.AspNet.Razor.Test/Parser/PartialParsing/PartialParsingTestBase.cs index ffbfd56aad..99f6f55fe2 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.Generator; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Utils; @@ -62,14 +62,15 @@ namespace Microsoft.AspNet.Razor.Test.Parser.PartialParsing { return new RazorEngineHost(new TLanguage()) { - GeneratedClassContext = new GeneratedClassContext("Execute", - "Write", - "WriteLiteral", - "WriteTo", - "WriteLiteralTo", - "Template", - "DefineSection", - new GeneratedTagHelperContext()), + GeneratedClassContext = new GeneratedClassContext( + "Execute", + "Write", + "WriteLiteral", + "WriteTo", + "WriteLiteralTo", + "Template", + "DefineSection", + new GeneratedTagHelperContext()), DesignTimeMode = true }; } diff --git a/test/Microsoft.AspNet.Razor.Test/RazorEngineHostTest.cs b/test/Microsoft.AspNet.Razor.Test/RazorEngineHostTest.cs index 65c98b94e0..2751acb16b 100644 --- a/test/Microsoft.AspNet.Razor.Test/RazorEngineHostTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/RazorEngineHostTest.cs @@ -1,7 +1,8 @@ // 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.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser; using Xunit; @@ -67,13 +68,13 @@ namespace Microsoft.AspNet.Razor.Test } [Fact] - public void DecorateCodeGeneratorReturnsIncomingCodeGenerator() + public void DecorateChunkGeneratorReturnsIncomingChunkGenerator() { // Arrange - var expected = new CSharpRazorCodeGenerator("Foo", "Bar", "Baz", CreateHost()); + var expected = new RazorChunkGenerator("Foo", "Bar", "Baz", CreateHost()); // Act - var actual = CreateHost().DecorateCodeGenerator(expected); + var actual = CreateHost().DecorateChunkGenerator(expected); // Assert Assert.Same(expected, actual); diff --git a/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs b/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs index 8693d4323f..a09136f5f3 100644 --- a/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs @@ -7,8 +7,8 @@ using System.IO; using System.Text; using System.Threading; using System.Web.WebPages.TestUtils; -using Microsoft.AspNet.Razor.Generator; -using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; +using Microsoft.AspNet.Razor.Chunks.Generators; +using Microsoft.AspNet.Razor.CodeGeneration; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Text; using Moq; @@ -84,26 +84,26 @@ namespace Microsoft.AspNet.Razor.Test } [Fact] - public void CreateCodeGeneratorMethodPassesCodeGeneratorThroughDecorateMethodOnHost() + public void CreateChunkGeneratorMethodPassesChunkGeneratorThroughDecorateMethodOnHost() { // Arrange var mockHost = new Mock(new CSharpRazorCodeLanguage()) { CallBase = true }; - var expected = new Mock("Foo", "Bar", "Baz", mockHost.Object).Object; + var expected = new Mock("Foo", "Bar", "Baz", mockHost.Object).Object; - mockHost.Setup(h => h.DecorateCodeGenerator(It.IsAny())) + mockHost.Setup(h => h.DecorateChunkGenerator(It.IsAny())) .Returns(expected); var engine = new RazorTemplateEngine(mockHost.Object); // Act - var actual = engine.CreateCodeGenerator("Foo", "Bar", "Baz"); + var actual = engine.CreateChunkGenerator("Foo", "Bar", "Baz"); // Assert Assert.Equal(expected, actual); } [Fact] - public void CreateCodeBuilder_PassesCodeGeneratorThroughDecorateMethodOnHost() + public void CreateCodeBuilder_PassesChunkGeneratorThroughDecorateMethodOnHost() { // Arrange var mockHost = new Mock(new CSharpRazorCodeLanguage()) { CallBase = true }; diff --git a/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperDirectiveSpanVisitorTest.cs b/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperDirectiveSpanVisitorTest.cs index daa8715fdb..9d68a04427 100644 --- a/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperDirectiveSpanVisitorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperDirectiveSpanVisitorTest.cs @@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers #endif [Fact] - public void GetDescriptors_LocatesTagHelperCodeGenerator_CreatesDirectiveDescriptors() + public void GetDescriptors_LocatesTagHelperChunkGenerator_CreatesDirectiveDescriptors() { // Arrange var resolver = new TestTagHelperDescriptorResolver(); @@ -118,7 +118,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers } [Fact] - public void GetDescriptors_LocatesTagHelperPrefixDirectiveCodeGenerator() + public void GetDescriptors_LocatesTagHelperPrefixDirectiveChunkGenerator() { // Arrange var resolver = new TestTagHelperDescriptorResolver(); @@ -145,7 +145,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers } [Fact] - public void GetDescriptors_LocatesAddTagHelperCodeGenerator() + public void GetDescriptors_LocatesAddTagHelperChunkGenerator() { // Arrange var resolver = new TestTagHelperDescriptorResolver(); @@ -169,7 +169,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers } [Fact] - public void GetDescriptors_LocatesNestedRemoveTagHelperCodeGenerator() + public void GetDescriptors_LocatesNestedRemoveTagHelperChunkGenerator() { // Arrange var resolver = new TestTagHelperDescriptorResolver(); diff --git a/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperParseTreeRewriterTest.cs b/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperParseTreeRewriterTest.cs index 634d16f649..c37c115f2d 100644 --- a/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperParseTreeRewriterTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperParseTreeRewriterTest.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using Microsoft.AspNet.Razor.Generator; +using Microsoft.AspNet.Razor.Chunks.Generators; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.TagHelpers; @@ -166,16 +166,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new MarkupTagBlock( factory.Markup("(" class=\"", 4, 0, 4), suffix: new LocationTagged("\"", 15, 0, 15)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 12, 0, 12), value: new LocationTagged("btn", 12, 0, 12))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(" />"))) }, { @@ -184,16 +184,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new MarkupTagBlock( factory.Markup("(" class=\"", 4, 0, 4), suffix: new LocationTagged("\"", 15, 0, 15)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 12, 0, 12), value: new LocationTagged("btn", 12, 0, 12))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">")), blockFactory.MarkupTagBlock("")) }, @@ -363,7 +363,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new MarkupBlock( new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), factory.Markup("hi"))), }, children: factory.Markup("words and spaces"))) @@ -1175,7 +1175,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new MarkupBlock( new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), new MarkupBlock( factory.EmptyHtml(), new ExpressionBlock( @@ -1319,7 +1319,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers attributes: new List> { new KeyValuePair("bound", factory.CodeMarkup("true")), - new KeyValuePair("bound", factory.CodeMarkup(string.Empty).With(SpanCodeGenerator.Null)) + new KeyValuePair("bound", factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)) })), new[] { @@ -1336,7 +1336,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers selfClosing: true, attributes: new List> { - new KeyValuePair("bound", factory.CodeMarkup(string.Empty).With(SpanCodeGenerator.Null)), + new KeyValuePair("bound", factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)), new KeyValuePair("name", new MarkupBlock()) })), new[] @@ -1354,7 +1354,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers selfClosing: true, attributes: new List> { - new KeyValuePair("bound", factory.CodeMarkup(string.Empty).With(SpanCodeGenerator.Null)), + new KeyValuePair("bound", factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)), new KeyValuePair("name", factory.Markup(" ")) })), new[] @@ -1374,8 +1374,8 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers { new KeyValuePair("bound", factory.CodeMarkup("true")), new KeyValuePair("name", factory.Markup("john")), - new KeyValuePair("bound", factory.CodeMarkup(string.Empty).With(SpanCodeGenerator.Null)), - new KeyValuePair("name", factory.Markup(string.Empty).With(SpanCodeGenerator.Null)) + new KeyValuePair("bound", factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)), + new KeyValuePair("name", factory.Markup(string.Empty).With(SpanChunkGenerator.Null)) })), new[] { @@ -1429,7 +1429,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers "myth", new List> { - new KeyValuePair("BOUND", factory.CodeMarkup(string.Empty).With(SpanCodeGenerator.Null)), + new KeyValuePair("BOUND", factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)), new KeyValuePair("nAMe", factory.Markup("john")) })), new[] @@ -1568,16 +1568,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 8, 0, 8), suffix: new LocationTagged("\"", 19, 0, 19)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 16, 0, 16), value: new LocationTagged("btn", 16, 0, 16))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">").Accepts(AcceptedCharacters.None)), factory.Markup("}")))), new [] @@ -1599,16 +1599,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 8, 0, 8), suffix: new LocationTagged("\"", 19, 0, 19)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 16, 0, 16), value: new LocationTagged("btn", 16, 0, 16))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">").Accepts(AcceptedCharacters.None)), blockFactory.EscapedMarkupTagBlock("", AcceptedCharacters.None))), new RazorError[0] @@ -1622,16 +1622,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 8, 0, 8), suffix: new LocationTagged("\"", 19, 0, 19)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 16, 0, 16), value: new LocationTagged("btn", 16, 0, 16))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">").Accepts(AcceptedCharacters.None)), factory.Markup("words with spaces"), blockFactory.EscapedMarkupTagBlock("", AcceptedCharacters.None))), @@ -1646,28 +1646,28 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class='", 8, 0, 8), suffix: new LocationTagged("'", 25, 0, 25)), - factory.Markup(" class='").With(SpanCodeGenerator.Null), + factory.Markup(" class='").With(SpanChunkGenerator.Null), factory.Markup("btn1").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 16, 0, 16), value: new LocationTagged("btn1", 16, 0, 16))), factory.Markup(" btn2").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(" ", 20, 0, 20), value: new LocationTagged("btn2", 21, 0, 21))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class2", prefix: new LocationTagged(" class2=", 26, 0, 26), suffix: new LocationTagged(string.Empty, 37, 0, 37)), - factory.Markup(" class2=").With(SpanCodeGenerator.Null), + factory.Markup(" class2=").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 34, 0, 34), value: new LocationTagged("btn", 34, 0, 34)))), factory.Markup(">").Accepts(AcceptedCharacters.None)), @@ -1683,29 +1683,29 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class='", 8, 0, 8), suffix: new LocationTagged("'", 39, 0, 39)), - factory.Markup(" class='").With(SpanCodeGenerator.Null), + factory.Markup(" class='").With(SpanChunkGenerator.Null), factory.Markup("btn1").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 16, 0, 16), value: new LocationTagged("btn1", 16, 0, 16))), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( new LocationTagged(" ", 20, 0, 20), 21, 0, 21), - factory.Markup(" ").With(SpanCodeGenerator.Null), + factory.Markup(" ").With(SpanChunkGenerator.Null), new ExpressionBlock( factory.CodeTransition(), factory.Code("DateTime.Now") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), factory.Markup(" btn2").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(" ", 34, 0, 34), value: new LocationTagged("btn2", 35, 0, 35))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(">").Accepts(AcceptedCharacters.None)), blockFactory.EscapedMarkupTagBlock("", AcceptedCharacters.None))), new RazorError[0] @@ -1975,13 +1975,13 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=", 8, 0, 8), suffix: new LocationTagged(string.Empty, 16, 0, 16)), - factory.Markup(" class=").With(SpanCodeGenerator.Null), + factory.Markup(" class=").With(SpanChunkGenerator.Null), factory.Markup("}").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 15, 0, 15), value: new LocationTagged("}", 15, 0, 15))))))), new [] @@ -2003,13 +2003,13 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 8, 0, 8), suffix: new LocationTagged(string.Empty, 20, 0, 20)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn}").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 16, 0, 16), value: new LocationTagged("btn}", 16, 0, 16))))))), new [] @@ -2032,16 +2032,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 8, 0, 8), suffix: new LocationTagged("\"", 19, 0, 19)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 16, 0, 16), value: new LocationTagged("btn", 16, 0, 16))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), new MarkupBlock(factory.Markup("}"))))), new [] { @@ -2063,16 +2063,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("text"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 8, 0, 8), suffix: new LocationTagged("\"", 19, 0, 19)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 16, 0, 16), value: new LocationTagged("btn", 16, 0, 16))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(" /"), new MarkupBlock(factory.Markup("}"))))), new [] @@ -2180,13 +2180,13 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=", 5, 0, 5), suffix: new LocationTagged(string.Empty, 13, 0, 13)), - factory.Markup(" class=").With(SpanCodeGenerator.Null), + factory.Markup(" class=").With(SpanChunkGenerator.Null), factory.Markup("}").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 12, 0, 12), value: new LocationTagged("}", 12, 0, 12))))))), new [] @@ -2208,13 +2208,13 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 5, 0, 5), suffix: new LocationTagged(string.Empty, 17, 0, 17)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn}").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn}", 13, 0, 13))))))), new [] @@ -2236,20 +2236,20 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 5, 0, 5), suffix: new LocationTagged(string.Empty, 19, 0, 19)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn", 13, 0, 13))), new MarkupBlock( - factory.Markup("@").With(new LiteralAttributeCodeGenerator(new LocationTagged(string.Empty, 16, 0, 16), new LocationTagged("@", 16, 0, 16))).Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(new LiteralAttributeChunkGenerator(new LocationTagged(string.Empty, 16, 0, 16), new LocationTagged("@", 16, 0, 16))).Accepts(AcceptedCharacters.None), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), factory.Markup("}").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 18, 0, 18), value: new LocationTagged("}", 18, 0, 18))))))), new [] @@ -2272,16 +2272,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 5, 0, 5), suffix: new LocationTagged("\"", 16, 0, 16)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn", 13, 0, 13))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), new MarkupBlock(factory.Markup("}"))))), new [] { @@ -2303,16 +2303,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 5, 0, 5), suffix: new LocationTagged("\"", 16, 0, 16)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn", 13, 0, 13))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(" /"), new MarkupBlock( factory.Markup("}"))))), @@ -2370,11 +2370,11 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=", 3, 0, 3), suffix: new LocationTagged(string.Empty, 10, 0, 10)), - factory.Markup(" class=").With(SpanCodeGenerator.Null)))) + factory.Markup(" class=").With(SpanChunkGenerator.Null)))) }, { "(" class=\"", 3, 0, 3), suffix: new LocationTagged(string.Empty, 14, 0, 14)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 11, 0, 11), value: new LocationTagged("btn", 11, 0, 11)))))) }, @@ -2402,16 +2402,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 3, 0, 3), suffix: new LocationTagged("\"", 14, 0, 14)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 11, 0, 11), value: new LocationTagged("btn", 11, 0, 11))), - factory.Markup("\"").With(SpanCodeGenerator.Null)))) + factory.Markup("\"").With(SpanChunkGenerator.Null)))) }, { "(" class=\"", 3, 0, 3), suffix: new LocationTagged("\"", 14, 0, 14)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 11, 0, 11), value: new LocationTagged("btn", 11, 0, 11))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(" /"))) } }; @@ -2759,16 +2759,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 5, 0, 5), suffix: new LocationTagged("\"", 16, 0, 16)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn", 13, 0, 13))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">").Accepts(AcceptedCharacters.None)), factory.Markup("}")))), new [] @@ -2790,16 +2790,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 5, 0, 5), suffix: new LocationTagged("\"", 16, 0, 16)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn", 13, 0, 13))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">").Accepts(AcceptedCharacters.None)), blockFactory.EscapedMarkupTagBlock("", AcceptedCharacters.None))), new RazorError[0] @@ -2813,16 +2813,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 5, 0, 5), suffix: new LocationTagged("\"", 16, 0, 16)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn", 13, 0, 13))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">").Accepts(AcceptedCharacters.None)), factory.Markup("words with spaces"), blockFactory.EscapedMarkupTagBlock("", AcceptedCharacters.None))), @@ -2837,28 +2837,28 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class='", 5, 0, 5), suffix: new LocationTagged("'", 22, 0, 22)), - factory.Markup(" class='").With(SpanCodeGenerator.Null), + factory.Markup(" class='").With(SpanChunkGenerator.Null), factory.Markup("btn1").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn1", 13, 0, 13))), factory.Markup(" btn2").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(" ", 17, 0, 17), value: new LocationTagged("btn2", 18, 0, 18))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class2", prefix: new LocationTagged(" class2=", 23, 0, 23), suffix: new LocationTagged(string.Empty, 34, 0, 34)), - factory.Markup(" class2=").With(SpanCodeGenerator.Null), + factory.Markup(" class2=").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 31, 0, 31), value: new LocationTagged("btn", 31, 0, 31)))), factory.Markup(">").Accepts(AcceptedCharacters.None)), @@ -2874,29 +2874,29 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class='", 5, 0, 5), suffix: new LocationTagged("'", 36, 0, 36)), - factory.Markup(" class='").With(SpanCodeGenerator.Null), + factory.Markup(" class='").With(SpanChunkGenerator.Null), factory.Markup("btn1").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 13, 0, 13), value: new LocationTagged("btn1", 13, 0, 13))), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( new LocationTagged(" ", 17, 0, 17), 18, 0, 18), - factory.Markup(" ").With(SpanCodeGenerator.Null), + factory.Markup(" ").With(SpanChunkGenerator.Null), new ExpressionBlock( factory.CodeTransition(), factory.Code("DateTime.Now") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), factory.Markup(" btn2").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(" ", 31, 0, 31), value: new LocationTagged("btn2", 32, 0, 32))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(">").Accepts(AcceptedCharacters.None)), blockFactory.EscapedMarkupTagBlock("", AcceptedCharacters.None))), new RazorError[0] @@ -3060,16 +3060,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 3, 0, 3), suffix: new LocationTagged("\"", 14, 0, 14)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 11, 0, 11), value: new LocationTagged("btn", 11, 0, 11))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">"))), new RazorError[0] }, @@ -3081,16 +3081,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 3, 0, 3), suffix: new LocationTagged("\"", 14, 0, 14)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 11, 0, 11), value: new LocationTagged("btn", 11, 0, 11))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">")), blockFactory.EscapedMarkupTagBlock("")), new RazorError[0] @@ -3103,16 +3103,16 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 3, 0, 3), suffix: new LocationTagged("\"", 14, 0, 14)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 11, 0, 11), value: new LocationTagged("btn", 11, 0, 11))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">")), factory.Markup("words and spaces"), blockFactory.EscapedMarkupTagBlock("")), @@ -3126,28 +3126,28 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class='", 3, 0, 3), suffix: new LocationTagged("'", 20, 0, 20)), - factory.Markup(" class='").With(SpanCodeGenerator.Null), + factory.Markup(" class='").With(SpanChunkGenerator.Null), factory.Markup("btn1").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 11, 0, 11), value: new LocationTagged("btn1", 11, 0, 11))), factory.Markup(" btn2").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(" ", 15, 0, 15), value: new LocationTagged("btn2", 16, 0, 16))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class2", prefix: new LocationTagged(" class2=", 21, 0, 21), suffix: new LocationTagged(string.Empty, 32, 0, 32)), - factory.Markup(" class2=").With(SpanCodeGenerator.Null), + factory.Markup(" class2=").With(SpanChunkGenerator.Null), factory.Markup("btn").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 29, 0, 29), value: new LocationTagged("btn", 29, 0, 29)))), factory.Markup(">")), @@ -3162,29 +3162,29 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.BangEscape(), factory.Markup("p"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class='", 3, 0, 3), suffix: new LocationTagged("'", 34, 0, 34)), - factory.Markup(" class='").With(SpanCodeGenerator.Null), + factory.Markup(" class='").With(SpanChunkGenerator.Null), factory.Markup("btn1").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 11, 0, 11), value: new LocationTagged("btn1", 11, 0, 11))), new MarkupBlock( - new DynamicAttributeBlockCodeGenerator( + new DynamicAttributeBlockChunkGenerator( new LocationTagged(" ", 15, 0, 15), 16, 0, 16), - factory.Markup(" ").With(SpanCodeGenerator.Null), + factory.Markup(" ").With(SpanChunkGenerator.Null), new ExpressionBlock( factory.CodeTransition(), factory.Code("DateTime.Now") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), factory.Markup(" btn2").With( - new LiteralAttributeCodeGenerator( + new LiteralAttributeChunkGenerator( prefix: new LocationTagged(" ", 29, 0, 29), value: new LocationTagged("btn2", 30, 0, 30))), - factory.Markup("'").With(SpanCodeGenerator.Null)), + factory.Markup("'").With(SpanChunkGenerator.Null)), factory.Markup(">")), blockFactory.EscapedMarkupTagBlock("")), new RazorError[0] @@ -3241,7 +3241,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers // be a single item, hence don't need to be enclosed by a block. new KeyValuePair( "class", - factory.Markup("").With(SpanCodeGenerator.Null)), + factory.Markup("").With(SpanChunkGenerator.Null)), })) }, { @@ -3254,7 +3254,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new KeyValuePair("class1", new MarkupBlock()), new KeyValuePair( "class2", - factory.Markup("").With(SpanCodeGenerator.Null)), + factory.Markup("").With(SpanChunkGenerator.Null)), new KeyValuePair("class3", new MarkupBlock()), })) }, @@ -3269,7 +3269,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new KeyValuePair("class2", new MarkupBlock()), new KeyValuePair( "class3", - factory.Markup("").With(SpanCodeGenerator.Null)), + factory.Markup("").With(SpanChunkGenerator.Null)), })) }, }; @@ -3898,7 +3898,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("Time:"), new MarkupBlock( factory.Markup(" @").Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), dateTimeNow)) })) }, @@ -3918,7 +3918,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new MarkupBlock( new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), factory.Markup("BoundStringAttribute"))) })) }, @@ -3934,7 +3934,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new MarkupBlock( new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), new MarkupBlock( factory.EmptyHtml(), new ExpressionBlock( @@ -4144,15 +4144,15 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new MarkupTagBlock( factory.Markup("<"), new MarkupBlock( - new AttributeBlockCodeGenerator( + new AttributeBlockChunkGenerator( name: "class", prefix: new LocationTagged(" class=\"", 1, 0, 1), suffix: new LocationTagged("\"", 12, 0, 12)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), - factory.Markup("foo").With(new LiteralAttributeCodeGenerator( + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), + factory.Markup("foo").With(new LiteralAttributeChunkGenerator( prefix: new LocationTagged(string.Empty, 9, 0, 9), value: new LocationTagged("foo", 9, 0, 9))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(" ")), new MarkupTagHelperBlock("p", selfClosing: true)) }, @@ -4523,7 +4523,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("Foo").Accepts(AcceptedCharacters.None), new MarkupTagBlock( factory.MarkupTransition("")), - factory.CodeMarkup(" ").With(new StatementCodeGenerator()).Accepts(AcceptedCharacters.None)), + factory.CodeMarkup(" ").With(new StatementChunkGenerator()).Accepts(AcceptedCharacters.None)), factory.Code("foo++; } while (foo);").AsStatement().Accepts(AcceptedCharacters.None))); var currentFormattedString = "

"; @@ -4629,17 +4629,17 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("Hello World "), new MarkupTagBlock( factory.Markup("(" class=\"", 66, 0, 66), suffix: new LocationTagged("\"", 87, 0, 87)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), - new MarkupBlock(new DynamicAttributeBlockCodeGenerator(new LocationTagged(string.Empty, 74, 0, 74), 74, 0, 74), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), + new MarkupBlock(new DynamicAttributeBlockChunkGenerator(new LocationTagged(string.Empty, 74, 0, 74), 74, 0, 74), new ExpressionBlock( factory.CodeTransition(), factory.Code("DateTime.Now") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">")), factory.Markup("inside of strong tag"), blockFactory.MarkupTagBlock(""))) @@ -4849,7 +4849,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers new MarkupBlock( new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), factory.Markup("foo@bar.com"))), new KeyValuePair("style", factory.Markup("color:red;")) }), @@ -4993,7 +4993,7 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("color"), new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), - factory.Markup("@").With(SpanCodeGenerator.Null).Accepts(AcceptedCharacters.None)), + factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), factory.Markup(":red;"))) }, factory.Markup("Hello World"))) @@ -5032,13 +5032,13 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("Hello World "), new MarkupTagBlock( factory.Markup("(" class=\"", 71, 0, 71), suffix: new LocationTagged("\"", 82, 0, 82)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), - factory.Markup("foo").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(string.Empty, 79, 0, 79), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), + factory.Markup("foo").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(string.Empty, 79, 0, 79), value: new LocationTagged("foo", 79, 0, 79))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">")), factory.Markup("inside of strong tag"), blockFactory.MarkupTagBlock(""))) @@ -5116,13 +5116,13 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers factory.Markup("Hello World "), new MarkupTagBlock( factory.Markup("(" class=\"", 53, 0, 53), suffix: new LocationTagged("\"", 64, 0, 64)), - factory.Markup(" class=\"").With(SpanCodeGenerator.Null), - factory.Markup("foo").With(new LiteralAttributeCodeGenerator(prefix: new LocationTagged(string.Empty, 61, 0, 61), + factory.Markup(" class=\"").With(SpanChunkGenerator.Null), + factory.Markup("foo").With(new LiteralAttributeChunkGenerator(prefix: new LocationTagged(string.Empty, 61, 0, 61), value: new LocationTagged("foo", 61, 0, 61))), - factory.Markup("\"").With(SpanCodeGenerator.Null)), + factory.Markup("\"").With(SpanChunkGenerator.Null)), factory.Markup(">")), factory.Markup("inside of strong tag"), blockFactory.MarkupTagBlock(""))) diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeTree.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeTree.cs deleted file mode 100644 index 250119c119..0000000000 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeTree.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace TestOutput -{ - using System; - using System.Threading.Tasks; - - public class CodeTree - { - private static object @__o; - private void @__RazorDesignTimeHelpers__() - { - #pragma warning disable 219 - #pragma warning restore 219 - } - #line hidden - public CodeTree() - { - } - - #pragma warning disable 1998 - public override async Task ExecuteAsync() - { - } - #pragma warning restore 1998 - } -} diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeTree.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeTree.cshtml deleted file mode 100644 index 5f282702bb..0000000000 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeTree.cshtml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/AddTagHelperDirective.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AddTagHelperDirective.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/AddTagHelperDirective.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AddTagHelperDirective.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/AttributeTargetingTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/AttributeTargetingTagHelpers.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/AttributeTargetingTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/AttributeTargetingTagHelpers.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Await.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Await.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Await.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Await.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Await.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Await.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Await.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Await.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeBuilder.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeBuilder.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.Prefixed.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.Prefixed.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.Prefixed.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.Prefixed.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.RemoveTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.RemoveTagHelper.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.RemoveTagHelper.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.RemoveTagHelper.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Blocks.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Blocks.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Blocks.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Blocks.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CSharpCodeBuilder.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/CSharpCodeBuilder.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CSharpCodeBuilder.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/CSharpCodeBuilder.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeBlock.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/CodeBlock.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeBlock.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/CodeBlock.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeBlockAtEOF.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/CodeBlockAtEOF.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeBlockAtEOF.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/CodeBlockAtEOF.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeBlockWithTextElement.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/CodeBlockWithTextElement.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/CodeBlockWithTextElement.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/CodeBlockWithTextElement.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ComplexTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ComplexTagHelpers.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ComplexTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ComplexTagHelpers.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ConditionalAttributes.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ConditionalAttributes.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ConditionalAttributes.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ConditionalAttributes.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ConditionalAttributes.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ConditionalAttributes.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ConditionalAttributes.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ConditionalAttributes.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/DuplicateTargetTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/DuplicateTargetTagHelper.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyCodeBlock.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyCodeBlock.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyCodeBlock.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyCodeBlock.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyExplicitExpression.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyExplicitExpression.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyExplicitExpression.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyExplicitExpression.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyImplicitExpression.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyImplicitExpression.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyImplicitExpression.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyImplicitExpression.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyImplicitExpressionInCode.Tabs.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyImplicitExpressionInCode.Tabs.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyImplicitExpressionInCode.Tabs.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyImplicitExpressionInCode.Tabs.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyImplicitExpressionInCode.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyImplicitExpressionInCode.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyImplicitExpressionInCode.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyImplicitExpressionInCode.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EscapedTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EscapedTagHelpers.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EscapedTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EscapedTagHelpers.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ExplicitExpression.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ExplicitExpression.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ExplicitExpression.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ExplicitExpression.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ExplicitExpressionAtEOF.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ExplicitExpressionAtEOF.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ExplicitExpressionAtEOF.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ExplicitExpressionAtEOF.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ExpressionsInCode.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ExpressionsInCode.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ExpressionsInCode.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ExpressionsInCode.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlock.DesignTime.Tabs.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlock.DesignTime.Tabs.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlock.DesignTime.Tabs.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlock.DesignTime.Tabs.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlock.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlock.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlock.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlock.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlock.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlock.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlock.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlock.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlockMinimal.DesignTime.Tabs.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlockMinimal.DesignTime.Tabs.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlockMinimal.DesignTime.Tabs.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlockMinimal.DesignTime.Tabs.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlock_Tabs.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlock_Tabs.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/FunctionsBlock_Tabs.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/FunctionsBlock_Tabs.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/HiddenSpansInCode.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/HiddenSpansInCode.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/HiddenSpansInCode.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/HiddenSpansInCode.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/HtmlCommentWithQuote_Double.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/HtmlCommentWithQuote_Double.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/HtmlCommentWithQuote_Double.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/HtmlCommentWithQuote_Double.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/HtmlCommentWithQuote_Single.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/HtmlCommentWithQuote_Single.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/HtmlCommentWithQuote_Single.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/HtmlCommentWithQuote_Single.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ImplicitExpression.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ImplicitExpression.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ImplicitExpression.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ImplicitExpression.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ImplicitExpressionAtEOF.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ImplicitExpressionAtEOF.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ImplicitExpressionAtEOF.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ImplicitExpressionAtEOF.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Imports.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Imports.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Imports.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Imports.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Imports.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Imports.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Imports.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Imports.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Inherits.Designtime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Inherits.Designtime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Inherits.Designtime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Inherits.Designtime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Inherits.Runtime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Inherits.Runtime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Inherits.Runtime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Inherits.Runtime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/InlineBlocks.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/InlineBlocks.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/InlineBlocks.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/InlineBlocks.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Instrumented.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Instrumented.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Instrumented.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Instrumented.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/MarkupInCodeBlock.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MarkupInCodeBlock.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/MarkupInCodeBlock.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MarkupInCodeBlock.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/MinimizedTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/MinimizedTagHelpers.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/MinimizedTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/MinimizedTagHelpers.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/NestedCodeBlocks.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NestedCodeBlocks.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/NestedCodeBlocks.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NestedCodeBlocks.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/NoLinePragmas.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NoLinePragmas.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/NoLinePragmas.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NoLinePragmas.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/NullConditionalExpressions.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NullConditionalExpressions.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/NullConditionalExpressions.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NullConditionalExpressions.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/NullConditionalExpressions.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NullConditionalExpressions.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/NullConditionalExpressions.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NullConditionalExpressions.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/OpenedIf.DesignTime.Tabs.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/OpenedIf.DesignTime.Tabs.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/OpenedIf.DesignTime.Tabs.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/OpenedIf.DesignTime.Tabs.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/OpenedIf.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/OpenedIf.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/OpenedIf.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/OpenedIf.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ParserError.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ParserError.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ParserError.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ParserError.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/PrefixedAttributeTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/PrefixedAttributeTagHelpers.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/PrefixedAttributeTagHelpers.Reversed.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/PrefixedAttributeTagHelpers.Reversed.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/PrefixedAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/PrefixedAttributeTagHelpers.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/RazorComments.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/RazorComments.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/RazorComments.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/RazorComments.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/RazorComments.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/RazorComments.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/RazorComments.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/RazorComments.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/RemoveTagHelperDirective.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/RemoveTagHelperDirective.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/RemoveTagHelperDirective.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/RemoveTagHelperDirective.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ResolveUrl.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ResolveUrl.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ResolveUrl.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ResolveUrl.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Sections.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Sections.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Sections.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Sections.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SimpleUnspacedIf.DesignTime.Tabs.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SimpleUnspacedIf.DesignTime.Tabs.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SimpleUnspacedIf.DesignTime.Tabs.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SimpleUnspacedIf.DesignTime.Tabs.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SingleTagHelper.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.DesignTime.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SingleTagHelper.DesignTime.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.DesignTime.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SingleTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SingleTagHelper.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInSection.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInSection.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Templates.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Templates.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/Templates.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/Templates.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/UnfinishedExpressionInCode.Tabs.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/UnfinishedExpressionInCode.Tabs.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/UnfinishedExpressionInCode.Tabs.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/UnfinishedExpressionInCode.Tabs.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/UnfinishedExpressionInCode.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/UnfinishedExpressionInCode.cs similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/UnfinishedExpressionInCode.cs rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/UnfinishedExpressionInCode.cs diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/AddTagHelperDirective.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/AddTagHelperDirective.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/AddTagHelperDirective.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/AddTagHelperDirective.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/AttributeTargetingTagHelpers.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/AttributeTargetingTagHelpers.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/AttributeTargetingTagHelpers.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/AttributeTargetingTagHelpers.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Await.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Await.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Await.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Await.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/BasicTagHelpers.Prefixed.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/BasicTagHelpers.Prefixed.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/BasicTagHelpers.Prefixed.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/BasicTagHelpers.Prefixed.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/BasicTagHelpers.RemoveTagHelper.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/BasicTagHelpers.RemoveTagHelper.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/BasicTagHelpers.RemoveTagHelper.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/BasicTagHelpers.RemoveTagHelper.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/BasicTagHelpers.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/BasicTagHelpers.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/BasicTagHelpers.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/BasicTagHelpers.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Blocks.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Blocks.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Blocks.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Blocks.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeBlock.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/CodeBlock.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeBlock.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/CodeBlock.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeBlockAtEOF.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/CodeBlockAtEOF.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeBlockAtEOF.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/CodeBlockAtEOF.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeBlockWithTextElement.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/CodeBlockWithTextElement.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/CodeBlockWithTextElement.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/CodeBlockWithTextElement.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ComplexTagHelpers.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ComplexTagHelpers.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ComplexTagHelpers.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ComplexTagHelpers.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ConditionalAttributes.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ConditionalAttributes.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ConditionalAttributes.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ConditionalAttributes.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/DesignTime.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/DesignTime.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/DesignTime.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/DesignTime.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/DuplicateTargetTagHelper.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/DuplicateTargetTagHelper.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/DuplicateTargetTagHelper.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/DuplicateTargetTagHelper.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyAttributeTagHelpers.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyAttributeTagHelpers.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyAttributeTagHelpers.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyAttributeTagHelpers.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyCodeBlock.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyCodeBlock.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyCodeBlock.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyCodeBlock.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyExplicitExpression.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyExplicitExpression.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyExplicitExpression.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyExplicitExpression.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyImplicitExpression.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyImplicitExpression.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyImplicitExpression.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyImplicitExpression.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyImplicitExpressionInCode.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyImplicitExpressionInCode.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EmptyImplicitExpressionInCode.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EmptyImplicitExpressionInCode.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EscapedTagHelpers.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EscapedTagHelpers.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/EscapedTagHelpers.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/EscapedTagHelpers.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ExplicitExpression.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ExplicitExpression.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ExplicitExpression.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ExplicitExpression.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ExplicitExpressionAtEOF.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ExplicitExpressionAtEOF.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ExplicitExpressionAtEOF.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ExplicitExpressionAtEOF.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ExpressionsInCode.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ExpressionsInCode.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ExpressionsInCode.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ExpressionsInCode.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/FunctionsBlock.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/FunctionsBlock.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/FunctionsBlock.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/FunctionsBlock.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/FunctionsBlockMinimal.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/FunctionsBlockMinimal.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/FunctionsBlockMinimal.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/FunctionsBlockMinimal.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/FunctionsBlock_Tabs.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/FunctionsBlock_Tabs.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/FunctionsBlock_Tabs.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/FunctionsBlock_Tabs.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/HiddenSpansInCode.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/HiddenSpansInCode.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/HiddenSpansInCode.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/HiddenSpansInCode.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/HtmlCommentWithQuote_Double.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/HtmlCommentWithQuote_Double.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/HtmlCommentWithQuote_Double.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/HtmlCommentWithQuote_Double.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/HtmlCommentWithQuote_Single.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/HtmlCommentWithQuote_Single.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/HtmlCommentWithQuote_Single.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/HtmlCommentWithQuote_Single.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ImplicitExpression.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ImplicitExpression.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ImplicitExpression.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ImplicitExpression.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ImplicitExpressionAtEOF.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ImplicitExpressionAtEOF.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ImplicitExpressionAtEOF.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ImplicitExpressionAtEOF.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Imports.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Imports.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Imports.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Imports.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Inherits.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Inherits.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Inherits.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Inherits.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/InlineBlocks.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/InlineBlocks.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/InlineBlocks.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/InlineBlocks.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Instrumented.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Instrumented.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Instrumented.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Instrumented.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/MarkupInCodeBlock.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/MarkupInCodeBlock.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/MarkupInCodeBlock.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/MarkupInCodeBlock.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/MinimizedTagHelpers.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/MinimizedTagHelpers.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/MinimizedTagHelpers.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/MinimizedTagHelpers.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/NestedCodeBlocks.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/NestedCodeBlocks.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/NestedCodeBlocks.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/NestedCodeBlocks.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/NoLinePragmas.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/NoLinePragmas.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/NoLinePragmas.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/NoLinePragmas.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/NullConditionalExpressions.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/NullConditionalExpressions.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/NullConditionalExpressions.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/NullConditionalExpressions.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/OpenedIf.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/OpenedIf.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/OpenedIf.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/OpenedIf.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ParserError.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ParserError.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ParserError.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ParserError.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/PrefixedAttributeTagHelpers.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/PrefixedAttributeTagHelpers.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/PrefixedAttributeTagHelpers.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/PrefixedAttributeTagHelpers.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/RazorComments.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/RazorComments.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/RazorComments.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/RazorComments.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/RemoveTagHelperDirective.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/RemoveTagHelperDirective.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/RemoveTagHelperDirective.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/RemoveTagHelperDirective.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ResolveUrl.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ResolveUrl.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/ResolveUrl.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ResolveUrl.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Sections.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Sections.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Sections.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Sections.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/SimpleUnspacedIf.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/SimpleUnspacedIf.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/SimpleUnspacedIf.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/SimpleUnspacedIf.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/SingleTagHelper.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/SingleTagHelper.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/SingleTagHelper.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/SingleTagHelper.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/TagHelpersInSection.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/TagHelpersInSection.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/TagHelpersInSection.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/TagHelpersInSection.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Templates.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Templates.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/Templates.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/Templates.cshtml diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/UnfinishedExpressionInCode.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/UnfinishedExpressionInCode.cshtml similarity index 100% rename from test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/UnfinishedExpressionInCode.cshtml rename to test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/UnfinishedExpressionInCode.cshtml