Skip to content

Commit

Permalink
Fix disabling of parent node recording + improve signature of RecordP…
Browse files Browse the repository at this point in the history
…arentNodeInUserData
  • Loading branch information
adams85 committed Jun 1, 2024
1 parent ff8989a commit c7c8c23
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Acornima.Extras/ParserOptionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ public static class ParserOptionsExtensions
}
};

/// <remarks>
/// WARNING: Setting <see cref="ParserOptions.OnNode"/> after enabling this setting will cancel parent node recording.
/// </remarks>
public static ParserOptions RecordParentNodeInUserData(this ParserOptions options, bool enable)
public static TOptions RecordParentNodeInUserData<TOptions>(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)
{
Expand Down

0 comments on commit c7c8c23

Please sign in to comment.