Skip to content

Commit

Permalink
Support new access modifier package
Browse files Browse the repository at this point in the history
- Modify DependencyEndpoint macro to support new access modifier package
- Add unit test to capture this change
  • Loading branch information
nhenri committed Feb 1, 2024
1 parent 00ace43 commit c1632b4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ extension DeclModifierListSyntax {
switch $0.name.tokenKind {
case .keyword(let keyword):
switch keyword {
case .fileprivate, .private, .internal, .public:
case .fileprivate, .private, .internal, .package, .public:
return false
default:
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,4 +998,36 @@ final class DependencyEndpointMacroTests: BaseTestCase {
"""
}
}

func testAccessPackage() {
assertMacro {
"""
package struct Client {
@DependencyEndpoint
package var endpoint: () -> Void
}
"""
} expansion: {
"""
package struct Client {
package var endpoint: () -> Void {
@storageRestrictions(initializes: _endpoint)
init(initialValue) {
_endpoint = initialValue
}
get {
_endpoint
}
set {
_endpoint = newValue
}
}
private var _endpoint: () -> Void = {
XCTestDynamicOverlay.XCTFail("Unimplemented: 'endpoint'")
}
}
"""
}
}
}

0 comments on commit c1632b4

Please sign in to comment.