Skip to content

Commit

Permalink
code: protoc regen
Browse files Browse the repository at this point in the history
  • Loading branch information
Benzi authored and Benzi committed Dec 10, 2022
1 parent 2e8e7df commit 6113672
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions menu/Sources/menu/AX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ func getMenuItems(
var modifiers = 0
var virtualKey = 0
if let m = getAttribute(element: child, name: kAXMenuItemCmdModifiersAttribute) {
CFNumberGetValue(m as! CFNumber, CFNumberType.longType, &modifiers)
CFNumberGetValue((m as! CFNumber), CFNumberType.longType, &modifiers)
}
if let v = getAttribute(element: child, name: kAXMenuItemCmdVirtualKeyAttribute) {
CFNumberGetValue(v as! CFNumber, CFNumberType.longType, &virtualKey)
CFNumberGetValue((v as! CFNumber), CFNumberType.longType, &virtualKey)
}

var menuItem = MenuItem()
Expand Down
20 changes: 18 additions & 2 deletions menu/Sources/menu/MenuItem.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ struct MenuPath {
init() {}
}

#if swift(>=5.5) && canImport(_Concurrency)
extension MenuItemCache: @unchecked Sendable {}
extension MenuItemList: @unchecked Sendable {}
extension MenuItem: @unchecked Sendable {}
extension AlfredResultList: @unchecked Sendable {}
extension AlfredResultItem: @unchecked Sendable {}
extension AlfredResultItemIcon: @unchecked Sendable {}
extension Settings: @unchecked Sendable {}
extension AppFilter: @unchecked Sendable {}
extension MenuPath: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)

// MARK: - Code below here is support for the SwiftProtobuf runtime.

extension MenuItemCache: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
Expand Down Expand Up @@ -348,6 +360,10 @@ extension AlfredResultItem: SwiftProtobuf.Message, SwiftProtobuf._MessageImpleme
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
if !self.title.isEmpty {
try visitor.visitSingularStringField(value: self.title, fieldNumber: 1)
}
Expand All @@ -366,9 +382,9 @@ extension AlfredResultItem: SwiftProtobuf.Message, SwiftProtobuf._MessageImpleme
if self.valid != false {
try visitor.visitSingularBoolField(value: self.valid, fieldNumber: 6)
}
if let v = self._icon {
try { if let v = self._icon {
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
}
} }()
try unknownFields.traverse(visitor: &visitor)
}

Expand Down

0 comments on commit 6113672

Please sign in to comment.