Skip to content

Add Accessor control#21

Merged
FlickerSoul merged 9 commits intomainfrom
feat/extension-acl
Nov 27, 2025
Merged

Add Accessor control#21
FlickerSoul merged 9 commits intomainfrom
feat/extension-acl

Conversation

@FlickerSoul
Copy link
Owner

This pull request introduces a new way to control access levels for generated parsing and printing extensions in the @ParseStruct and @ParseEnum macros, allowing users to specify custom access modifiers.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces access control for generated parsing and printing extensions in the @ParseStruct and @ParseEnum macros. Users can now specify custom access modifiers (public, package, internal, fileprivate, private, or follow) via parsingAccessor and printingAccessor parameters, with .follow as the default to match the declaration's access level.

Key changes:

  • Added ExtensionAccessor enum in BinaryParseKitCommons to represent access levels
  • Implemented extractAccessor function and MacroAccessorVisitor for parsing and validating accessor arguments
  • Updated @ParseStruct and @ParseEnum macro signatures to accept accessor parameters
  • Added comprehensive test coverage for accessor functionality including validation of invalid accessors

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Sources/BinaryParseKitCommons/ExtensionAccessor.swift New enum defining access levels with string literal initialization support
Sources/BinaryParseKitMacros/Macros/Extensions/ExtensionAccessor+.swift Extension converting ExtensionAccessor to SwiftSyntax TokenKind
Sources/BinaryParseKitMacros/Macros/Supports/MacroAccessorVisitor.swift New visitor implementation for extracting and validating accessor arguments from macro attributes
Sources/BinaryParseKitMacros/Macros/ParseStruct/ConstructParseStructMacro.swift Updated to use accessor info instead of declaration modifiers
Sources/BinaryParseKitMacros/Macros/ParseEnum/ConsructParseEnumMacro.swift Updated to use accessor info instead of declaration modifiers
Sources/BinaryParseKit/BinaryParseKit.swift Added parsingAccessor and printingAccessor parameters to macro definitions
Tests/BinaryParseKitMacroTests/BinaryParseKitStructTests.swift Added tests for struct accessor functionality including error cases
Tests/BinaryParseKitMacroTests/BinaryParseKitEnumTests.swift Added tests for enum accessor functionality including error cases
Tests/BinaryParseKitMacroTests/Misc.swift Removed unused imports
Tests/BinaryParseKitMacroTests/TestFailureLocation+.swift Removed unused file
Tests/BinaryParseKitMacroTests/NoteSpec+.swift Removed unused file
Tests/BinaryParseKitMacroTests/DiagnosticSpec+.swift Removed unused file
Tests/BinaryParseKitTests/TestBinaryFloatingPoint.swift Removed unused BinaryParseKitCommons import
Package.swift Updated swift-collections dependency specification and added BinaryParseKitCommons to macro tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@FlickerSoul FlickerSoul merged commit 24ea1d5 into main Nov 27, 2025
2 checks passed
@FlickerSoul FlickerSoul deleted the feat/extension-acl branch November 27, 2025 11:59
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.

2 participants