Skip to content

Commit

Permalink
Merge pull request #25 from p-x9/feature/package-access-modifier
Browse files Browse the repository at this point in the history
Support `package` access modifier
  • Loading branch information
p-x9 committed Feb 1, 2024
2 parents 2100a37 + ec84b37 commit 777bb79
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions Sources/AliasSupport/AccessControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public enum AccessControl: String {
case `internal`
case `public`
case `open`
case `package`
}
9 changes: 7 additions & 2 deletions Sources/AliasSupport/Extesnsion/AccessControlSyntax.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package enum AccessControlModifier: String, CaseIterable {
case `internal`
case `public`
case `open`
case `package`

package var keyword: Keyword {
switch self {
Expand All @@ -27,6 +28,8 @@ package enum AccessControlModifier: String, CaseIterable {
return .public
case .open:
return .open
case .package:
return .package
}
}

Expand All @@ -38,10 +41,12 @@ package enum AccessControlModifier: String, CaseIterable {
return 1
case .internal:
return 2
case .public:
case .package:
return 3
case .open:
case .public:
return 4
case .open:
return 5
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/AliasTests/AliasTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ final class AliasTests: XCTestCase {

assertMacroExpansion(
"""
@Alias("NewItem", access: .inherit)
@Alias("NewItem", access: .package)
public struct Item {}
""",
expandedSource:
"""
public struct Item {}
public typealias NewItem = Item
package typealias NewItem = Item
""",
macros: macros
)
Expand Down

0 comments on commit 777bb79

Please sign in to comment.