From ebe29d0873ded7602b592ac6a29de46ee4bd2088 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Fri, 8 Dec 2023 17:52:14 +0200 Subject: [PATCH] Seal types not suitable for extending --- Fluid/Accessors/AsyncDelegateAccessor.cs | 2 +- Fluid/Accessors/DelegateAccessor.cs | 2 +- Fluid/Accessors/MethodInfoAccessor.cs | 2 +- Fluid/Accessors/PropertyInfoAccessor.cs | 2 +- Fluid/Ast/AssignStatement.cs | 2 +- Fluid/Ast/BinaryExpressions/StartsWithBinaryExpression.cs | 2 +- Fluid/Ast/BinaryExpressions/SubstractBinaryExpression.cs | 2 +- Fluid/Ast/BreakStatement.cs | 2 +- Fluid/Ast/CallbackStatement.cs | 2 +- Fluid/Ast/CaptureStatement.cs | 2 +- Fluid/Ast/CaseStatement.cs | 2 +- Fluid/Ast/CommentStatement.cs | 2 +- Fluid/Ast/ContinueStatement.cs | 2 +- Fluid/Ast/DecrementStatement.cs | 2 +- Fluid/Ast/ElseIfStatement.cs | 2 +- Fluid/Ast/ElseStatement.cs | 2 +- Fluid/Ast/FilterExpression.cs | 2 +- Fluid/Ast/ForStatement.cs | 2 +- Fluid/Ast/FunctionCallSegment.cs | 2 +- Fluid/Ast/IdentifierSegment.cs | 2 +- Fluid/Ast/IfStatement.cs | 2 +- Fluid/Ast/IncludeStatement.cs | 2 +- Fluid/Ast/IncrementStatement.cs | 2 +- Fluid/Ast/IndexerSegment.cs | 2 +- Fluid/Ast/LiquidStatement.cs | 2 +- Fluid/Ast/MacroStatement.cs | 2 +- Fluid/Ast/MemberExpression.cs | 2 +- Fluid/Ast/NamedExpressionList.cs | 2 +- Fluid/Ast/OutputStatement.cs | 2 +- Fluid/Ast/RangeExpression.cs | 2 +- Fluid/Ast/RawStatement.cs | 2 +- Fluid/Ast/RenderStatement.cs | 2 +- Fluid/Ast/UnlessStatement.cs | 2 +- Fluid/Ast/WhenStatement.cs | 2 +- Fluid/FilterArguments.cs | 2 +- Fluid/FiltersCollection.cs | 2 +- Fluid/FunctionArguments.cs | 2 +- Fluid/MemberNameStrategies.cs | 2 +- Fluid/NullMemberAccessor.cs | 2 +- Fluid/ParseException.cs | 2 +- Fluid/Parser/CompositeFluidTemplate.cs | 2 +- Fluid/Parser/FluidTemplate.cs | 2 +- Fluid/Scope.cs | 2 +- Fluid/UnsafeMemberAccessStrategy.cs | 2 +- 44 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Fluid/Accessors/AsyncDelegateAccessor.cs b/Fluid/Accessors/AsyncDelegateAccessor.cs index 8270e53d..c8ab88c0 100644 --- a/Fluid/Accessors/AsyncDelegateAccessor.cs +++ b/Fluid/Accessors/AsyncDelegateAccessor.cs @@ -3,7 +3,7 @@ namespace Fluid.Accessors { - public class AsyncDelegateAccessor : AsyncDelegateAccessor + public sealed class AsyncDelegateAccessor : AsyncDelegateAccessor { public AsyncDelegateAccessor(Func> getter) : base((obj, name, ctx) => getter(obj, name)) { diff --git a/Fluid/Accessors/DelegateAccessor.cs b/Fluid/Accessors/DelegateAccessor.cs index e836aabf..2a6ed857 100644 --- a/Fluid/Accessors/DelegateAccessor.cs +++ b/Fluid/Accessors/DelegateAccessor.cs @@ -2,7 +2,7 @@ namespace Fluid.Accessors { - public class DelegateAccessor : DelegateAccessor + public sealed class DelegateAccessor : DelegateAccessor { public DelegateAccessor(Func getter) : base((obj, name, ctx) => getter(obj, name)) { diff --git a/Fluid/Accessors/MethodInfoAccessor.cs b/Fluid/Accessors/MethodInfoAccessor.cs index 5362b34b..723c1657 100644 --- a/Fluid/Accessors/MethodInfoAccessor.cs +++ b/Fluid/Accessors/MethodInfoAccessor.cs @@ -2,7 +2,7 @@ namespace Fluid.Accessors { - public class MethodInfoAccessor : IMemberAccessor + public sealed class MethodInfoAccessor : IMemberAccessor { private readonly MethodInfo _methodInfo; diff --git a/Fluid/Accessors/PropertyInfoAccessor.cs b/Fluid/Accessors/PropertyInfoAccessor.cs index d318cef3..e9f20a90 100644 --- a/Fluid/Accessors/PropertyInfoAccessor.cs +++ b/Fluid/Accessors/PropertyInfoAccessor.cs @@ -3,7 +3,7 @@ namespace Fluid.Accessors { - public class PropertyInfoAccessor : IMemberAccessor + public sealed class PropertyInfoAccessor : IMemberAccessor { private readonly IInvoker _invoker; diff --git a/Fluid/Ast/AssignStatement.cs b/Fluid/Ast/AssignStatement.cs index a3a119b6..fc4dcab7 100644 --- a/Fluid/Ast/AssignStatement.cs +++ b/Fluid/Ast/AssignStatement.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class AssignStatement : Statement + public sealed class AssignStatement : Statement { public AssignStatement(string identifier, Expression value) { diff --git a/Fluid/Ast/BinaryExpressions/StartsWithBinaryExpression.cs b/Fluid/Ast/BinaryExpressions/StartsWithBinaryExpression.cs index 1dd1a764..322e8f7e 100644 --- a/Fluid/Ast/BinaryExpressions/StartsWithBinaryExpression.cs +++ b/Fluid/Ast/BinaryExpressions/StartsWithBinaryExpression.cs @@ -3,7 +3,7 @@ namespace Fluid.Ast.BinaryExpressions { - public class StartsWithBinaryExpression : BinaryExpression + public sealed class StartsWithBinaryExpression : BinaryExpression { public StartsWithBinaryExpression(Expression left, Expression right) : base(left, right) { diff --git a/Fluid/Ast/BinaryExpressions/SubstractBinaryExpression.cs b/Fluid/Ast/BinaryExpressions/SubstractBinaryExpression.cs index f7779c7f..4c021e19 100644 --- a/Fluid/Ast/BinaryExpressions/SubstractBinaryExpression.cs +++ b/Fluid/Ast/BinaryExpressions/SubstractBinaryExpression.cs @@ -2,7 +2,7 @@ namespace Fluid.Ast.BinaryExpressions { - public class SubstractBinaryExpression : BinaryExpression + public sealed class SubstractBinaryExpression : BinaryExpression { public SubstractBinaryExpression(Expression left, Expression right) : base(left, right) { diff --git a/Fluid/Ast/BreakStatement.cs b/Fluid/Ast/BreakStatement.cs index 3a639dde..20251f06 100644 --- a/Fluid/Ast/BreakStatement.cs +++ b/Fluid/Ast/BreakStatement.cs @@ -4,7 +4,7 @@ namespace Fluid.Ast { - public class BreakStatement : Statement + public sealed class BreakStatement : Statement { public override ValueTask WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) { diff --git a/Fluid/Ast/CallbackStatement.cs b/Fluid/Ast/CallbackStatement.cs index 2ed87e5a..711b1d2a 100644 --- a/Fluid/Ast/CallbackStatement.cs +++ b/Fluid/Ast/CallbackStatement.cs @@ -8,7 +8,7 @@ namespace Fluid.Ast /// /// An instance of this class is used to execute some custom code in a template. /// - public class CallbackStatement : Statement + public sealed class CallbackStatement : Statement { public CallbackStatement(Func> action) { diff --git a/Fluid/Ast/CaptureStatement.cs b/Fluid/Ast/CaptureStatement.cs index 41625ee4..dfa368f7 100644 --- a/Fluid/Ast/CaptureStatement.cs +++ b/Fluid/Ast/CaptureStatement.cs @@ -7,7 +7,7 @@ namespace Fluid.Ast { - public class CaptureStatement : TagStatement + public sealed class CaptureStatement : TagStatement { public CaptureStatement(string identifier, List statements): base(statements) { diff --git a/Fluid/Ast/CaseStatement.cs b/Fluid/Ast/CaseStatement.cs index b971bc0a..d801e941 100644 --- a/Fluid/Ast/CaseStatement.cs +++ b/Fluid/Ast/CaseStatement.cs @@ -6,7 +6,7 @@ namespace Fluid.Ast { - public class CaseStatement : TagStatement + public sealed class CaseStatement : TagStatement { private readonly WhenStatement[] _whenStatements; diff --git a/Fluid/Ast/CommentStatement.cs b/Fluid/Ast/CommentStatement.cs index 9486f449..eb2a4792 100644 --- a/Fluid/Ast/CommentStatement.cs +++ b/Fluid/Ast/CommentStatement.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class CommentStatement : Statement + public sealed class CommentStatement : Statement { private readonly TextSpan _text; diff --git a/Fluid/Ast/ContinueStatement.cs b/Fluid/Ast/ContinueStatement.cs index 09153390..92598b5c 100644 --- a/Fluid/Ast/ContinueStatement.cs +++ b/Fluid/Ast/ContinueStatement.cs @@ -4,7 +4,7 @@ namespace Fluid.Ast { - public class ContinueStatement : Statement + public sealed class ContinueStatement : Statement { public override ValueTask WriteToAsync(TextWriter writer, TextEncoder encoder, TemplateContext context) { diff --git a/Fluid/Ast/DecrementStatement.cs b/Fluid/Ast/DecrementStatement.cs index d9c2972c..6f4cb7ee 100644 --- a/Fluid/Ast/DecrementStatement.cs +++ b/Fluid/Ast/DecrementStatement.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class DecrementStatement : Statement + public sealed class DecrementStatement : Statement { public DecrementStatement(string identifier) { diff --git a/Fluid/Ast/ElseIfStatement.cs b/Fluid/Ast/ElseIfStatement.cs index 56227201..86288ebd 100644 --- a/Fluid/Ast/ElseIfStatement.cs +++ b/Fluid/Ast/ElseIfStatement.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class ElseIfStatement : TagStatement + public sealed class ElseIfStatement : TagStatement { public ElseIfStatement(Expression condition, List statements) : base(statements) { diff --git a/Fluid/Ast/ElseStatement.cs b/Fluid/Ast/ElseStatement.cs index a407e04e..de372397 100644 --- a/Fluid/Ast/ElseStatement.cs +++ b/Fluid/Ast/ElseStatement.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class ElseStatement : TagStatement + public sealed class ElseStatement : TagStatement { public ElseStatement(List statements) : base(statements) { diff --git a/Fluid/Ast/FilterExpression.cs b/Fluid/Ast/FilterExpression.cs index f518746b..212b0b98 100644 --- a/Fluid/Ast/FilterExpression.cs +++ b/Fluid/Ast/FilterExpression.cs @@ -4,7 +4,7 @@ namespace Fluid.Ast { - public class FilterExpression : Expression + public sealed class FilterExpression : Expression { public FilterExpression(Expression input, string name, List parameters) { diff --git a/Fluid/Ast/ForStatement.cs b/Fluid/Ast/ForStatement.cs index 38849433..6e15785e 100644 --- a/Fluid/Ast/ForStatement.cs +++ b/Fluid/Ast/ForStatement.cs @@ -8,7 +8,7 @@ namespace Fluid.Ast { - public class ForStatement : TagStatement + public sealed class ForStatement : TagStatement { private bool _isContinueOffset; private string _continueOffsetLiteral; diff --git a/Fluid/Ast/FunctionCallSegment.cs b/Fluid/Ast/FunctionCallSegment.cs index 182d3b73..3c2c8996 100644 --- a/Fluid/Ast/FunctionCallSegment.cs +++ b/Fluid/Ast/FunctionCallSegment.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class FunctionCallSegment : MemberSegment + public sealed class FunctionCallSegment : MemberSegment { private static readonly FunctionArguments NonCacheableArguments = new(); private volatile FunctionArguments _cachedArguments; diff --git a/Fluid/Ast/IdentifierSegment.cs b/Fluid/Ast/IdentifierSegment.cs index b749ac81..fd2a84b5 100644 --- a/Fluid/Ast/IdentifierSegment.cs +++ b/Fluid/Ast/IdentifierSegment.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { [DebuggerDisplay("{Identifier,nq}")] - public class IdentifierSegment : MemberSegment + public sealed class IdentifierSegment : MemberSegment { public IdentifierSegment(string identifier) { diff --git a/Fluid/Ast/IfStatement.cs b/Fluid/Ast/IfStatement.cs index e081294b..1f1aef02 100644 --- a/Fluid/Ast/IfStatement.cs +++ b/Fluid/Ast/IfStatement.cs @@ -6,7 +6,7 @@ namespace Fluid.Ast { - public class IfStatement : TagStatement + public sealed class IfStatement : TagStatement { private readonly List _elseIfStatements; diff --git a/Fluid/Ast/IncludeStatement.cs b/Fluid/Ast/IncludeStatement.cs index f43760c9..62108d89 100644 --- a/Fluid/Ast/IncludeStatement.cs +++ b/Fluid/Ast/IncludeStatement.cs @@ -10,7 +10,7 @@ namespace Fluid.Ast { #pragma warning disable CA1001 // Types that own disposable fields should be disposable - public class IncludeStatement : Statement + public sealed class IncludeStatement : Statement #pragma warning restore CA1001 { public const string ViewExtension = ".liquid"; diff --git a/Fluid/Ast/IncrementStatement.cs b/Fluid/Ast/IncrementStatement.cs index 3b56d1fa..d72631ae 100644 --- a/Fluid/Ast/IncrementStatement.cs +++ b/Fluid/Ast/IncrementStatement.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class IncrementStatement : Statement + public sealed class IncrementStatement : Statement { public const string Prefix = "$$incdec$$$"; public IncrementStatement(string identifier) diff --git a/Fluid/Ast/IndexerSegment.cs b/Fluid/Ast/IndexerSegment.cs index c5c1ac82..f354cee5 100644 --- a/Fluid/Ast/IndexerSegment.cs +++ b/Fluid/Ast/IndexerSegment.cs @@ -3,7 +3,7 @@ namespace Fluid.Ast { - public class IndexerSegment : MemberSegment + public sealed class IndexerSegment : MemberSegment { public IndexerSegment(Expression expression) { diff --git a/Fluid/Ast/LiquidStatement.cs b/Fluid/Ast/LiquidStatement.cs index 3f58d100..2576ed4a 100644 --- a/Fluid/Ast/LiquidStatement.cs +++ b/Fluid/Ast/LiquidStatement.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class LiquidStatement : TagStatement + public sealed class LiquidStatement : TagStatement { public LiquidStatement(List statements) : base(statements) { diff --git a/Fluid/Ast/MacroStatement.cs b/Fluid/Ast/MacroStatement.cs index fce7c100..372b0ea8 100644 --- a/Fluid/Ast/MacroStatement.cs +++ b/Fluid/Ast/MacroStatement.cs @@ -7,7 +7,7 @@ namespace Fluid.Ast { - public class MacroStatement : TagStatement + public sealed class MacroStatement : TagStatement { public MacroStatement(string identifier, IReadOnlyList arguments, List statements): base(statements) { diff --git a/Fluid/Ast/MemberExpression.cs b/Fluid/Ast/MemberExpression.cs index becb91d6..0886c56c 100644 --- a/Fluid/Ast/MemberExpression.cs +++ b/Fluid/Ast/MemberExpression.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class MemberExpression : Expression + public sealed class MemberExpression : Expression { public MemberExpression(params MemberSegment[] segments) { diff --git a/Fluid/Ast/NamedExpressionList.cs b/Fluid/Ast/NamedExpressionList.cs index 90b44611..7feee2ec 100644 --- a/Fluid/Ast/NamedExpressionList.cs +++ b/Fluid/Ast/NamedExpressionList.cs @@ -2,7 +2,7 @@ namespace Fluid.Ast { - public class NamedExpressionList + public sealed class NamedExpressionList { public static readonly NamedExpressionList Empty = new NamedExpressionList(); diff --git a/Fluid/Ast/OutputStatement.cs b/Fluid/Ast/OutputStatement.cs index 4d510da4..18e039c2 100644 --- a/Fluid/Ast/OutputStatement.cs +++ b/Fluid/Ast/OutputStatement.cs @@ -6,7 +6,7 @@ namespace Fluid.Ast { - public class OutputStatement : Statement + public sealed class OutputStatement : Statement { public OutputStatement(Expression expression) { diff --git a/Fluid/Ast/RangeExpression.cs b/Fluid/Ast/RangeExpression.cs index 1c22cccf..78801676 100644 --- a/Fluid/Ast/RangeExpression.cs +++ b/Fluid/Ast/RangeExpression.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class RangeExpression : Expression + public sealed class RangeExpression : Expression { public RangeExpression(Expression from, Expression to) { diff --git a/Fluid/Ast/RawStatement.cs b/Fluid/Ast/RawStatement.cs index 8d7e5ca6..81c697f0 100644 --- a/Fluid/Ast/RawStatement.cs +++ b/Fluid/Ast/RawStatement.cs @@ -6,7 +6,7 @@ namespace Fluid.Ast { - public class RawStatement : Statement + public sealed class RawStatement : Statement { private readonly TextSpan _text; diff --git a/Fluid/Ast/RenderStatement.cs b/Fluid/Ast/RenderStatement.cs index 83b165c2..b0cf9922 100644 --- a/Fluid/Ast/RenderStatement.cs +++ b/Fluid/Ast/RenderStatement.cs @@ -13,7 +13,7 @@ namespace Fluid.Ast /// The render tag can only access immutable environments, which means the scope of the context that was passed to the main template, the options' scope, and the model. /// #pragma warning disable CA1001 // Types that own disposable fields should be disposable - public class RenderStatement : Statement + public sealed class RenderStatement : Statement #pragma warning restore CA1001 { public const string ViewExtension = ".liquid"; diff --git a/Fluid/Ast/UnlessStatement.cs b/Fluid/Ast/UnlessStatement.cs index 84ee24da..847a15a9 100644 --- a/Fluid/Ast/UnlessStatement.cs +++ b/Fluid/Ast/UnlessStatement.cs @@ -5,7 +5,7 @@ namespace Fluid.Ast { - public class UnlessStatement : TagStatement + public sealed class UnlessStatement : TagStatement { public UnlessStatement( Expression condition, diff --git a/Fluid/Ast/WhenStatement.cs b/Fluid/Ast/WhenStatement.cs index 0b51b70d..4f8ffe86 100644 --- a/Fluid/Ast/WhenStatement.cs +++ b/Fluid/Ast/WhenStatement.cs @@ -6,7 +6,7 @@ namespace Fluid.Ast { - public class WhenStatement : TagStatement + public sealed class WhenStatement : TagStatement { private readonly IReadOnlyList _options; diff --git a/Fluid/FilterArguments.cs b/Fluid/FilterArguments.cs index 03560835..76d4e029 100644 --- a/Fluid/FilterArguments.cs +++ b/Fluid/FilterArguments.cs @@ -8,7 +8,7 @@ namespace Fluid /// Represents the list of arguments that are passed to a /// when invoked. /// - public class FilterArguments + public sealed class FilterArguments { public static readonly FilterArguments Empty = new FilterArguments(); diff --git a/Fluid/FiltersCollection.cs b/Fluid/FiltersCollection.cs index 299353a9..b6196970 100644 --- a/Fluid/FiltersCollection.cs +++ b/Fluid/FiltersCollection.cs @@ -3,7 +3,7 @@ namespace Fluid { - public class FilterCollection : IEnumerable> + public sealed class FilterCollection : IEnumerable> { private Dictionary _filters; diff --git a/Fluid/FunctionArguments.cs b/Fluid/FunctionArguments.cs index 184ad24c..858dd482 100644 --- a/Fluid/FunctionArguments.cs +++ b/Fluid/FunctionArguments.cs @@ -7,7 +7,7 @@ namespace Fluid /// /// Represents the list of arguments of a function. /// - public class FunctionArguments + public sealed class FunctionArguments { public static readonly FunctionArguments Empty = new FunctionArguments(); diff --git a/Fluid/MemberNameStrategies.cs b/Fluid/MemberNameStrategies.cs index 0b5be58f..1a150412 100644 --- a/Fluid/MemberNameStrategies.cs +++ b/Fluid/MemberNameStrategies.cs @@ -4,7 +4,7 @@ namespace Fluid { - public class MemberNameStrategies + public sealed class MemberNameStrategies { public static readonly MemberNameStrategy Default = RenameDefault; public static readonly MemberNameStrategy CamelCase = RenameCamelCase; diff --git a/Fluid/NullMemberAccessor.cs b/Fluid/NullMemberAccessor.cs index 4809412e..a172e2e6 100644 --- a/Fluid/NullMemberAccessor.cs +++ b/Fluid/NullMemberAccessor.cs @@ -1,6 +1,6 @@ namespace Fluid { - public class NullMemberAccessor : IMemberAccessor + public sealed class NullMemberAccessor : IMemberAccessor { public static readonly IMemberAccessor Instance = new NullMemberAccessor(); diff --git a/Fluid/ParseException.cs b/Fluid/ParseException.cs index fdf98ebb..6a589818 100644 --- a/Fluid/ParseException.cs +++ b/Fluid/ParseException.cs @@ -2,7 +2,7 @@ namespace Fluid { - public class ParseException : Exception + public sealed class ParseException : Exception { // // Summary: diff --git a/Fluid/Parser/CompositeFluidTemplate.cs b/Fluid/Parser/CompositeFluidTemplate.cs index c50fd113..0cbcbabc 100644 --- a/Fluid/Parser/CompositeFluidTemplate.cs +++ b/Fluid/Parser/CompositeFluidTemplate.cs @@ -5,7 +5,7 @@ namespace Fluid.Parser { - public class CompositeFluidTemplate : IFluidTemplate + public sealed class CompositeFluidTemplate : IFluidTemplate { private readonly List _templates; diff --git a/Fluid/Parser/FluidTemplate.cs b/Fluid/Parser/FluidTemplate.cs index 4fec9ef3..f4d97a24 100644 --- a/Fluid/Parser/FluidTemplate.cs +++ b/Fluid/Parser/FluidTemplate.cs @@ -7,7 +7,7 @@ namespace Fluid.Parser { - public class FluidTemplate : IFluidTemplate + public sealed class FluidTemplate : IFluidTemplate { private readonly List _statements; diff --git a/Fluid/Scope.cs b/Fluid/Scope.cs index 4500dd8c..0c41d10b 100644 --- a/Fluid/Scope.cs +++ b/Fluid/Scope.cs @@ -5,7 +5,7 @@ namespace Fluid { - public class Scope + public sealed class Scope { private Dictionary _properties; private readonly bool _forLoopScope; diff --git a/Fluid/UnsafeMemberAccessStrategy.cs b/Fluid/UnsafeMemberAccessStrategy.cs index 3f75743d..0d17fb8d 100644 --- a/Fluid/UnsafeMemberAccessStrategy.cs +++ b/Fluid/UnsafeMemberAccessStrategy.cs @@ -2,7 +2,7 @@ namespace Fluid { - public class UnsafeMemberAccessStrategy : DefaultMemberAccessStrategy + public sealed class UnsafeMemberAccessStrategy : DefaultMemberAccessStrategy { public static readonly UnsafeMemberAccessStrategy Instance = new UnsafeMemberAccessStrategy();