From c7c8c239746a61aab9b9d4077d2facf91ea43661 Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Sat, 1 Jun 2024 11:14:46 +0200 Subject: [PATCH] Fix disabling of parent node recording + improve signature of RecordParentNodeInUserData --- src/Acornima.Extras/ParserOptionsExtensions.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Acornima.Extras/ParserOptionsExtensions.cs b/src/Acornima.Extras/ParserOptionsExtensions.cs index b150482..eab18e8 100644 --- a/src/Acornima.Extras/ParserOptionsExtensions.cs +++ b/src/Acornima.Extras/ParserOptionsExtensions.cs @@ -12,12 +12,10 @@ public static class ParserOptionsExtensions } }; - /// - /// WARNING: Setting after enabling this setting will cancel parent node recording. - /// - public static ParserOptions RecordParentNodeInUserData(this ParserOptions options, bool enable) + public static TOptions RecordParentNodeInUserData(this TOptions options, bool enable = true) + where TOptions : ParserOptions { - Delegate.RemoveAll(options.OnNode, s_parentSetter); + options._onNode = (OnNodeHandler?)Delegate.RemoveAll(options._onNode, s_parentSetter); if (enable) {