Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

This pull request addresses issue #28 by implementing proper handling of the Itself constant in the Each method of LinksItselfConstantToSelfReferenceResolver.

Previously, the resolver would skip execution when encountering the Itself constant in restrictions. This implementation now properly processes such restrictions by:

  1. Filtering for self-referential patterns: When Itself is encountered, the resolver creates a filtering handler that checks each link against the pattern specified in the restriction
  2. Pattern matching logic: The MatchesItselfPattern method evaluates whether a link matches a restriction where Itself resolves to the link's own index
  3. Backward compatibility: All existing functionality remains unchanged - only the behavior when Itself constant is present has been improved

Key Changes

  • Modified Each method: Now calls HandleEachWithItselfConstant instead of returning constants.Continue when Itself is present
  • Added HandleEachWithItselfConstant method: Creates a filtering wrapper around the provided handler to match self-referential patterns
  • Added MatchesItselfPattern method: Validates links against restriction patterns containing Itself constants
  • Null safety improvement: Added null check for restriction parameter

Test plan

  • All existing tests continue to pass (20/21 tests passing, 1 skipped as expected)
  • No breaking changes to existing functionality
  • The resolver now processes Itself constants instead of skipping them

The implementation maintains the same interface and behavior for all existing use cases while extending functionality to handle the previously unsupported Itself constant in Each operations.

🤖 Generated with Claude Code


Resolves #28

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #28
@konard konard self-assigned this Sep 14, 2025
…nceResolver.Each method

- Modified Each method to handle 'Itself' constant instead of skipping execution
- Added HandleEachWithItselfConstant method to filter links matching self-referential patterns
- Added MatchesItselfPattern method to validate links against restriction patterns containing 'Itself'
- Resolves issue #28 by providing a version of resolver that can handle Itself constant

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Add version of resolver that can handle Itself constant Implement Itself constant handling in LinksItselfConstantToSelfReferenceResolver.Each method Sep 14, 2025
@konard konard marked this pull request as ready for review September 14, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add version of resolver that can handle Itself constant

2 participants