From 319c53522459af509e3c238739ef5997ca565531 Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Mon, 20 Mar 2017 22:51:51 +0100 Subject: [PATCH] Remove RazorIrNodeVisitorOfT (#1089) --- ...reallocatedTagHelperHtmlAttributeIRNode.cs | 5 - .../AddTagHelperHtmlAttributeIRNode.cs | 10 -- .../CSharpAttributeValueIRNode.cs | 10 -- .../Intermediate/CSharpExpressionIRNode.cs | 10 -- .../Intermediate/CSharpStatementIRNode.cs | 10 -- .../Intermediate/ChecksumIRNode.cs | 5 - .../Intermediate/ClassDeclarationIRNode.cs | 10 -- .../Intermediate/CreateTagHelperIRNode.cs | 10 -- ...arePreallocatedTagHelperAttributeIRNode.cs | 5 - ...reallocatedTagHelperHtmlAttributeIRNode.cs | 5 - .../DeclareTagHelperFieldsIRNode.cs | 10 -- .../Intermediate/DirectiveIRNode.cs | 5 - .../Intermediate/DirectiveTokenIRNode.cs | 5 - .../Intermediate/DocumentIRNode.cs | 10 -- .../Intermediate/ExecuteTagHelpersIRNode.cs | 10 -- .../Intermediate/ExtensionIRNode.cs | 14 -- .../Intermediate/HtmlAttributeIRNode.cs | 10 -- .../Intermediate/HtmlAttributeValueIRNode.cs | 10 -- .../Intermediate/HtmlContentIRNode.cs | 10 -- .../InitializeTagHelperStructureIRNode.cs | 10 -- .../NamespaceDeclarationIRNode.cs | 10 -- .../Intermediate/RazorIRNode.cs | 4 +- .../Intermediate/RazorIRNodeVisitorOfT.cs | 153 ------------------ .../Intermediate/RazorIRToken.cs | 10 -- .../RazorMethodDeclarationIRNode.cs | 10 -- .../SetPreallocatedTagHelperPropertyIRNode.cs | 5 - .../SetTagHelperPropertyIRNode.cs | 10 -- .../Intermediate/TagHelperIRNode.cs | 10 -- .../Intermediate/TemplateIRNode.cs | 10 -- .../Intermediate/UsingStatementIRNode.cs | 10 -- .../RazorDesignTimeIRPass.cs | 5 - .../DesignTimeBasicWriterTest.cs | 5 - .../RedirectedBasicWriterTest.cs | 5 - .../CodeGeneration/RuntimeBasicWriterTest.cs | 5 - .../Intermediate/DefaultRazorIRBuilderTest.cs | 5 - .../Intermediate/ExtensionIRNodeTest.cs | 74 +-------- .../RazorIRBuilderExtensionsTest.cs | 15 -- .../Intermediate/RazorIRNodeWalkerTest.cs | 5 - 38 files changed, 2 insertions(+), 523 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRNodeVisitorOfT.cs diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/AddPreallocatedTagHelperHtmlAttributeIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/AddPreallocatedTagHelperHtmlAttributeIRNode.cs index cfb7543547..2b48311417 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/AddPreallocatedTagHelperHtmlAttributeIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/AddPreallocatedTagHelperHtmlAttributeIRNode.cs @@ -20,10 +20,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { visitor.VisitAddPreallocatedTagHelperHtmlAttribute(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - return visitor.VisitAddPreallocatedTagHelperHtmlAttribute(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/AddTagHelperHtmlAttributeIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/AddTagHelperHtmlAttributeIRNode.cs index 130ea9b693..c312882d34 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/AddTagHelperHtmlAttributeIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/AddTagHelperHtmlAttributeIRNode.cs @@ -28,15 +28,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitAddTagHelperHtmlAttribute(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitAddTagHelperHtmlAttribute(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpAttributeValueIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpAttributeValueIRNode.cs index 367909ab3b..6faf30526d 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpAttributeValueIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpAttributeValueIRNode.cs @@ -25,15 +25,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitCSharpAttributeValue(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitCSharpAttributeValue(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpExpressionIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpExpressionIRNode.cs index 451ce3f79e..64853c0ca2 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpExpressionIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpExpressionIRNode.cs @@ -23,15 +23,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitCSharpExpression(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitCSharpExpression(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpStatementIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpStatementIRNode.cs index 24aa23e41f..005b2bf9d2 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpStatementIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CSharpStatementIRNode.cs @@ -26,15 +26,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitCSharpStatement(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitCSharpStatement(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ChecksumIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ChecksumIRNode.cs index b73c9704b6..a2891f5ec7 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ChecksumIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ChecksumIRNode.cs @@ -26,11 +26,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitChecksum(this); } - public override TResult Accept(RazorIRNodeVisitor visitor) - { - return visitor.VisitChecksum(this); - } - public static ChecksumIRNode Create(RazorSourceDocument sourceDocument) { // See http://msdn.microsoft.com/en-us/library/system.codedom.codechecksumpragma.checksumalgorithmid.aspx diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ClassDeclarationIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ClassDeclarationIRNode.cs index c580b60673..4245258ef7 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ClassDeclarationIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ClassDeclarationIRNode.cs @@ -31,15 +31,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitClass(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitClass(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CreateTagHelperIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CreateTagHelperIRNode.cs index 59435401fd..4eb0f3ac73 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CreateTagHelperIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/CreateTagHelperIRNode.cs @@ -27,15 +27,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitCreateTagHelper(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitCreateTagHelper(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclarePreallocatedTagHelperAttributeIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclarePreallocatedTagHelperAttributeIRNode.cs index 23b4ebd1a7..aedab244d9 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclarePreallocatedTagHelperAttributeIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclarePreallocatedTagHelperAttributeIRNode.cs @@ -26,10 +26,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { visitor.VisitDeclarePreallocatedTagHelperAttribute(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - return visitor.VisitDeclarePreallocatedTagHelperAttribute(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclarePreallocatedTagHelperHtmlAttributeIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclarePreallocatedTagHelperHtmlAttributeIRNode.cs index bc3bb1c9e9..5548e10cdf 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclarePreallocatedTagHelperHtmlAttributeIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclarePreallocatedTagHelperHtmlAttributeIRNode.cs @@ -26,10 +26,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { visitor.VisitDeclarePreallocatedTagHelperHtmlAttribute(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - return visitor.VisitDeclarePreallocatedTagHelperHtmlAttribute(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclareTagHelperFieldsIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclareTagHelperFieldsIRNode.cs index 2cd93e8059..47ac9771bc 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclareTagHelperFieldsIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DeclareTagHelperFieldsIRNode.cs @@ -25,15 +25,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitDeclareTagHelperFields(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitDeclareTagHelperFields(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DirectiveIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DirectiveIRNode.cs index e8c399f9e6..e2bccab07a 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DirectiveIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DirectiveIRNode.cs @@ -25,10 +25,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { visitor.VisitDirective(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - return visitor.VisitDirective(this); - } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DirectiveTokenIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DirectiveTokenIRNode.cs index e00fbed418..282e34b0bf 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DirectiveTokenIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DirectiveTokenIRNode.cs @@ -22,10 +22,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { visitor.VisitDirectiveToken(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - return visitor.VisitDirectiveToken(this); - } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DocumentIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DocumentIRNode.cs index ccd745f436..a8d6d743a0 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DocumentIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/DocumentIRNode.cs @@ -30,15 +30,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitDocument(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitDocument(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ExecuteTagHelpersIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ExecuteTagHelpersIRNode.cs index 1317c0cbeb..1b66a13dd1 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ExecuteTagHelpersIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ExecuteTagHelpersIRNode.cs @@ -23,15 +23,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitExecuteTagHelpers(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitExecuteTagHelpers(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ExtensionIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ExtensionIRNode.cs index f0a8b49854..2bd75f20bc 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ExtensionIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/ExtensionIRNode.cs @@ -22,19 +22,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate typedVisitor.VisitExtension(node); } } - - protected static TResult AcceptExtensionNode(TNode node, RazorIRNodeVisitor visitor) - where TNode : ExtensionIRNode - { - var typedVisitor = visitor as IExtensionIRNodeVisitor; - if (typedVisitor == null) - { - return visitor.VisitExtension(node); - } - else - { - return typedVisitor.VisitExtension(node); - } - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlAttributeIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlAttributeIRNode.cs index 9100f43732..e7c813d95e 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlAttributeIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlAttributeIRNode.cs @@ -29,15 +29,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitHtmlAttribute(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitHtmlAttribute(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlAttributeValueIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlAttributeValueIRNode.cs index dffb3be22d..9d3d4be40b 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlAttributeValueIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlAttributeValueIRNode.cs @@ -27,15 +27,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitHtmlAttributeValue(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitHtmlAttributeValue(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlContentIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlContentIRNode.cs index 174a485f02..8891095f39 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlContentIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/HtmlContentIRNode.cs @@ -25,15 +25,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitHtml(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitHtml(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/InitializeTagHelperStructureIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/InitializeTagHelperStructureIRNode.cs index dbff0c4b55..39eb2692a5 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/InitializeTagHelperStructureIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/InitializeTagHelperStructureIRNode.cs @@ -28,15 +28,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitInitializeTagHelperStructure(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitInitializeTagHelperStructure(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/NamespaceDeclarationIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/NamespaceDeclarationIRNode.cs index edcaec9402..3290bd085f 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/NamespaceDeclarationIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/NamespaceDeclarationIRNode.cs @@ -25,15 +25,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitNamespace(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitNamespace(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRNode.cs index 70273510c5..17052d49fd 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRNode.cs @@ -15,8 +15,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate public abstract SourceSpan? Source { get; set; } - public abstract void Accept(RazorIRNodeVisitor visitor); - - public abstract TResult Accept(RazorIRNodeVisitor visitor); + public abstract void Accept(RazorIRNodeVisitor visitor); } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRNodeVisitorOfT.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRNodeVisitorOfT.cs deleted file mode 100644 index d2188b3413..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRNodeVisitorOfT.cs +++ /dev/null @@ -1,153 +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. - -namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate -{ - public abstract class RazorIRNodeVisitor - { - public virtual TResult Visit(RazorIRNode node) - { - return node.Accept(this); - } - - public virtual TResult VisitDefault(RazorIRNode node) - { - return default(TResult); - } - - public virtual TResult VisitChecksum(ChecksumIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitToken(RazorIRToken node) - { - return VisitDefault(node); - } - - public virtual TResult VisitDirectiveToken(DirectiveTokenIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitDirective(DirectiveIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitExtension(ExtensionIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitCSharpStatement(CSharpStatementIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitCSharpExpression(CSharpExpressionIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitHtmlAttributeValue(HtmlAttributeValueIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitCSharpAttributeValue(CSharpAttributeValueIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitHtmlAttribute(HtmlAttributeIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitClass(ClassDeclarationIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitRazorMethodDeclaration(RazorMethodDeclarationIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitDocument(DocumentIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitHtml(HtmlContentIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitNamespace(NamespaceDeclarationIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitUsingStatement(UsingStatementIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitDeclareTagHelperFields(DeclareTagHelperFieldsIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitTagHelper(TagHelperIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitInitializeTagHelperStructure(InitializeTagHelperStructureIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitCreateTagHelper(CreateTagHelperIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitSetTagHelperProperty(SetTagHelperPropertyIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitAddTagHelperHtmlAttribute(AddTagHelperHtmlAttributeIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitExecuteTagHelpers(ExecuteTagHelpersIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitDeclarePreallocatedTagHelperHtmlAttribute(DeclarePreallocatedTagHelperHtmlAttributeIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitAddPreallocatedTagHelperHtmlAttribute(AddPreallocatedTagHelperHtmlAttributeIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitDeclarePreallocatedTagHelperAttribute(DeclarePreallocatedTagHelperAttributeIRNode node) - { - return VisitDefault(node); - } - - public virtual TResult VisitSetPreallocatedTagHelperProperty(SetPreallocatedTagHelperPropertyIRNode node) - { - return VisitDefault(node); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRToken.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRToken.cs index fe8e299b04..b01c5cab96 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorIRToken.cs @@ -32,16 +32,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitToken(this); } - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitToken(this); - } - public enum TokenKind { Unknown, diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorMethodDeclarationIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorMethodDeclarationIRNode.cs index 61f9e0d6a9..4de723baf9 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorMethodDeclarationIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/RazorMethodDeclarationIRNode.cs @@ -31,15 +31,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitRazorMethodDeclaration(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitRazorMethodDeclaration(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/SetPreallocatedTagHelperPropertyIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/SetPreallocatedTagHelperPropertyIRNode.cs index 9b08e39941..928abd8f8c 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/SetPreallocatedTagHelperPropertyIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/SetPreallocatedTagHelperPropertyIRNode.cs @@ -32,10 +32,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { visitor.VisitSetPreallocatedTagHelperProperty(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - return visitor.VisitSetPreallocatedTagHelperProperty(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/SetTagHelperPropertyIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/SetTagHelperPropertyIRNode.cs index 1bcf84d6cc..d78d6391b6 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/SetTagHelperPropertyIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/SetTagHelperPropertyIRNode.cs @@ -38,15 +38,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitSetTagHelperProperty(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitSetTagHelperProperty(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/TagHelperIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/TagHelperIRNode.cs index 6869f7d3b7..07d95c3dee 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/TagHelperIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/TagHelperIRNode.cs @@ -23,15 +23,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitTagHelper(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitTagHelper(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/TemplateIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/TemplateIRNode.cs index 81b1b0bd44..91d76d18e8 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/TemplateIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/TemplateIRNode.cs @@ -25,16 +25,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate AcceptExtensionNode(this, visitor); } - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return AcceptExtensionNode(this, visitor); - } - public override void WriteNode(RuntimeTarget target, CSharpRenderingContext context) { var extension = target.GetExtension(); diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/UsingStatementIRNode.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/UsingStatementIRNode.cs index fddd53f5fd..4ab1d4a648 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/UsingStatementIRNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Intermediate/UsingStatementIRNode.cs @@ -25,15 +25,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate visitor.VisitUsingStatement(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - return visitor.VisitUsingStatement(this); - } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/RazorDesignTimeIRPass.cs b/src/Microsoft.AspNetCore.Razor.Evolution/RazorDesignTimeIRPass.cs index 45a7e6d1ad..9f993e3f2d 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/RazorDesignTimeIRPass.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/RazorDesignTimeIRPass.cs @@ -91,11 +91,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution { visitor.VisitDefault(this); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - return visitor.VisitDefault(this); - } } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/DesignTimeBasicWriterTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/DesignTimeBasicWriterTest.cs index e212d73359..dcc660aa58 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/DesignTimeBasicWriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/DesignTimeBasicWriterTest.cs @@ -179,11 +179,6 @@ __o = i++; throw new NotImplementedException(); } - public override TResult Accept(RazorIRNodeVisitor visitor) - { - throw new NotImplementedException(); - } - public override void WriteNode(RuntimeTarget target, CSharpRenderingContext context) { throw new NotImplementedException(); diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/RedirectedBasicWriterTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/RedirectedBasicWriterTest.cs index 7005bc84e9..a3a39e8da1 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/RedirectedBasicWriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/RedirectedBasicWriterTest.cs @@ -231,11 +231,6 @@ Test(test_writer, i++); throw new NotImplementedException(); } - public override TResult Accept(RazorIRNodeVisitor visitor) - { - throw new NotImplementedException(); - } - public override void WriteNode(RuntimeTarget target, CSharpRenderingContext context) { throw new NotImplementedException(); diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/RuntimeBasicWriterTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/RuntimeBasicWriterTest.cs index f6a7123747..20ed707a05 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/RuntimeBasicWriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/CodeGeneration/RuntimeBasicWriterTest.cs @@ -191,11 +191,6 @@ Test(i++); throw new NotImplementedException(); } - public override TResult Accept(RazorIRNodeVisitor visitor) - { - throw new NotImplementedException(); - } - public override void WriteNode(RuntimeTarget target, CSharpRenderingContext context) { throw new NotImplementedException(); diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/DefaultRazorIRBuilderTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/DefaultRazorIRBuilderTest.cs index c6caea00d6..e27a0ca0d4 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/DefaultRazorIRBuilderTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/DefaultRazorIRBuilderTest.cs @@ -224,11 +224,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { throw new NotImplementedException(); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - throw new NotImplementedException(); - } } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/ExtensionIRNodeTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/ExtensionIRNodeTest.cs index 4a844e90a3..87804cef33 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/ExtensionIRNodeTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/ExtensionIRNodeTest.cs @@ -42,36 +42,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate Assert.True(visitor.WasSpecificMethodCalled); } - [Fact] - public void Accept_TResult_CallsStandardVisitExtension_ForStandardVisitor() - { - // Arrange - var node = new TestExtensionIRNode(); - var visitor = new StandardVisitor(); - - // Act - node.Accept(visitor); - - // Assert - Assert.True(visitor.WasStandardMethodCalled); - Assert.False(visitor.WasSpecificMethodCalled); - } - - [Fact] - public void Accept_TResult_CallsSpecialVisitExtension_ForSpecialVisitor() - { - // Arrange - var node = new TestExtensionIRNode(); - var visitor = new SpecialVisitor(); - - // Act - node.Accept(visitor); - - // Assert - Assert.False(visitor.WasStandardMethodCalled); - Assert.True(visitor.WasSpecificMethodCalled); - } - private class TestExtensionIRNode : ExtensionIRNode { public override IList Children => throw new NotImplementedException(); @@ -85,12 +55,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate AcceptExtensionNode(this, visitor); } - public override TResult Accept(RazorIRNodeVisitor visitor) - { - // This is the standard visitor boilerplate for an extension node. - return AcceptExtensionNode(this, visitor); - } - public override void WriteNode(RuntimeTarget target, CSharpRenderingContext context) { throw new NotImplementedException(); @@ -113,24 +77,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate } } - private class StandardVisitor : RazorIRNodeVisitor - { - public bool WasStandardMethodCalled { get; private set; } - public bool WasSpecificMethodCalled { get; private set; } - - public override T VisitExtension(ExtensionIRNode node) - { - WasStandardMethodCalled = true; - return default(T); - } - - public T VisitExtension(TestExtensionIRNode node) - { - WasSpecificMethodCalled = true; - return default(T); - } - } - private class SpecialVisitor : RazorIRNodeVisitor, IExtensionIRNodeVisitor { public bool WasStandardMethodCalled { get; private set; } @@ -145,24 +91,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { WasSpecificMethodCalled = true; } - } - - private class SpecialVisitor : RazorIRNodeVisitor, IExtensionIRNodeVisitor - { - public bool WasStandardMethodCalled { get; private set; } - public bool WasSpecificMethodCalled { get; private set; } - - public override T VisitExtension(ExtensionIRNode node) - { - WasStandardMethodCalled = true; - return default(T); - } - - public T VisitExtension(TestExtensionIRNode node) - { - WasSpecificMethodCalled = true; - return default(T); - } - } + } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/RazorIRBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/RazorIRBuilderExtensionsTest.cs index ed9fc86802..1a320bc117 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/RazorIRBuilderExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/RazorIRBuilderExtensionsTest.cs @@ -84,11 +84,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { throw new NotImplementedException(); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - throw new NotImplementedException(); - } } private class BasicIRNode2 : RazorIRNode @@ -103,11 +98,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { throw new NotImplementedException(); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - throw new NotImplementedException(); - } } private class BasicIRNode3 : RazorIRNode @@ -122,11 +112,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate { throw new NotImplementedException(); } - - public override TResult Accept(RazorIRNodeVisitor visitor) - { - throw new NotImplementedException(); - } } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/RazorIRNodeWalkerTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/RazorIRNodeWalkerTest.cs index 87c68e194b..1d11e69ab6 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/RazorIRNodeWalkerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/Intermediate/RazorIRNodeWalkerTest.cs @@ -81,11 +81,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate ((DerivedIRNodeWalker)visitor).VisitBasic(this); } - public override TResult Accept(RazorIRNodeVisitor visitor) - { - throw new NotImplementedException(); - } - public override string ToString() { return Name;