modify dts2cpp/src/gen/

Signed-off-by: LiYuxi <liyuxi@kaihong.com>
This commit is contained in:
LiYuxi 2024-07-11 16:01:21 +08:00
parent e316627dbb
commit bc2a203e32
4 changed files with 5 additions and 4 deletions

View File

@ -225,7 +225,7 @@ function getArrowCallFunc(tmp, results) {
let callbackFunc = null;
if (tmp[2][0] !== undefined) {
callbackFunc = tmp[2][0] // 当方法的参数是回调方法,并且回调方法写法为=>函数
callbackFunc = tmp[2][0]; // 当方法的参数是回调方法,并且回调方法写法为=>函数
}
if (results !== undefined && callbackFunc !== null) {
results.callFunction.push(callbackFunc);

View File

@ -25,7 +25,7 @@ function analyzeNoNameInterface(valueType, valueName, rsltInterface) {
let number = NumberIncrease.getAndIncrease();
let interfaceTypeName = 'AUTO_INTERFACE_%s_%s'.format(valueName, number);
let interfaceBody = valueType.substring(1, valueType.length - 1);
interfaceBody = re.replaceAll(interfaceBody, ',', ';\n')
interfaceBody = re.replaceAll(interfaceBody, ',', ';\n');
rsltInterface.push({
name: interfaceTypeName,
body: analyzeInterface(interfaceBody, rsltInterface),

View File

@ -51,7 +51,7 @@ function analyzeNamespace(data) {
while (data !== '\n') {
let oldData = data;
data = removeEmptyLine(data);
let matchs = re.match(' *\n*', data)
let matchs = re.match(' *\n*', data);
data = preProcessData(data);
// 只剩下空格和回车时,解析完成
if (matchs && matchs.regs[0][1] === data.length) {

View File

@ -139,7 +139,7 @@ function cToJs(value, type, dest, deep = 1, optional, enumType = 0) {
var propertyName = delPrefix(value);
if (checkRetIsUndefined(type)) {
NapiLog.logError('type is invalid!');
return;
return undefined;
}
if (type.indexOf('|') >= 0) {
return unionTempleteFunc(value, type, dest, optional);
@ -184,6 +184,7 @@ function cToJs(value, type, dest, deep = 1, optional, enumType = 0) {
else {
NapiLog.logError(`\n---- This type do not generate cToJs %s,%s,%s ----\n. `
.format(value, type, dest), getLogErrInfo());
return undefined;
}
}