Skip to content

Commit 38d8489

Browse files
committed
feat(objc): add support for optional class properties in protocols
1 parent 770ae87 commit 38d8489

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

objc.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,17 @@ func (f *File) getObjcProtocol(vmaddr uint64) (proto *objc.Protocol, err error)
10811081
}
10821082
}
10831083

1084+
// Optional class properties (newer ABI)
1085+
if protoPtr.HasClassProperties() {
1086+
if protoPtr.ClassPropertiesVMAddr > 0 {
1087+
protoPtr.ClassPropertiesVMAddr = f.vma.Convert(protoPtr.ClassPropertiesVMAddr)
1088+
proto.ClassProperties, err = f.getObjCPropertiesWithSwift(protoPtr.ClassPropertiesVMAddr, false)
1089+
if err != nil {
1090+
return nil, fmt.Errorf("failed to read class property vmaddr: %v", err)
1091+
}
1092+
}
1093+
}
1094+
10841095
proto.ProtocolT = protoPtr
10851096

10861097
return proto, nil

types/objc/protocol.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type Protocol struct {
4545
Prots []Protocol
4646
InstanceMethods []Method
4747
InstanceProperties []Property
48+
ClassProperties []Property
4849
ClassMethods []Method
4950
OptionalInstanceMethods []Method
5051
OptionalClassMethods []Method

0 commit comments

Comments
 (0)