Conversation
There was a problem hiding this comment.
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
ExtensionAccessorenum in BinaryParseKitCommons to represent access levels - Implemented
extractAccessorfunction andMacroAccessorVisitorfor parsing and validating accessor arguments - Updated
@ParseStructand@ParseEnummacro 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.
993b61a to
143f045
Compare
There was a problem hiding this comment.
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.
Sources/BinaryParseKitMacros/Macros/Supports/MacroAccessorVisitor.swift
Outdated
Show resolved
Hide resolved
d018c22 to
e11cf20
Compare
This pull request introduces a new way to control access levels for generated parsing and printing extensions in the
@ParseStructand@ParseEnummacros, allowing users to specify custom access modifiers.