Skip to content
Merged
Changes from 1 commit
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
25 changes: 12 additions & 13 deletions src/embind/embind_gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,9 @@ var LibraryEmbind = {
}
argStart = 2;
}
#if ASSERTIONS
if (argsName.length)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add curly braces around the if body ?

assert(argsName.length == (argTypes.length - hasThis - 1), 'Argument names should match number of parameters.');
#endif
if (argsName.length && argsName.length != (argTypes.length - hasThis - 1))
throw new Error('Argument names should match number of parameters.');

const args = [];
for (let i = argStart, x = 0; i < argTypes.length; i++) {
if (x < argsName.length) {
Expand Down Expand Up @@ -621,9 +620,9 @@ var LibraryEmbind = {
setterContext) {
fieldName = readLatin1String(fieldName);
const readonly = setter === 0;
#if ASSERTIONS
assert(readonly || getterReturnType === setterArgumentType, 'Mismatched getter and setter types are not supported.');
#endif
if (!(readonly || getterReturnType === setterArgumentType))
throw new error('Mismatched getter and setter types are not supported.');

whenDependentTypesAreResolved([], [classType], function(classType) {
classType = classType[0];
whenDependentTypesAreResolved([], [getterReturnType], function(types) {
Expand Down Expand Up @@ -724,9 +723,9 @@ var LibraryEmbind = {
setterContext
) {
const valueArray = tupleRegistrations[rawTupleType];
#if ASSERTIONS
assert(getterReturnType === setterArgumentType, 'Mismatched getter and setter types are not supported.');
#endif
if (getterReturnType !== setterArgumentType)
throw new Error('Mismatched getter and setter types are not supported.');

valueArray.elementTypeIds.push(getterReturnType);
},
_embind_finalize_value_array__deps: ['$whenDependentTypesAreResolved', '$moduleDefinitions', '$tupleRegistrations'],
Expand Down Expand Up @@ -767,9 +766,9 @@ var LibraryEmbind = {
setterContext
) {
const valueObject = structRegistrations[structType];
#if ASSERTIONS
assert(getterReturnType === setterArgumentType, 'Mismatched getter and setter types are not supported.');
#endif
if (getterReturnType !== setterArgumentType)
throw new Error('Mismatched getter and setter types are not supported.');

valueObject.fieldTypeIds.push(getterReturnType);
valueObject.fieldNames.push(readLatin1String(fieldName));
},
Expand Down
Loading