// 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; using Microsoft.AspNetCore.Razor.Language.Intermediate; namespace Microsoft.AspNetCore.Razor.Language { public abstract class IntermediateNodePassBase : RazorEngineFeatureBase { /// /// The default implementation of the s that run in a /// will use this value for its Order property. /// /// /// This value is chosen in such a way that the default implementation runs after the other /// custom implementations for a particular . /// public static readonly int DefaultFeatureOrder = 1000; public virtual int Order { get; } public void Execute(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) { if (codeDocument == null) { throw new ArgumentNullException(nameof(codeDocument)); } if (documentNode == null) { throw new ArgumentNullException(nameof(documentNode)); } if (Engine == null) { throw new InvalidOperationException(Resources.FormatPhaseMustBeInitialized(nameof(Engine))); } ExecuteCore(codeDocument, documentNode); } protected abstract void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode); } }