arkanalyzer 1.0.93 → 2.0.0-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/lib/Config.d.ts +7 -0
  2. package/lib/Config.d.ts.map +1 -1
  3. package/lib/Scene.d.ts +134 -170
  4. package/lib/Scene.d.ts.map +1 -1
  5. package/lib/Scene.js +412 -976
  6. package/lib/callgraph/algorithm/AbstractAnalysis.js +3 -2
  7. package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
  8. package/lib/callgraph/algorithm/RapidTypeAnalysis.js +2 -3
  9. package/lib/callgraph/model/CallGraph.js +1 -1
  10. package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts +1 -3
  11. package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts.map +1 -1
  12. package/lib/callgraph/pointerAnalysis/PTAUtils.js +17 -7
  13. package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
  14. package/lib/callgraph/pointerAnalysis/Pag.js +4 -14
  15. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
  16. package/lib/callgraph/pointerAnalysis/PagBuilder.js +2 -1
  17. package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
  18. package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +1 -2
  19. package/lib/callgraph/pointerAnalysis/plugins/WorkerPlugin.d.ts.map +1 -1
  20. package/lib/callgraph/pointerAnalysis/plugins/WorkerPlugin.js +0 -1
  21. package/lib/cli/commands/cg.d.ts +1 -0
  22. package/lib/cli/commands/cg.d.ts.map +1 -1
  23. package/lib/cli/commands/cg.js +22 -18
  24. package/lib/cli/commands/ir.d.ts +1 -0
  25. package/lib/cli/commands/ir.d.ts.map +1 -1
  26. package/lib/cli/commands/ir.js +5 -2
  27. package/lib/core/base/Constant.d.ts +5 -5
  28. package/lib/core/base/Constant.d.ts.map +1 -1
  29. package/lib/core/base/Constant.js +12 -9
  30. package/lib/core/base/Expr.d.ts +36 -20
  31. package/lib/core/base/Expr.d.ts.map +1 -1
  32. package/lib/core/base/Expr.js +206 -94
  33. package/lib/core/base/Local.d.ts +10 -20
  34. package/lib/core/base/Local.d.ts.map +1 -1
  35. package/lib/core/base/Local.js +25 -28
  36. package/lib/core/base/Position.d.ts +6 -0
  37. package/lib/core/base/Position.d.ts.map +1 -1
  38. package/lib/core/base/Position.js +37 -11
  39. package/lib/core/base/Ref.d.ts +45 -33
  40. package/lib/core/base/Ref.d.ts.map +1 -1
  41. package/lib/core/base/Ref.js +225 -51
  42. package/lib/core/base/Stmt.d.ts +19 -9
  43. package/lib/core/base/Stmt.d.ts.map +1 -1
  44. package/lib/core/base/Stmt.js +135 -52
  45. package/lib/core/base/Type.d.ts +67 -4
  46. package/lib/core/base/Type.d.ts.map +1 -1
  47. package/lib/core/base/Type.js +391 -20
  48. package/lib/core/base/TypeExpr.d.ts +6 -4
  49. package/lib/core/base/TypeExpr.d.ts.map +1 -1
  50. package/lib/core/base/TypeExpr.js +34 -10
  51. package/lib/core/base/Value.d.ts +20 -2
  52. package/lib/core/base/Value.d.ts.map +1 -1
  53. package/lib/core/base/Value.js +12 -0
  54. package/lib/core/common/ArkIRTransformer.d.ts +18 -0
  55. package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
  56. package/lib/core/common/ArkIRTransformer.js +94 -75
  57. package/lib/core/common/ArkValueTransformer.d.ts +21 -3
  58. package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
  59. package/lib/core/common/ArkValueTransformer.js +458 -266
  60. package/lib/core/common/Builtin.d.ts +48 -24
  61. package/lib/core/common/Builtin.d.ts.map +1 -1
  62. package/lib/core/common/Builtin.js +90 -52
  63. package/lib/core/common/CanonicalizerValidator.d.ts +308 -0
  64. package/lib/core/common/CanonicalizerValidator.d.ts.map +1 -0
  65. package/lib/core/common/CanonicalizerValidator.js +888 -0
  66. package/lib/core/common/Const.d.ts +3 -3
  67. package/lib/core/common/Const.d.ts.map +1 -1
  68. package/lib/core/common/Const.js +3 -3
  69. package/lib/core/common/DummyMainCreater.d.ts +2 -21
  70. package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
  71. package/lib/core/common/DummyMainCreater.js +8 -105
  72. package/lib/core/common/IRInference.d.ts +55 -3
  73. package/lib/core/common/IRInference.d.ts.map +1 -1
  74. package/lib/core/common/IRInference.js +407 -126
  75. package/lib/core/common/IRUtils.d.ts +1 -0
  76. package/lib/core/common/IRUtils.d.ts.map +1 -1
  77. package/lib/core/common/IRUtils.js +44 -13
  78. package/lib/core/common/ModelUtils.d.ts +44 -20
  79. package/lib/core/common/ModelUtils.d.ts.map +1 -1
  80. package/lib/core/common/ModelUtils.js +378 -208
  81. package/lib/core/common/SdkUtils.d.ts +35 -5
  82. package/lib/core/common/SdkUtils.d.ts.map +1 -1
  83. package/lib/core/common/SdkUtils.js +203 -59
  84. package/lib/core/common/SignatureCanonicalizer.d.ts +95 -0
  85. package/lib/core/common/SignatureCanonicalizer.d.ts.map +1 -0
  86. package/lib/core/common/SignatureCanonicalizer.js +116 -0
  87. package/lib/core/common/SignatureCanonicalizerRegistry.d.ts +176 -0
  88. package/lib/core/common/SignatureCanonicalizerRegistry.d.ts.map +1 -0
  89. package/lib/core/common/SignatureCanonicalizerRegistry.js +343 -0
  90. package/lib/core/common/SignatureModelCanonicalizer.d.ts +69 -0
  91. package/lib/core/common/SignatureModelCanonicalizer.d.ts.map +1 -0
  92. package/lib/core/common/SignatureModelCanonicalizer.js +109 -0
  93. package/lib/core/common/StmtUseReplacer.d.ts +1 -0
  94. package/lib/core/common/StmtUseReplacer.d.ts.map +1 -1
  95. package/lib/core/common/StmtUseReplacer.js +9 -0
  96. package/lib/core/common/StringUtils.d.ts +12 -1
  97. package/lib/core/common/StringUtils.d.ts.map +1 -1
  98. package/lib/core/common/StringUtils.js +36 -17
  99. package/lib/core/common/TempSignatureCanonicalizer.d.ts +82 -0
  100. package/lib/core/common/TempSignatureCanonicalizer.d.ts.map +1 -0
  101. package/lib/core/common/TempSignatureCanonicalizer.js +177 -0
  102. package/lib/core/common/TypeInference.d.ts +24 -6
  103. package/lib/core/common/TypeInference.d.ts.map +1 -1
  104. package/lib/core/common/TypeInference.js +243 -117
  105. package/lib/core/common/ValueUtil.d.ts +2 -1
  106. package/lib/core/common/ValueUtil.d.ts.map +1 -1
  107. package/lib/core/common/ValueUtil.js +4 -1
  108. package/lib/core/graph/Cfg.d.ts.map +1 -1
  109. package/lib/core/graph/Cfg.js +21 -6
  110. package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
  111. package/lib/core/graph/builder/CfgBuilder.js +46 -33
  112. package/lib/core/graph/builder/IfBuilder.d.ts.map +1 -1
  113. package/lib/core/graph/builder/IfBuilder.js +6 -2
  114. package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
  115. package/lib/core/graph/builder/ViewTreeBuilder.js +6 -2
  116. package/lib/core/inference/ModelInference.d.ts +24 -4
  117. package/lib/core/inference/ModelInference.d.ts.map +1 -1
  118. package/lib/core/inference/ModelInference.js +273 -79
  119. package/lib/core/inference/ValueInference.d.ts +3 -2
  120. package/lib/core/inference/ValueInference.d.ts.map +1 -1
  121. package/lib/core/inference/ValueInference.js +90 -40
  122. package/lib/core/inference/abc/AbcInference.d.ts.map +1 -1
  123. package/lib/core/inference/abc/AbcInference.js +28 -15
  124. package/lib/core/inference/arkts/ArkTsInference.d.ts +9 -3
  125. package/lib/core/inference/arkts/ArkTsInference.d.ts.map +1 -1
  126. package/lib/core/inference/arkts/ArkTsInference.js +54 -16
  127. package/lib/core/model/ArkClass.d.ts +192 -18
  128. package/lib/core/model/ArkClass.d.ts.map +1 -1
  129. package/lib/core/model/ArkClass.js +852 -122
  130. package/lib/core/model/ArkExport.d.ts.map +1 -1
  131. package/lib/core/model/ArkExport.js +1 -2
  132. package/lib/core/model/ArkField.d.ts +34 -2
  133. package/lib/core/model/ArkField.d.ts.map +1 -1
  134. package/lib/core/model/ArkField.js +89 -14
  135. package/lib/core/model/ArkFile.d.ts +72 -12
  136. package/lib/core/model/ArkFile.d.ts.map +1 -1
  137. package/lib/core/model/ArkFile.js +275 -65
  138. package/lib/core/model/ArkImport.d.ts.map +1 -1
  139. package/lib/core/model/ArkImport.js +1 -2
  140. package/lib/core/model/ArkMethod.d.ts +101 -15
  141. package/lib/core/model/ArkMethod.d.ts.map +1 -1
  142. package/lib/core/model/ArkMethod.js +252 -39
  143. package/lib/core/model/ArkModule.d.ts +1 -1
  144. package/lib/core/model/ArkModule.js +1 -1
  145. package/lib/core/model/ArkNamespace.d.ts +80 -10
  146. package/lib/core/model/ArkNamespace.d.ts.map +1 -1
  147. package/lib/core/model/ArkNamespace.js +309 -76
  148. package/lib/core/model/ArkSignature.d.ts +242 -18
  149. package/lib/core/model/ArkSignature.d.ts.map +1 -1
  150. package/lib/core/model/ArkSignature.js +725 -95
  151. package/lib/core/model/builder/ArkClassBuilder.d.ts +6 -3
  152. package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
  153. package/lib/core/model/builder/ArkClassBuilder.js +119 -73
  154. package/lib/core/model/builder/ArkExportBuilder.d.ts +1 -1
  155. package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -1
  156. package/lib/core/model/builder/ArkExportBuilder.js +1 -1
  157. package/lib/core/model/builder/ArkFieldBuilder.d.ts +0 -2
  158. package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -1
  159. package/lib/core/model/builder/ArkFieldBuilder.js +9 -43
  160. package/lib/core/model/builder/ArkFileBuilder.d.ts.map +1 -1
  161. package/lib/core/model/builder/ArkFileBuilder.js +32 -33
  162. package/lib/core/model/builder/ArkMethodBuilder.d.ts +10 -3
  163. package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  164. package/lib/core/model/builder/ArkMethodBuilder.js +40 -26
  165. package/lib/core/model/builder/ArkNamespaceBuilder.d.ts +3 -2
  166. package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
  167. package/lib/core/model/builder/ArkNamespaceBuilder.js +45 -77
  168. package/lib/core/model/builder/ArkSignatureBuilder.d.ts +9 -0
  169. package/lib/core/model/builder/ArkSignatureBuilder.d.ts.map +1 -1
  170. package/lib/core/model/builder/ArkSignatureBuilder.js +26 -3
  171. package/lib/core/model/builder/BodyBuilder.d.ts +1 -0
  172. package/lib/core/model/builder/BodyBuilder.d.ts.map +1 -1
  173. package/lib/core/model/builder/BodyBuilder.js +37 -11
  174. package/lib/core/model/builder/builderUtils.d.ts +11 -1
  175. package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
  176. package/lib/core/model/builder/builderUtils.js +124 -90
  177. package/lib/frontend/FrontendBuilder.d.ts +10 -6
  178. package/lib/frontend/FrontendBuilder.d.ts.map +1 -1
  179. package/lib/frontend/FrontendBuilder.js +19 -45
  180. package/lib/frontend/ModuleScene.d.ts +43 -0
  181. package/lib/frontend/ModuleScene.d.ts.map +1 -0
  182. package/lib/frontend/ModuleScene.js +143 -0
  183. package/lib/frontend/SceneBuildStage.d.ts +15 -0
  184. package/lib/frontend/SceneBuildStage.d.ts.map +1 -0
  185. package/lib/frontend/SceneBuildStage.js +32 -0
  186. package/lib/frontend/SceneBuilder.d.ts +153 -0
  187. package/lib/frontend/SceneBuilder.d.ts.map +1 -0
  188. package/lib/frontend/SceneBuilder.js +859 -0
  189. package/lib/frontend/arktsFrontend/ArktsFrontend.d.ts +0 -2
  190. package/lib/frontend/arktsFrontend/ArktsFrontend.d.ts.map +1 -1
  191. package/lib/frontend/arktsFrontend/ArktsFrontend.js +0 -18
  192. package/lib/frontend/arktsFrontend/FileBodyRemount.d.ts +17 -0
  193. package/lib/frontend/arktsFrontend/FileBodyRemount.d.ts.map +1 -0
  194. package/lib/frontend/arktsFrontend/FileBodyRemount.js +187 -0
  195. package/lib/frontend/common/ModuleBuilder.d.ts +4 -2
  196. package/lib/frontend/common/ModuleBuilder.d.ts.map +1 -1
  197. package/lib/frontend/common/ModuleBuilder.js +19 -9
  198. package/lib/frontend/cppFrontend/CppFrontend.d.ts +0 -6
  199. package/lib/frontend/cppFrontend/CppFrontend.d.ts.map +1 -1
  200. package/lib/frontend/cppFrontend/CppFrontend.js +0 -56
  201. package/lib/frontend/cppFrontend/base/Type.d.ts +7 -0
  202. package/lib/frontend/cppFrontend/base/Type.d.ts.map +1 -1
  203. package/lib/frontend/cppFrontend/base/Type.js +29 -0
  204. package/lib/frontend/cppFrontend/common/ArkIRTransformer.d.ts.map +1 -1
  205. package/lib/frontend/cppFrontend/common/ArkIRTransformer.js +56 -56
  206. package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts +1 -1
  207. package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts.map +1 -1
  208. package/lib/frontend/cppFrontend/common/ArkValueTransformer.js +124 -113
  209. package/lib/frontend/cppFrontend/common/Builtin.d.ts +29 -19
  210. package/lib/frontend/cppFrontend/common/Builtin.d.ts.map +1 -1
  211. package/lib/frontend/cppFrontend/common/Builtin.js +56 -35
  212. package/lib/frontend/cppFrontend/common/IRInference.d.ts +7 -2
  213. package/lib/frontend/cppFrontend/common/IRInference.d.ts.map +1 -1
  214. package/lib/frontend/cppFrontend/common/IRInference.js +61 -28
  215. package/lib/frontend/cppFrontend/common/IRUtils.d.ts +1 -0
  216. package/lib/frontend/cppFrontend/common/IRUtils.d.ts.map +1 -1
  217. package/lib/frontend/cppFrontend/common/IRUtils.js +22 -10
  218. package/lib/frontend/cppFrontend/common/ModelUtils.d.ts +19 -0
  219. package/lib/frontend/cppFrontend/common/ModelUtils.d.ts.map +1 -1
  220. package/lib/frontend/cppFrontend/common/ModelUtils.js +84 -3
  221. package/lib/frontend/cppFrontend/common/TypeInference.d.ts.map +1 -1
  222. package/lib/frontend/cppFrontend/common/TypeInference.js +44 -54
  223. package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.d.ts.map +1 -1
  224. package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.js +2 -1
  225. package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts +1 -1
  226. package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts.map +1 -1
  227. package/lib/frontend/cppFrontend/inference/CxxValueInference.d.ts.map +1 -1
  228. package/lib/frontend/cppFrontend/inference/CxxValueInference.js +41 -5
  229. package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.d.ts.map +1 -1
  230. package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.js +18 -28
  231. package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.d.ts.map +1 -1
  232. package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.js +2 -3
  233. package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts +2 -2
  234. package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts.map +1 -1
  235. package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.js +31 -24
  236. package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  237. package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.js +10 -16
  238. package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts +0 -2
  239. package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
  240. package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.js +19 -37
  241. package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts +1 -0
  242. package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts.map +1 -1
  243. package/lib/frontend/cppFrontend/model/builder/BodyBuilder.js +30 -3
  244. package/lib/frontend/cppFrontend/model/builder/builderUtils.d.ts.map +1 -1
  245. package/lib/frontend/cppFrontend/model/builder/builderUtils.js +8 -4
  246. package/lib/index.d.ts +3 -0
  247. package/lib/index.d.ts.map +1 -1
  248. package/lib/index.js +10 -2
  249. package/lib/save/json/JsonSerialization.js +2 -2
  250. package/lib/save/source/SourceStmt.js +1 -1
  251. package/lib/save/source/SourceTransformer.d.ts.map +1 -1
  252. package/lib/save/source/SourceTransformer.js +0 -9
  253. package/lib/statistics/StageStatistics.d.ts +195 -0
  254. package/lib/statistics/StageStatistics.d.ts.map +1 -0
  255. package/lib/statistics/StageStatistics.js +346 -0
  256. package/lib/statistics/StageStatisticsReporter.d.ts +58 -0
  257. package/lib/statistics/StageStatisticsReporter.d.ts.map +1 -0
  258. package/lib/statistics/StageStatisticsReporter.js +255 -0
  259. package/lib/utils/Canonicalizer.d.ts +9 -2
  260. package/lib/utils/Canonicalizer.d.ts.map +1 -1
  261. package/lib/utils/Canonicalizer.js +19 -2
  262. package/lib/utils/CxxSceneUtils.d.ts +7 -0
  263. package/lib/utils/CxxSceneUtils.d.ts.map +1 -1
  264. package/lib/utils/CxxSceneUtils.js +10 -1
  265. package/lib/utils/FileUtils.d.ts +0 -1
  266. package/lib/utils/FileUtils.d.ts.map +1 -1
  267. package/lib/utils/FileUtils.js +1 -9
  268. package/lib/utils/HashUtils.d.ts +9 -0
  269. package/lib/utils/HashUtils.d.ts.map +1 -0
  270. package/lib/utils/HashUtils.js +65 -0
  271. package/lib/utils/ModuleUtils.d.ts.map +1 -1
  272. package/lib/utils/ModuleUtils.js +24 -5
  273. package/lib/utils/VisitedSegment.d.ts +23 -0
  274. package/lib/utils/VisitedSegment.d.ts.map +1 -0
  275. package/lib/utils/VisitedSegment.js +64 -0
  276. package/lib/utils/callGraphUtils.d.ts.map +1 -1
  277. package/lib/utils/callGraphUtils.js +7 -7
  278. package/lib/utils/getAllFiles.d.ts.map +1 -1
  279. package/lib/utils/getAllFiles.js +11 -8
  280. package/lib/utils/logger.d.ts +4 -0
  281. package/lib/utils/logger.d.ts.map +1 -1
  282. package/lib/utils/logger.js +16 -0
  283. package/lib/utils/parseArkSourceFile.d.ts +33 -0
  284. package/lib/utils/parseArkSourceFile.d.ts.map +1 -0
  285. package/lib/utils/parseArkSourceFile.js +131 -0
  286. package/package.json +1 -1
  287. package/lib/node_modules/ohos-typescript/README.OpenSource +0 -11
  288. package/lib/node_modules/ohos-typescript/README.md +0 -81
  289. package/lib/node_modules/ohos-typescript/SECURITY.md +0 -41
  290. package/lib/node_modules/ohos-typescript/ThirdPartyNoticeText.txt +0 -193
  291. package/lib/node_modules/ohos-typescript/bin/tsc +0 -2
  292. package/lib/node_modules/ohos-typescript/bin/tsserver +0 -2
  293. package/lib/node_modules/ohos-typescript/lib/README.md +0 -5
  294. package/lib/node_modules/ohos-typescript/lib/cancellationToken.js +0 -86
  295. package/lib/node_modules/ohos-typescript/lib/cs/diagnosticMessages.generated.json +0 -1880
  296. package/lib/node_modules/ohos-typescript/lib/de/diagnosticMessages.generated.json +0 -1880
  297. package/lib/node_modules/ohos-typescript/lib/es/diagnosticMessages.generated.json +0 -1880
  298. package/lib/node_modules/ohos-typescript/lib/fr/diagnosticMessages.generated.json +0 -1880
  299. package/lib/node_modules/ohos-typescript/lib/it/diagnosticMessages.generated.json +0 -1880
  300. package/lib/node_modules/ohos-typescript/lib/ja/diagnosticMessages.generated.json +0 -1880
  301. package/lib/node_modules/ohos-typescript/lib/ko/diagnosticMessages.generated.json +0 -1880
  302. package/lib/node_modules/ohos-typescript/lib/lib.dom.d.ts +0 -18505
  303. package/lib/node_modules/ohos-typescript/lib/lib.dom.iterable.d.ts +0 -341
  304. package/lib/node_modules/ohos-typescript/lib/lib.scripthost.d.ts +0 -327
  305. package/lib/node_modules/ohos-typescript/lib/lib.webworker.d.ts +0 -6192
  306. package/lib/node_modules/ohos-typescript/lib/lib.webworker.importscripts.d.ts +0 -26
  307. package/lib/node_modules/ohos-typescript/lib/lib.webworker.iterable.d.ts +0 -175
  308. package/lib/node_modules/ohos-typescript/lib/pl/diagnosticMessages.generated.json +0 -1880
  309. package/lib/node_modules/ohos-typescript/lib/pt-br/diagnosticMessages.generated.json +0 -1880
  310. package/lib/node_modules/ohos-typescript/lib/ru/diagnosticMessages.generated.json +0 -1880
  311. package/lib/node_modules/ohos-typescript/lib/tr/diagnosticMessages.generated.json +0 -1880
  312. package/lib/node_modules/ohos-typescript/lib/tsc.js +0 -114551
  313. package/lib/node_modules/ohos-typescript/lib/tsserver.js +0 -179691
  314. package/lib/node_modules/ohos-typescript/lib/tsserverlibrary.d.ts +0 -13648
  315. package/lib/node_modules/ohos-typescript/lib/tsserverlibrary.js +0 -178688
  316. package/lib/node_modules/ohos-typescript/lib/typesMap.json +0 -497
  317. package/lib/node_modules/ohos-typescript/lib/typingsInstaller.js +0 -39871
  318. package/lib/node_modules/ohos-typescript/lib/watchGuard.js +0 -49
  319. package/lib/node_modules/ohos-typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -1880
  320. package/lib/node_modules/ohos-typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -1880
  321. package/lib/utils/DependenciesSort.d.ts +0 -3
  322. package/lib/utils/DependenciesSort.d.ts.map +0 -1
  323. package/lib/utils/DependenciesSort.js +0 -72
  324. package/lib/utils/crypto_utils.d.ts +0 -6
  325. package/lib/utils/crypto_utils.d.ts.map +0 -1
  326. package/lib/utils/crypto_utils.js +0 -57
