Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be a bit more consistent about type handling in ZAP templates. #10718

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/zap-templates/common/ClusterTestGeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ function chip_tests_item_parameters(options)
value = new Boolean(value);
break;
default:
throw new Error('Unsupported value: ', value);
throw new Error('Unsupported value: ' + JSON.stringify(value));
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/app/zap-templates/common/ClustersHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ function asChipCallback(item)
return { name : 'List', type : null };
}

if (item.type == 'boolean') {
return { name : 'Boolean', type : 'bool' };
}

const basicType = ChipTypesHelper.asBasicType(item.chipType);
switch (basicType) {
case 'int8_t':
Expand All @@ -212,6 +208,8 @@ function asChipCallback(item)
case 'uint32_t':
case 'uint64_t':
return { name : 'Int' + basicType.replace(/[^0-9]/g, '') + 'u', type : basicType };
case 'bool':
return { name : 'Boolean', type : 'bool' };
default:
return { name : 'Unsupported', type : null };
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/zap-templates/common/override.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ function atomicType(arg)
switch (arg.name) {
case 'boolean':
return 'bool';
case 'single':
return 'float';
case 'int40s':
case 'int48s':
case 'int56s':
Expand Down
4 changes: 0 additions & 4 deletions src/app/zap-templates/templates/app/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,6 @@ function asMEI(prefix, suffix)
*/
async function zapTypeToClusterObjectType(type, isDecodable, options)
{
if (type == 'single') {
return 'float';
}

async function fn(pkgId)
{
const ns = options.hash.ns ? ('chip::app::Clusters::' + asUpperCamelCase(options.hash.ns) + '::') : '';
Expand Down
Loading