Skip to content

Commit

Permalink
Fix zapTypeToClusterObjectType to have correct output for acronyms.
Browse files Browse the repository at this point in the history
zapTypeToClusterObjectType needs to be consistent with the actual types we
generate for cluster objects, and it was producing different output for a struct
(or event) which had an all-caps name.
  • Loading branch information
bzbarsky-apple authored and brdandu committed Nov 28, 2023
1 parent 5c472c0 commit 67a5910
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ async function zapTypeToClusterObjectType(type, isDecodable, options) {
if (s) {
return 'uint' + s[1] + '_t';
}
return ns + type;
return ns + asUpperCamelCase.call(this, type, options);
}

if (types.isBitmap) {
Expand All @@ -685,15 +685,17 @@ async function zapTypeToClusterObjectType(type, isDecodable, options) {
if (s) {
return 'uint' + s[1] + '_t';
}
return 'chip::BitMask<' + ns + type + '>';
return (
'chip::BitMask<' + ns + asUpperCamelCase.call(this, type, options) + '>'
);
}

if (types.isStruct) {
passByReference = true;
return (
ns +
'Structs::' +
type +
asUpperCamelCase.call(this, type, options) +
'::' +
(isDecodable ? 'DecodableType' : 'Type')
);
Expand All @@ -702,7 +704,11 @@ async function zapTypeToClusterObjectType(type, isDecodable, options) {
if (types.isEvent) {
passByReference = true;
return (
ns + 'Events::' + type + '::' + (isDecodable ? 'DecodableType' : 'Type')
ns +
'Events::' +
asUpperCamelCase.call(this, type, options) +
'::' +
(isDecodable ? 'DecodableType' : 'Type')
);
}

Expand Down

0 comments on commit 67a5910

Please sign in to comment.