@@ -17,15 +17,45 @@ export declare class SdkUtils {
17
17
  private static dfsFiles;
18
18
  static dispose(): void;
19
19
  static buildSdkImportMap(file: ArkFile): void;
20
+ /**
21
+ * Entry count of the SDK import map, read as part of the resolution table state that decides
22
+ * whether a cached "no file" answer is still valid.
23
+ */
24
+ static getSdkImportMapSize(): number;
20
25
  static getImportSdkFile(from: string): ArkFile | undefined;
21
26
  private static isGlobalPath;
22
- static loadGlobalAPI(file: ArkFile, globalMap: Map<string, ArkExport>): void;
23
- static mergeGlobalAPI(file: ArkFile, globalMap: Map<string, ArkExport>): void;
24
- private static copyNamespace;
25
- static loadAPI(api: ArkExport, globalMap: Map<string, ArkExport>, override?: boolean): void;
26
- static postInferredSdk(file: ArkFile, globalMap: Map<string, ArkExport>): void;
27
+ /** @internal 取名字下的首实体(单值视图语义)。 */
28
+ private static getFirstGlobal;
29
+ /** @internal first-win 登记:append 到列表尾部(首实体不变)。 */
30
+ private static appendGlobal;
31
+ /** @internal override 登记:移到列表头部(等价旧单值覆盖语义)。 */
32
+ private static promoteGlobal;
33
+ static loadGlobalAPI(file: ArkFile, globalMap: Map<string, ArkExport[]>): void;
34
+ static mergeGlobalAPI(file: ArkFile, globalMap: Map<string, ArkExport[]>): void;
35
+ static loadAPI(api: ArkExport, globalMap: Map<string, ArkExport[]>, override?: boolean): void;
36
+ static postInferredSdk(file: ArkFile, globalMap: Map<string, ArkExport[]>): void;
27
37
  private static loadClass;
28
38
  private static loadGlobalLocal;
39
+ /** @internal, Get all member-provider classes of a global symbol for member probing. */
40
+ static getSdkGlobalMemberClasses(globalName: string): ArkClass[];
41
+ /**
42
+ * Get the same-name classes mounted in sibling entities of a class's declaring
43
+ * namespace — for cross-file same-name namespaces (e.g. `Intl` declared across
44
+ * lib.es5 + lib.es20XX.intl), the class's counterpart in each sibling namespace
45
+ * carries members declared in that file. Sibling order follows registration
46
+ * order (= DFS file order); returns [] for non-global namespaces.
47
+ */
48
+ static getNamespacedSiblingClasses(arkClass: ArkClass): ArkClass[];
49
+ /**
50
+ * Single-value view of the SDK global map: the first entity registered under the name (first-win 语义). Returns null when unregistered.
51
+ */
52
+ static getSdkGlobal(globalName: string): ArkExport | null;
53
+ /**
54
+ * All SDK global entities registered under the given name (multi-declaration
55
+ * scenario: e.g. `interface Object` + `declare var Object: ObjectConstructor` are
56
+ * two entities). Order is the registration order; entry [0] equals {@link getSdkGlobal}.
57
+ */
58
+ static getSdkGlobals(globalName: string): ArkExport[];
29
59
  static copyMembers(from: ArkClass, to: ArkClass): void;
30
60
  static computeGlobalThis(leftOp: AbstractFieldRef, arkMethod: ArkMethod): void;
31
61
  static extendArkUI(scene: Scene): void;
@@ -1 +1 @@
1
- {"version":3,"file":"SdkUtils.d.ts","sourceRoot":"","sources":["../../../src/core/common/SdkUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAc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,GAAG,SAAS,EAAE;WAI9C,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,GAAG,IAAI;WA8B/C,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;WAWvE,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;WAc/B,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAuBnE"}
@@ -53,14 +53,31 @@ const path_1 = __importDefault(require("path"));
53
53
  const Type_1 = require("../base/Type");
54
54
  const ArkNamespace_1 = require("../model/ArkNamespace");
55
55
  const logger_1 = __importStar(require("../../utils/logger"));
56
- const ohos_typescript_1 = __importDefault(require("ohos-typescript"));
57
56
  const fs_1 = __importDefault(require("fs"));
57
+ const parseArkSourceFile_1 = require("../../utils/parseArkSourceFile");
58
+ const SignatureCanonicalizerRegistry_1 = require("./SignatureCanonicalizerRegistry");
58
59
  const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'SdkUtils');
60
+ const DEFAULT_ES_VERSION = 'ES2021';
59
61
  class SdkUtils {
60
62
  static setEsVersion(buildProfile) {
61
- const accessChain = 'buildOption.arkOptions.tscConfig.targetESVersion';
62
- const version = accessChain.split('.').reduce((acc, key) => acc === null || acc === void 0 ? void 0 : acc[key], buildProfile);
63
- if (version && this.esVersionMap.has(version)) {
63
+ var _a;
64
+ const products = (_a = buildProfile === null || buildProfile === void 0 ? void 0 : buildProfile.app) === null || _a === void 0 ? void 0 : _a.products;
65
+ let version;
66
+ if (Array.isArray(products)) {
67
+ const defaultProduct = products.find(p => (p === null || p === void 0 ? void 0 : p.name) === 'default');
68
+ const accessChain = 'buildOption.arkOptions.tscConfig.targetESVersion';
69
+ if (defaultProduct) {
70
+ version = accessChain.split('.').reduce((acc, key) => acc === null || acc === void 0 ? void 0 : acc[key], defaultProduct);
71
+ }
72
+ // Fall back to the first product with a targetESVersion
73
+ if (!version) {
74
+ version = products.find(product => accessChain.split('.').reduce((acc, key) => acc === null || acc === void 0 ? void 0 : acc[key], product));
75
+ }
76
+ }
77
+ if (!version) {
78
+ version = DEFAULT_ES_VERSION;
79
+ }
80
+ if (this.esVersionMap.has(version)) {
64
81
  this.esVersion = version;
65
82
  }
66
83
  }
@@ -82,7 +99,7 @@ class SdkUtils {
82
99
  return {
83
100
  moduleName: '',
84
101
  name: this.BUILT_IN_NAME,
85
- path: builtInPath
102
+ path: builtInPath,
86
103
  };
87
104
  }
88
105
  static fetchBuiltInFiles(builtInPath) {
@@ -97,7 +114,7 @@ class SdkUtils {
97
114
  return Array.from(result);
98
115
  }
99
116
  static dfsFiles(filePath, files) {
100
- const sourceFile = ohos_typescript_1.default.createSourceFile(filePath, fs_1.default.readFileSync(filePath, 'utf8'), ohos_typescript_1.default.ScriptTarget.Latest);
117
+ const sourceFile = (0, parseArkSourceFile_1.parseArkSourceFile)(filePath, fs_1.default.readFileSync(filePath, 'utf8'), false);
101
118
  const references = sourceFile.libReferenceDirectives;
102
119
  references.forEach(ref => {
103
120
  this.dfsFiles(path_1.default.join(path_1.default.dirname(filePath), `lib.${ref.fileName}.d.ts`), files);
@@ -113,19 +130,34 @@ class SdkUtils {
113
130
  }
114
131
  static buildSdkImportMap(file) {
115
132
  const fileName = path_1.default.basename(file.getName());
133
+ const fileSigID = file.getFileSigID();
116
134
  if (fileName.startsWith(EtsConst_1.SCOPE_PREFIX)) {
117
- this.sdkImportMap.set(fileName.replace(/\.d\.e?ts$/, ''), file);
135
+ this.sdkImportMap.set(fileName.replace(/\.d\.e?ts$/, ''), fileSigID);
118
136
  }
119
137
  else if (file.getName().startsWith('api')) {
120
- this.sdkImportMap.set(file.getName().replace(/^api[/\\]|\.d\.e?ts$/g, ''), file);
138
+ this.sdkImportMap.set(file.getName().replace(/^api[/\\]|\.d\.e?ts$/g, ''), fileSigID);
121
139
  }
122
140
  }
141
+ /**
142
+ * Entry count of the SDK import map, read as part of the resolution table state that decides
143
+ * whether a cached "no file" answer is still valid.
144
+ */
145
+ static getSdkImportMapSize() {
146
+ return this.sdkImportMap.size;
147
+ }
123
148
  static getImportSdkFile(from) {
124
- return this.sdkImportMap.get(from);
149
+ const fileSigID = this.sdkImportMap.get(from);
150
+ if (fileSigID === undefined) {
151
+ return undefined;
152
+ }
153
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().getFileById(fileSigID);
125
154
  }
126
155
  static isGlobalPath(file) {
127
156
  var _a;
128
- return !!((_a = file.getScene().getOptions().sdkGlobalFolders) === null || _a === void 0 ? void 0 : _a.find(x => {
157
+ return !!((_a = file
158
+ .getScene()
159
+ .getOptions()
160
+ .sdkGlobalFolders) === null || _a === void 0 ? void 0 : _a.find(x => {
129
161
  if (path_1.default.isAbsolute(x)) {
130
162
  return file.getFilePath().startsWith(x);
131
163
  }
@@ -134,6 +166,39 @@ class SdkUtils {
134
166
  }
135
167
  }));
136
168
  }
169
+ // --- 多值登记 helpers(单值视图兼容语义) ---
170
+ // globalMap 为多值主存(名字 → 实体列表,登记序)。单值视图 = 列表 [0]:
171
+ // appendGlobal 保持首实体不变(旧 first-win 语义);promoteGlobal 移至头部
172
+ //(旧 override 覆盖语义)。
173
+ /** @internal 取名字下的首实体(单值视图语义)。 */
174
+ static getFirstGlobal(globalMap, name) {
175
+ var _a;
176
+ return (_a = globalMap.get(name)) === null || _a === void 0 ? void 0 : _a[0];
177
+ }
178
+ /** @internal first-win 登记:append 到列表尾部(首实体不变)。 */
179
+ static appendGlobal(globalMap, name, entity) {
180
+ const list = globalMap.get(name);
181
+ if (!list) {
182
+ globalMap.set(name, [entity]);
183
+ return;
184
+ }
185
+ if (!list.includes(entity)) {
186
+ list.push(entity);
187
+ }
188
+ }
189
+ /** @internal override 登记:移到列表头部(等价旧单值覆盖语义)。 */
190
+ static promoteGlobal(globalMap, name, entity) {
191
+ const list = globalMap.get(name);
192
+ if (!list) {
193
+ globalMap.set(name, [entity]);
194
+ return;
195
+ }
196
+ const idx = list.indexOf(entity);
197
+ if (idx >= 0) {
198
+ list.splice(idx, 1);
199
+ }
200
+ list.unshift(entity);
201
+ }
137
202
  static loadGlobalAPI(file, globalMap) {
138
203
  var _a, _b, _c;
139
204
  if (!this.isGlobalPath(file)) {
@@ -149,7 +214,8 @@ class SdkUtils {
149
214
  .forEach(mtd => this.loadAPI(mtd, globalMap));
150
215
  }
151
216
  });
152
- (_c = (_b = (_a = file.getDefaultClass().getDefaultArkMethod()) === null || _a === void 0 ? void 0 : _a.getBody()) === null || _b === void 0 ? void 0 : _b.getAliasTypeMap()) === null || _c === void 0 ? void 0 : _c.forEach(a => this.loadAPI(a[0], globalMap, true));
217
+ (_c = (_b = (_a = file.getDefaultClass()
218
+ .getDefaultArkMethod()) === null || _a === void 0 ? void 0 : _a.getBody()) === null || _b === void 0 ? void 0 : _b.getAliasTypeMap()) === null || _c === void 0 ? void 0 : _c.forEach(a => this.loadAPI(a[0], globalMap, true));
153
219
  file.getNamespaces().forEach(ns => this.loadAPI(ns, globalMap));
154
220
  }
155
221
  static mergeGlobalAPI(file, globalMap) {
@@ -161,35 +227,25 @@ class SdkUtils {
161
227
  this.loadClass(globalMap, cls);
162
228
  }
163
229
  });
164
- file.getNamespaces().forEach(ns => {
165
- const oldNs = globalMap.get(ns.getName());
166
- if (oldNs instanceof ArkNamespace_1.ArkNamespace && oldNs !== ns) {
167
- SdkUtils.copyNamespace(ns, oldNs);
168
- }
169
- });
170
- }
171
- static copyNamespace(ns, oldNs) {
172
- ns.getClasses().forEach(cls => {
173
- const oldCls = oldNs.getClassWithName(cls.getName());
174
- if (oldCls) {
175
- this.copyMembers(cls, oldCls);
176
- }
177
- else {
178
- oldNs.addArkClass(cls);
179
- }
180
- });
230
+ // 跨文件同名 namespace 不再合并(copyNamespace 退役):ns 实体已在阶段 1
231
+ // 多值登记(各文件的实体共存),成员可见性由探测层承担——
232
+ // ModelUtils.findPropertyInNamespaces 逐实体探测(%dflt locals / ns 内类 /
233
+ // 嵌套 ns / export),成员签名归属真实声明文件。
181
234
  }
182
235
  static loadAPI(api, globalMap, override = false) {
183
- const old = globalMap.get(api.getName());
236
+ const old = this.getFirstGlobal(globalMap, api.getName());
184
237
  if (!old) {
185
- globalMap.set(api.getName(), api);
238
+ this.appendGlobal(globalMap, api.getName(), api);
186
239
  }
187
240
  else if (override) {
188
241
  logger.trace(`${old.getSignature()} is override`);
189
- globalMap.set(api.getName(), api);
242
+ this.promoteGlobal(globalMap, api.getName(), api);
190
243
  }
191
244
  else {
245
+ // first-win(单值视图保持首实体),但后续同名实体仍多值登记(append 尾部)
246
+ //——同名多声明(跨文件 interface 增补等)的成员探测依赖完整实体列表。
192
247
  logger.trace(`duplicated api: ${api.getSignature()}`);
248
+ this.appendGlobal(globalMap, api.getName(), api);
193
249
  }
194
250
  }
195
251
  static postInferredSdk(file, globalMap) {
@@ -206,18 +262,22 @@ class SdkUtils {
206
262
  });
207
263
  }
208
264
  static loadClass(globalMap, cls) {
209
- const old = globalMap.get(cls.getName());
265
+ const old = this.getFirstGlobal(globalMap, cls.getName());
210
266
  if (cls === old) {
211
267
  return;
212
268
  }
213
269
  else if (old instanceof ArkClass_1.ArkClass && old.getDeclaringArkFile().getProjectName() === cls.getDeclaringArkFile().getProjectName()) {
214
270
  if (old.getCategory() === ArkClass_1.ClassCategory.CLASS || old.getCategory() === ArkClass_1.ClassCategory.INTERFACE) {
215
- this.copyMembers(cls, old);
271
+ // 同名 interface 跨文件增补(TS 语义为同一实体):不再 copyMembers 灌
272
+ // 入首实体——各文件的实体共存在多值列表(阶段1已登记),成员留在
273
+ // 声明类,探测层逐实体查找(成员签名归属真实声明文件)。
274
+ return;
216
275
  }
217
276
  else {
218
- this.copyMembers(old, cls);
219
- globalMap.delete(cls.getName());
220
- this.loadAPI(cls, globalMap, true);
277
+ // 类别冲突(旧 enum 等 vs 新 interface/class):不再 copyMembers(old, cls)
278
+ //——两实体共存多值(cls 提升为单值视图,与旧 delete+override 语义
279
+ // 一致),成员探测并集可见。
280
+ this.promoteGlobal(globalMap, cls.getName(), cls);
221
281
  }
222
282
  }
223
283
  else {
@@ -229,19 +289,20 @@ class SdkUtils {
229
289
  local.setSignature(new ArkSignature_1.LocalSignature(name, defaultArkMethod.getSignature()));
230
290
  const scene = defaultArkMethod.getDeclaringArkFile().getScene();
231
291
  if (scene.getOptions().isScanAbc) {
232
- const instance = globalMap.get(name + 'Interface');
233
- const attr = globalMap.get(name + EtsConst_1.COMPONENT_ATTRIBUTE);
292
+ const instance = this.getFirstGlobal(globalMap, name + 'Interface');
293
+ const attr = this.getFirstGlobal(globalMap, name + EtsConst_1.COMPONENT_ATTRIBUTE);
234
294
  if (attr instanceof ArkClass_1.ArkClass && instance instanceof ArkClass_1.ArkClass) {
235
- this.copyMembers(instance, attr);
236
- globalMap.set(name, attr);
295
+ // abc 场景不再 copyMembers 合并(挂载分裂来源):attr 提升为单值视图
296
+ //(与旧 set 语义一致),成员留在各自声明类,由探测层逐实体查找。
297
+ this.promoteGlobal(globalMap, name, attr);
237
298
  return;
238
299
  }
239
300
  }
240
- const old = globalMap.get(name);
301
+ const old = this.getFirstGlobal(globalMap, name);
241
302
  if (old instanceof ArkClass_1.ArkClass && local.getType() instanceof Type_1.ClassType) {
242
- const localConstructor = globalMap.get(local.getType().getClassSignature().getClassName());
303
+ const localConstructor = this.getFirstGlobal(globalMap, local.getType().getClassSignature().getClassName());
243
304
  if (localConstructor instanceof ArkClass_1.ArkClass) {
244
- this.copyMembers(localConstructor, old);
305
+ this.appendGlobal(globalMap, name, local);
245
306
  }
246
307
  else {
247
308
  this.loadAPI(local, globalMap, true);
@@ -251,17 +312,106 @@ class SdkUtils {
251
312
  this.loadAPI(local, globalMap, true);
252
313
  }
253
314
  }
315
+ // --- SDK global symbol member probing (migrated from Registry — work item L) ---
316
+ // This layer MAY use instanceof on model classes freely (SdkUtils sits above the
317
+ // dependency-graph floor); the Registry must not (value imports of model classes
318
+ // would create real module-loading edges that flip the ESM cycle, see Registry's
319
+ // dependency-graph constraint note).
320
+ /** @internal, Get all member-provider classes of a global symbol for member probing. */
321
+ static getSdkGlobalMemberClasses(globalName) {
322
+ const result = [];
323
+ const seen = new Set();
324
+ const push = (c) => {
325
+ if (!seen.has(c)) {
326
+ seen.add(c);
327
+ result.push(c);
328
+ }
329
+ };
330
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
331
+ for (const e of SdkUtils.getSdkGlobals(globalName)) {
332
+ if (e instanceof ArkClass_1.ArkClass) {
333
+ push(e);
334
+ continue;
335
+ }
336
+ if (!(e instanceof Local_1.Local)) {
337
+ continue;
338
+ }
339
+ const localType = e.getType();
340
+ if (!(localType instanceof Type_1.ClassType)) {
341
+ continue;
342
+ }
343
+ // Local → ctor class via canonicalizer direct lookup: SDK classes are registered (setModel) at build time
344
+ // before their var locals enter the global map; evicted models miss this lookup.
345
+ const ctorSig = localType.getClassSignature();
346
+ const id = reg.classSigCanonicalizer.getExistingId(ctorSig);
347
+ const ctorClass = id !== -1 ? reg.classSigCanonicalizer.getModel(id) : undefined;
348
+ if (ctorClass !== undefined) {
349
+ push(ctorClass);
350
+ }
351
+ for (const c of SdkUtils.getSdkGlobals(ctorSig.getClassName())) {
352
+ if (c instanceof ArkClass_1.ArkClass) {
353
+ push(c);
354
+ }
355
+ }
356
+ }
357
+ return result;
358
+ }
359
+ /**
360
+ * Get the same-name classes mounted in sibling entities of a class's declaring
361
+ * namespace — for cross-file same-name namespaces (e.g. `Intl` declared across
362
+ * lib.es5 + lib.es20XX.intl), the class's counterpart in each sibling namespace
363
+ * carries members declared in that file. Sibling order follows registration
364
+ * order (= DFS file order); returns [] for non-global namespaces.
365
+ */
366
+ static getNamespacedSiblingClasses(arkClass) {
367
+ const ns = arkClass.getDeclaringArkNamespace();
368
+ if (!ns) {
369
+ return [];
370
+ }
371
+ const result = [];
372
+ const className = arkClass.getName();
373
+ for (const e of SdkUtils.getSdkGlobals(ns.getName())) {
374
+ if (e instanceof ArkNamespace_1.ArkNamespace && e !== ns) {
375
+ const c = e.getClassWithName(className);
376
+ if (c) {
377
+ result.push(c);
378
+ }
379
+ }
380
+ }
381
+ return result;
382
+ }
383
+ /**
384
+ * Single-value view of the SDK global map: the first entity registered under the name (first-win 语义). Returns null when unregistered.
385
+ */
386
+ static getSdkGlobal(globalName) {
387
+ var _a, _b;
388
+ return (_b = (_a = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().sdkGlobalMap.get(globalName)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;
389
+ }
390
+ /**
391
+ * All SDK global entities registered under the given name (multi-declaration
392
+ * scenario: e.g. `interface Object` + `declare var Object: ObjectConstructor` are
393
+ * two entities). Order is the registration order; entry [0] equals {@link getSdkGlobal}.
394
+ */
395
+ static getSdkGlobals(globalName) {
396
+ var _a;
397
+ return (_a = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().sdkGlobalMap.get(globalName)) !== null && _a !== void 0 ? _a : [];
398
+ }
254
399
  static copyMembers(from, to) {
255
400
  from.getMethods().forEach(method => {
256
401
  var _a, _b, _c, _d;
257
402
  const dist = method.isStatic() ? to.getStaticMethodWithName(method.getName()) : to.getMethodWithName(method.getName());
258
403
  const distSignatures = dist === null || dist === void 0 ? void 0 : dist.getDeclareSignatures();
259
404
  if (distSignatures) {
260
- (_a = method.getDeclareSignatures()) === null || _a === void 0 ? void 0 : _a.forEach(x => distSignatures.push(x));
405
+ // getDeclareSignatures() returns a rebuilt copy — write the merged list back explicitly.
406
+ const merged = [...distSignatures];
407
+ (_a = method.getDeclareSignatures()) === null || _a === void 0 ? void 0 : _a.forEach(x => merged.push(x));
408
+ dist.setDeclareSignatures(merged);
261
409
  }
262
410
  else if (method.getName() === Const_1.DEFAULT_ARK_METHOD_NAME && dist) {
263
- (_b = method.getBody()) === null || _b === void 0 ? void 0 : _b.getLocals().forEach(local => { var _a; return (_a = dist.getBody()) === null || _a === void 0 ? void 0 : _a.getLocals().set(local.getName(), local); });
264
- (_d = (_c = method.getBody()) === null || _c === void 0 ? void 0 : _c.getAliasTypeMap()) === null || _d === void 0 ? void 0 : _d.forEach(type => { var _a, _b; return (_b = (_a = dist.getBody()) === null || _a === void 0 ? void 0 : _a.getAliasTypeMap()) === null || _b === void 0 ? void 0 : _b.set(type[0].getName(), type); });
411
+ (_b = method
412
+ .getBody()) === null || _b === void 0 ? void 0 : _b.getLocals().forEach(local => { var _a; return (_a = dist.getBody()) === null || _a === void 0 ? void 0 : _a.getLocals().set(local.getName(), local); });
413
+ (_d = (_c = method
414
+ .getBody()) === null || _c === void 0 ? void 0 : _c.getAliasTypeMap()) === null || _d === void 0 ? void 0 : _d.forEach(type => { var _a, _b; return (_b = (_a = dist.getBody()) === null || _a === void 0 ? void 0 : _a.getAliasTypeMap()) === null || _b === void 0 ? void 0 : _b.set(type[0].getName(), type); });
265
415
  }
266
416
  else {
267
417
  to.addMethod(method);
@@ -275,7 +425,7 @@ class SdkUtils {
275
425
  });
276
426
  }
277
427
  static computeGlobalThis(leftOp, arkMethod) {
278
- const globalThis = arkMethod.getDeclaringArkFile().getScene().getSdkGlobal(TSConst_1.GLOBAL_THIS_NAME);
428
+ const globalThis = SdkUtils.getSdkGlobal(TSConst_1.GLOBAL_THIS_NAME);
279
429
  if (globalThis instanceof ArkNamespace_1.ArkNamespace) {
280
430
  const exportInfo = new ArkExport_1.ExportInfo.Builder()
281
431
  .exportClauseName(leftOp.getFieldName())
@@ -285,12 +435,10 @@ class SdkUtils {
285
435
  }
286
436
  }
287
437
  static extendArkUI(scene) {
288
- const cls = scene.getSdkGlobal(EtsConst_1.COMMON_METHOD);
438
+ const cls = SdkUtils.getSdkGlobal(EtsConst_1.COMMON_METHOD);
289
439
  if (cls instanceof ArkClass_1.ArkClass) {
290
- const mtd = new ArkMethod_1.ArkMethod();
291
- mtd.setDeclaringArkClass(cls);
292
440
  const methodSubSignature = new ArkSignature_1.MethodSubSignature(EtsConst_1.COMPONENT_POP_FUNCTION, [], Type_1.VoidType.getInstance(), false);
293
- mtd.setDeclareSignatures(new ArkSignature_1.MethodSignature(cls.getSignature(), methodSubSignature));
441
+ const mtd = new ArkMethod_1.ArkMethod(cls.getClassSigID(), undefined, new ArkSignature_1.MethodSignature(cls.getClassSigID(), methodSubSignature));
294
442
  mtd.setIsGeneratedFlag(true);
295
443
  cls.addMethod(mtd);
296
444
  }
@@ -304,8 +452,7 @@ class SdkUtils {
304
452
  if (!fs_1.default.existsSync(componentsDir)) {
305
453
  return;
306
454
  }
307
- const componentFiles = fs_1.default.readdirSync(componentsDir)
308
- .filter(file => file.endsWith('.json'));
455
+ const componentFiles = fs_1.default.readdirSync(componentsDir).filter(file => file.endsWith('.json'));
309
456
  const componentNames = [];
310
457
  componentFiles.forEach(file => {
311
458
  const filePath = path_1.default.join(componentsDir, file);
@@ -326,14 +473,11 @@ class SdkUtils {
326
473
  }
327
474
  }
328
475
  exports.SdkUtils = SdkUtils;
329
- SdkUtils.esVersion = 'ES2021';
476
+ SdkUtils.esVersion = DEFAULT_ES_VERSION;
330
477
  SdkUtils.esVersionMap = new Map([
331
478
  ['ES2017', 'lib.es2020.d.ts'],
332
- ['ES2021', 'lib.es2021.d.ts']
479
+ ['ES2021', 'lib.es2021.d.ts'],
333
480
  ]);
334
481
  SdkUtils.sdkImportMap = new Map();
335
482
  SdkUtils.BUILT_IN_NAME = 'built-in';
336
- SdkUtils.BUILT_IN_PATHS = [
337
- 'lib/node_modules/ohos-typescript/lib',
338
- 'node_modules/ohos-typescript/lib',
339
- ];
483
+ SdkUtils.BUILT_IN_PATHS = ['lib/node_modules/ohos-typescript/lib', 'node_modules/ohos-typescript/lib'];
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Interface that signatures must implement to participate in hash-based canonicalization.
3
+ *
4
+ * The three-layer architecture:
5
+ * - Layer 1: `getHashCode()` — 32-bit hash computed at construction time, cached in a readonly field
6
+ * - Layer 2: `Canonicalizer<number>` with `numberWithEquality` strategy — open-addressing + chaining
7
+ * - Layer 3: `equals()` — per-field semantic comparison, used when hash collisions occur
8
+ */
9
+ export interface Canonicalizable {
10
+ /** Stable 32-bit hash code. Two equal signatures must have the same hash code. */
11
+ getHashCode(): number;
12
+ /** Semantic equality. Used for collision resolution in Layer 2. */
13
+ equals(other: this): boolean;
14
+ }
15
+ /**
16
+ * Value-semantic identity comparison between two signatures:
17
+ * cached-hash fast reject + `equals()` final verdict.
18
+ *
19
+ * Execution rules: the hash comparison short-circuits only comparisons whose
20
+ * result is "unequal"; comparisons whose result is "equal" necessarily run
21
+ * `equals()` (the Canonicalizable contract "equals ⇒ same hash" guarantees the
22
+ * hashes match), where canonical instances short-circuit on the first line
23
+ * (`this === other`). This is the same hash-then-equals protocol the
24
+ * canonicalizer probe uses internally — running it once directly between the
25
+ * two objects, instead of twice (once per probe) plus an ID comparison, and
26
+ * without depending on registration state.
27
+ *
28
+ * Why not compare canonicalizer IDs ("same ID ⇒ equal")? IDs are a function
29
+ * of value × registration history, not of value alone: two unregistered
30
+ * signatures (e.g. temp stubs) both yield getExistingId() === -1 and would be
31
+ * wrongly judged equal; one registered + one unregistered would be wrongly
32
+ * judged unequal; and the getId() variant would blind-write unregistered
33
+ * values into the formal space (permanent holes, see the temp-space design).
34
+ *
35
+ * No string building, no string hashing.
36
+ */
37
+ export declare function signatureEquals(a: Canonicalizable, b: Canonicalizable): boolean;
38
+ /**
39
+ * A canonicalizer that deduplicates signatures by value semantics using hash + equals.
40
+ *
41
+ * Uses a three-layer hash-collision-handling architecture:
42
+ *
43
+ * 1. `sig.getHashCode()` returns a cached 32-bit hash (computed once at construction)
44
+ * 2. `Canonicalizer<S>` with `numberWithEquality` strategy uses TypedArray hash tables
45
+ * with open addressing + chaining for collision handling
46
+ * 3. `sig.equals()` does per-field comparison when hash collisions occur
47
+ *
48
+ * This eliminates the `list: string[]` storage of `toMapKey()` strings (~500 KB-1 MB
49
+ * for 10k-level signatures) and avoids repeated string concatenation in `toMapKey()`.
50
+ *
51
+ * IDs are dense integers starting from 0.
52
+ *
53
+ * @template S - The signature type, must implement {@link Canonicalizable}
54
+ */
55
+ export declare class SignatureCanonicalizer<S extends Canonicalizable> {
56
+ private canonicalizer;
57
+ /**
58
+ * Get the unique integer ID for a signature.
59
+ * If a signature with the same hash and `equals()` result has been seen before, returns the existing ID.
60
+ * Otherwise, assigns a new ID and records the signature as the canonical instance.
61
+ *
62
+ * @param sig - The signature to canonicalize
63
+ * @returns The integer ID (>= 0)
64
+ */
65
+ getOrCreateId(sig: S): number;
66
+ /**
67
+ * Get the integer ID of a signature if it already exists.
68
+ * Returns -1 if the signature has not been canonicalized.
69
+ * Does not create a new ID or modify internal state.
70
+ *
71
+ * @param sig - The signature to query
72
+ * @returns The integer ID (>= 0) if found, -1 otherwise
73
+ */
74
+ getExistingId(sig: S): number;
75
+ /**
76
+ * Get the canonical signature instance associated with an integer ID.
77
+ *
78
+ * @param id - The integer ID
79
+ * @returns The canonical signature instance, or `undefined` if the ID is out of bounds
80
+ */
81
+ get(id: number): S | undefined;
82
+ /**
83
+ * Get the total number of unique signatures registered so far.
84
+ */
85
+ size(): number;
86
+ /**
87
+ * Get hash table statistics (for debugging/profiling).
88
+ */
89
+ getStats(): import("../../utils/Canonicalizer").CanonicalizerStats;
90
+ /**
91
+ * Clear all registered signatures and reset the canonicalizer.
92
+ */
93
+ clear(): void;
94
+ }
95
+ //# sourceMappingURL=SignatureCanonicalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignatureCanonicalizer.d.ts","sourceRoot":"","sources":["../../../src/core/common/SignatureCanonicalizer.ts"],"names":[],"mappings":"AAiBA;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC5B,kFAAkF;IAClF,WAAW,IAAI,MAAM,CAAC;IACtB,mEAAmE;IACnE,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAE/E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,sBAAsB,CAAC,CAAC,SAAS,eAAe;IACzD,OAAO,CAAC,aAAa,CAGnB;IAEF;;;;;;;OAOG;IACI,aAAa,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM;IAIpC;;;;;;;OAOG;IACI,aAAa,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM;IAIpC;;;;;OAKG;IACI,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIrC;;OAEG;IACI,IAAI,IAAI,MAAM;IAIrB;;OAEG;IACI,QAAQ;IAIf;;OAEG;IACI,KAAK,IAAI,IAAI;CAGvB"}