mirror of
https://gitee.com/openharmony/napi_generator
synced 2025-02-18 16:20:59 +00:00
modify dts2cpp/src/gen/
Signed-off-by: LiYuxi <liyuxi@kaihong.com>
This commit is contained in:
parent
e316627dbb
commit
bc2a203e32
@ -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);
|
||||
|
@ -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),
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user