已合并
!2744 Serialize union arrays for TS #57
pavelmironchik创建于 2025年10月27日
!2744 Serialize union arrays for TS #57
已合并
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 pavelmironchik 的贡献)openharmony_ci
2025年10月27日 评论:
2025年10月27日 评论:
感谢提交 Pull Requests!
Thanks for submitting a pull request.


2025年10月27日 添加了label:dco检查成功
core/src/LanguageWriters/writers/TsLanguageWriter.ts
@@ -406,1 +406,4 @@
406406 }
407+ override instanceOf(value: string, type: idl.IDLType): LanguageExpression {
408+ return idl.IDLContainerUtils.isSequence(type)
409+ ? this.makeString(`Array.isArray(${value})`)
Very useful and required for TS/ArkTS, because Arrays actually not very common object and it's better to handle them with builtin way


2025年10月27日 解决了最后一个问题
core/src/LanguageWriters/writers/ETSLanguageWriter.ts
@@ -324,2 +324,4 @@
324324 return new TSCastExpression(value, `${this.getNodeName(node)}`, options?.unsafe ?? false)
325325 }
326+ override instanceOf(value: string, type: idl.IDLType): LanguageExpression {
327+ return this.makeString(`${value} instanceof ${withInsideInstanceof(true, () => this.getNodeName(type))}`)
withInsideInstanceof is global function. It is use another global variable "under the hood". This is bad. We should consider make it local somehow.


core/src/LanguageWriters/ArgConvertors.ts
@@ -1044,1 +1042,3 @@
1044- return true
1042+ // Indexed discriminator is only used in CPP
1043+ // All other languages check the first array element type for arrays discrimination
1044+ if (writer.language == Language.CPP) return true
改动建议
| 1044
| - if (writer.language == Language.CPP) return true |
|
1044 | + if (writer.language === Language.CPP) return true |
Using == is bad practice in JS/TS.


ohosgen/tests/unit/idl/test_union.idl
@@ -14,1 +22,3 @@
14-UnionSampleInterface checkUnionSample(UnionSampleInterface value);
22+[Entity=Interface]
23+interface UnionSampleNumberArrayInterface {
24+
This empty line does not divide or highligt something in this interface. So, I think it can be removed.


ohosgen/tests/unit/idl/test_union.idl
@@ -12,3 +20,3 @@
1220};
1321
14-UnionSampleInterface checkUnionSample(UnionSampleInterface value);
22+[Entity=Interface]
By default any interface entry in IDL is interface. We should discuss rules of using this extended attribute and maybe it can be ommitted in cases, where Entity=Interface


2025年10月30日 通过审查
2025年10月30日 审查状态已重置,审查人: guozejun
2025年10月30日 取消了草稿状态
2025年10月30日 修改标题为 “!2744 Serialize union arrays for TS”,原标题为“[WIP] !2744 Serialize union arrays for TS”
2025年10月30日 修改标题为 “!2744 Serialize union arrays for TS”,原标题为“[WIP] !2744 Serialize union arrays for TS”
pavelmironchik
2025年10月30日 评论:
2025年10月30日 评论:
FORCE_VERIFY


2025年10月30日 通过测试
openharmony_ci
2025年10月30日 评论:
2025年10月30日 评论:
添加 测试通过 成功!


openharmony_ci
2025年10月30日 评论:
2025年10月30日 评论:
2025年10月30日 通过审查
pavelmironchik
2025年10月30日 评论:
2025年10月30日 评论:
FORCE_VERIFY


2025年10月30日 通过测试
openharmony_ci
2025年10月30日 评论:
2025年10月30日 评论:
添加 测试通过 成功!


2025年10月30日 合入了pull request,合并节点 SHA:f136e25c5f5fa433b3e0e252328550b1f627ac54
一、内容说明(相关的Issue)
二、建议测试周期和提测地址
建议测试完成时间:xxxx.xx.xx
投产上线时间:xxxx.xx.xx
提测地址:CI环境/压测环境
测试账号:
三、变更内容
3.1 关联PR列表
3.2 数据库和部署说明
bundle exec xxx RAILS_ENV = production;没有写 "无"3.4 其他技术优化内容(做了什么,变更了什么)
3.5 废弃通知(什么字段、方法弃用?)
3.6 后向不兼容变更(是否有无法向后兼容的变更?)
四、研发自测点(自测哪些?冒烟用例全部自测?)
自测测试结论:
五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)
检查点:
接口测试:
性能测试:
并发测试:
其他: