Skip to content

Commit

Permalink
CPPSDK: getMethodSignatureResult updates based on latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HaseenaSainul committed Oct 10, 2023
1 parent 399d97e commit b3cb7e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
1 change: 1 addition & 0 deletions languages/cpp/templates/result/default.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const ${method.result.type}
19 changes: 2 additions & 17 deletions src/macrofier/types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,8 @@ function getMethodSignatureParams(method, module, { destination, callback }) {
}).join(', ')
}

function getMethodSignatureResult(method, module, { destination, callback }) {
let type = getSchemaType(method.result.schema, module, { destination, namespace : true })

let result = ''
let jsonType = getJsonType(method.result.schema, module, { destination })

if (!isVoid(type) && !isPrimitiveType(jsonType) && getTemplate('/result/nonprimitive')) {
result = getTemplate('/result/nonprimitive')
}
else if ((jsonType === 'string') && getTemplate('/result/string')) {
result = getTemplate('/result/string')
}
else {
result = getTemplate('/result/default')
}

return result.replace(/\$\{method\.result\.type\}/g, type)
function getMethodSignatureResult(method, module, { destination, callback, overrideRule = false }) {
return getTemplate('/result/default').replace(/\$\{method\.result\.type\}/g, getSchemaType(method.result.schema, module, { destination, namespace : true, overrideRule }))
}

const getTemplate = (name) => {
Expand Down

0 comments on commit b3cb7e6

Please sign in to comment.