@@ -56,6 +56,7 @@ type Protocol struct {
5656
5757func (p * Protocol ) dump (verbose , addrs bool ) string {
5858 var props string
59+ var cProps string
5960 var optProps string
6061 var cMethods string
6162 var iMethods string
@@ -86,6 +87,34 @@ func (p *Protocol) dump(verbose, addrs bool) string {
8687 props += "\n "
8788 }
8889 }
90+ if len (p .ClassProperties ) > 0 {
91+ for _ , prop := range p .ClassProperties {
92+ if verbose {
93+ if attrs , optional := prop .Attributes (); ! optional {
94+ // Ensure "class" appears in the attribute list and retain trailing space
95+ if attrs == "" {
96+ attrs = "(class) "
97+ } else {
98+ inner := strings .TrimSuffix (strings .TrimPrefix (attrs , "(" ), ") " )
99+ if inner == attrs { // fallback if format differs
100+ inner = strings .TrimSpace (strings .TrimSuffix (strings .TrimPrefix (attrs , "(" ), ")" ))
101+ }
102+ attrs = fmt .Sprintf ("(class, %s) " , inner )
103+ }
104+ cProps += fmt .Sprintf ("@property %s%s%s;\n " , attrs , prop .Type (), prop .Name )
105+ }
106+ } else {
107+ if prop .EncodedAttributes != "" {
108+ cProps += fmt .Sprintf ("@property (class, %s) %s;\n " , prop .EncodedAttributes , prop .Name )
109+ } else {
110+ cProps += fmt .Sprintf ("@property (class) %s;\n " , prop .Name )
111+ }
112+ }
113+ }
114+ if cProps != "" {
115+ cProps += "\n "
116+ }
117+ }
89118 if len (p .ClassMethods ) > 0 {
90119 for _ , meth := range p .ClassMethods {
91120 if verbose {
@@ -134,6 +163,29 @@ func (p *Protocol) dump(verbose, addrs bool) string {
134163 optProps += "\n "
135164 }
136165 }
166+ if len (p .ClassProperties ) > 0 {
167+ for _ , prop := range p .ClassProperties {
168+ if verbose {
169+ if attrs , optional := prop .Attributes (); optional {
170+ if attrs == "" {
171+ attrs = "(class) "
172+ } else {
173+ inner := strings .TrimSuffix (strings .TrimPrefix (attrs , "(" ), ") " )
174+ if inner == attrs {
175+ inner = strings .TrimSpace (strings .TrimSuffix (strings .TrimPrefix (attrs , "(" ), ")" ))
176+ }
177+ attrs = fmt .Sprintf ("(class, %s) " , inner )
178+ }
179+ optProps += fmt .Sprintf ("@property %s%s%s;\n " , attrs , prop .Type (), prop .Name )
180+ }
181+ } else {
182+ // optProps += fmt.Sprintf("@property (%s) %s;\n", prop.EncodedAttributes, prop.Name)
183+ }
184+ }
185+ if optProps != "" {
186+ // leave trailing newline managed above
187+ }
188+ }
137189 if len (p .OptionalInstanceMethods ) > 0 {
138190 for _ , meth := range p .OptionalInstanceMethods {
139191 if verbose {
@@ -154,7 +206,8 @@ func (p *Protocol) dump(verbose, addrs bool) string {
154206 return fmt .Sprintf (
155207 "%s\n \n " +
156208 "@required\n \n " +
157- "%s" +
209+ "%s" + // instance properties (required)
210+ "%s" + // class properties (required)
158211 "%s" +
159212 "%s" +
160213 "@optional\n \n " +
@@ -163,6 +216,7 @@ func (p *Protocol) dump(verbose, addrs bool) string {
163216 "@end\n " ,
164217 protocol ,
165218 props ,
219+ cProps ,
166220 cMethods ,
167221 iMethods ,
168222 optProps ,
0 commit comments