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
@@ -21,22 +21,52 @@ export declare const arkMethodNodeKind: string[];
21
21
  * @category core/model
22
22
  */
23
23
  export declare class ArkMethod extends ArkBaseModel implements ArkExport {
24
- private declaringArkClass;
25
- private outerMethod?;
26
- private genericTypes?;
27
- private declareSignatures?;
24
+ /** @internal Formal ClassSigID for the declaring class. -1 = not yet interned. */
25
+ private declaringClassID;
26
+ /** @internal Formal MethodSigID for the outer method. undefined = none. */
27
+ private outerMethodSigID?;
28
+ /** @internal Formal MethodSigID of this method's implementation signature. undefined = declare-only (no implementation). */
29
+ private implementSigID?;
30
+ /** @internal Formal MethodSigIDs of the declaration signatures. undefined = no separate declarations. */
31
+ private declareSigIDs?;
32
+ /**
33
+ * @internal SigIDs of classes declared inside this method body (bare source name → ClassSigID).
34
+ * Only methods whose body contains a class declaration have this map. Enables deterministic
35
+ * scope-chain resolution of local-class references (bare name → exact SigID), replacing
36
+ * the file-level fuzzy prefix matching on composed names (`Local$Outer-m`).
37
+ */
38
+ private localClassSigIDs?;
39
+ /** The full position of the method implementation. Undefined when the method has no implementation (e.g., interface method). */
40
+ private implOriginFullPosition?;
28
41
  /** The full positions of the method declarations (for interface/abstract methods with separate declarations). */
29
42
  private declareOriginFullPositions?;
30
- private implSignature?;
31
- /** The full position of the method implementation.
32
- * Undefined when the method has no implementation (e.g., interface method). */
33
- private implOriginFullPosition?;
43
+ private genericTypes?;
34
44
  private sourceCode?;
35
45
  private body?;
36
46
  private viewTree?;
37
47
  private bodyBuilder?;
38
48
  private CxxBodyBuilder?;
49
+ /**
50
+ * @deprecated Construct with the declaring class ID and (optionally) the signature
51
+ * objects instead.
52
+ */
39
53
  constructor();
54
+ /**
55
+ * Build directly from the declaring class ID and (optionally) signature objects and
56
+ * the outer method SigID.
57
+ * `setImplementationSignature` / `setDeclareSignatures` are the registration points:
58
+ * the implementation path interns the signature, refreshes canonical parameter names,
59
+ * and registers this method as the model with arbitration; the declaration path only
60
+ * interns (registration is completed by ArkClass.addMethod).
61
+ * @param declaringClassID - Formal ClassSigID of the declaring class (required).
62
+ * @param implementationSignature - The implementation signature object; not yet
63
+ * registered — registration happens inside via setImplementationSignature.
64
+ * @param declareSignatures - The declaration signature object(s); not yet interned —
65
+ * interning happens inside via setDeclareSignatures.
66
+ * @param outerMethodSigID - Formal MethodSigID of the outer (enclosing) method for
67
+ * nested methods. Non-positive values are treated as none.
68
+ */
69
+ constructor(declaringClassID: number, implementationSignature?: MethodSignature, declareSignatures?: MethodSignature | MethodSignature[], outerMethodSigID?: number);
40
70
  /**
41
71
  * Returns the program language of the file where this method defined.
42
72
  */
@@ -139,8 +169,16 @@ export declare class ArkMethod extends ArkBaseModel implements ArkExport {
139
169
  * @returns The declaring class of the method.
140
170
  */
141
171
  getDeclaringArkClass(): ArkClass;
172
+ /** @deprecated Use the ID-injecting constructor {@link constructor(declaringClassID, implementationSignature, declareSignatures, outerMethodSigID)}. */
142
173
  setDeclaringArkClass(declaringArkClass: ArkClass): void;
174
+ /** @internal Get the formal ClassSigID of the declaring class. Returns -1 if not interned. */
175
+ getDeclaringClassID(): number;
176
+ /** @internal Get the formal MethodSigID of the outer method. Returns undefined if none. */
177
+ getOuterMethodSigID(): number | undefined;
178
+ /** @internal Set the formal MethodSigID of the outer method directly. Non-positive IDs are treated as none. */
179
+ setOuterMethodSigID(sigID: number): void;
143
180
  getDeclaringArkFile(): ArkFile;
181
+ getDeclaringArkFileID(): number;
144
182
  isDefaultArkMethod(): boolean;
145
183
  isAnonymousMethod(): boolean;
146
184
  getParameters(): MethodParameter[];
@@ -148,9 +186,12 @@ export declare class ArkMethod extends ArkBaseModel implements ArkExport {
148
186
  /**
149
187
  * Get all declare signatures.
150
188
  * The results could be null if there is no seperated declaration of the method.
189
+ * Note: the returned array is a rebuilt copy; mutating it does not affect the internal storage.
151
190
  * @returns null or the method declare signatures.
152
191
  */
153
192
  getDeclareSignatures(): MethodSignature[] | null;
193
+ /** @internal Get the formal MethodSigIDs of the declaration signatures. Returns undefined if none. */
194
+ getDeclareSigIDs(): number[] | undefined;
154
195
  /**
155
196
  * Get the index of the matched method declare signature among all declare signatures.
156
197
  * The index will be -1 if there is no matched signature found.
@@ -171,13 +212,6 @@ export declare class ArkMethod extends ArkBaseModel implements ArkExport {
171
212
  * - Class Signature: indicates which class this method belong to.
172
213
  * - Method SubSignature: indicates the detail info of this method such as method name, parameters, returnType, etc.
173
214
  * @returns The method signature.
174
- * @example
175
- * 1. Get the signature of method mtd.
176
-
177
- ```typescript
178
- let signature = mtd.getSignature();
179
- // ... ...
180
- ```
181
215
  */
182
216
  getSignature(): MethodSignature;
183
217
  /**
@@ -199,6 +233,41 @@ export declare class ArkMethod extends ArkBaseModel implements ArkExport {
199
233
  * @param signature - signature of implementation.
200
234
  */
201
235
  setImplementationSignature(signature: MethodSignature): void;
236
+ /**
237
+ * @internal Refresh the implementation-side parameter names onto the canonical signature.
238
+ *
239
+ * Parameter names are not part of signature identity (hash/equals/toString use parameter
240
+ * types only), so a declaration and an implementation with differing parameter names share
241
+ * one canonical instance — whichever interned first. The implementation is the authority
242
+ * for body-local generation (`prebuildStmts` reads `getParameters()` through the canonical
243
+ * instance), so when an implementation signature carries different parameter names than the
244
+ * canonical instance, the canonical parameter list is replaced with the implementation's.
245
+ */
246
+ private refreshCanonicalParameterNames;
247
+ /**
248
+ * @internal Register this method as the model of the given implementation SigID, with arbitration:
249
+ * - Sibling methods of the same declaring class never overwrite each other's registration:
250
+ * builders merge same-signature overloads/declarations by reading the previously added
251
+ * method through the canonicalizer, and the final winner is registered by ArkClass.addMethod.
252
+ * - The reverse-lookup slot should be held by the method that actually has a body (C++ decl/impl split).
253
+ * - Setting an implementation signature twice on different methods is anomalous and logged.
254
+ */
255
+ private registerImplModelWithArbitration;
256
+ /** @internal Whether this method belongs to a C++ file. Defensive against unresolved declaring class. */
257
+ private isCxxMethod;
258
+ /** @internal Get the formal MethodSigID of this method's implementation signature. Returns undefined for declare-only methods. */
259
+ getMethodSigID(): number | undefined;
260
+ /**
261
+ * Returns the unique ID of this model — the MethodSigID in the canonicalizer.
262
+ * The signature table and the model table share one dense ID space, so this ID
263
+ * resolves both the signature and the model.
264
+ *
265
+ * A method may be registered under multiple SigIDs (n:1: the implementation slot
266
+ * plus declaration slots all hold this model). This returns the ID of the
267
+ * signature {@link getSignature} would return — the implementation ID when set,
268
+ * otherwise the first declaration ID; 0 (the DEFAULT slot) when neither is set.
269
+ */
270
+ getId(): number;
202
271
  getSubSignature(): MethodSubSignature;
203
272
  getGenericTypes(): GenericType[] | undefined;
204
273
  isGenericsMethod(): boolean;
@@ -297,7 +366,24 @@ export declare class ArkMethod extends ArkBaseModel implements ArkExport {
297
366
  validate(): ArkError;
298
367
  matchMethodSignature(args: Value[]): MethodSignature;
299
368
  getOuterMethod(): ArkMethod | undefined;
369
+ /**
370
+ * @internal Sets the outer (enclosing) method of a nested function.
371
+ * Internally only the formal MethodSigID is stored; the outer method itself is resolved back via the method signature canonicalizer.
372
+ * @param method - The outer method of this nested method.
373
+ */
300
374
  setOuterMethod(method: ArkMethod): void;
375
+ /**
376
+ * @internal Register a class declared inside this method body, keyed by its bare source name.
377
+ * The class model itself is stored under the composed name (`Local$Outer-m`) at file/namespace
378
+ * top level; this map preserves the bare-name → ClassSigID scope binding. First registration
379
+ * wins (TS block-scoped shadowing is not modeled at this granularity).
380
+ */
381
+ registerLocalClass(bareName: string, classSigID: number): void;
382
+ /**
383
+ * @internal Get the ClassSigID of a class declared inside this method body by its bare name.
384
+ * Returns undefined when no such class is registered.
385
+ */
386
+ getLocalClassSigID(bareName: string): number | undefined;
301
387
  getFunctionLocal(name: string): Local | null;
302
388
  setQuestionToken(questionToken: boolean): void;
303
389
  getQuestionToken(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ArkMethod.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkMethod.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAc,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAgC,iBAAiB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAgB,WAAW,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAqC,OAAO,EAAc,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,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oBAAoB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,eAAe;IAmBpD,cAAc,IAAI,SAAS,GAAG,SAAS;IAO9C;;;;OAIG;IACI,cAAc,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAK9C;;;;;OAKG;IACI,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAYrE;;;OAGG;IACI,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIxD,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IAa5C,gBAAgB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI;IAQ9C,gBAAgB,IAAI,OAAO;IAK3B,QAAQ,IAAI,OAAO;IAgBnB,kBAAkB,IAAI,IAAI;CAapC"}
@@ -13,21 +13,48 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ var desc = Object.getOwnPropertyDescriptor(m, k);
19
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
+ }
22
+ Object.defineProperty(o, k2, desc);
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29
+ }) : function(o, v) {
30
+ o["default"] = v;
31
+ });
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
16
39
  Object.defineProperty(exports, "__esModule", { value: true });
17
40
  exports.ArkMethod = exports.arkMethodNodeKind = void 0;
18
41
  const Ref_1 = require("../base/Ref");
19
42
  const Stmt_1 = require("../base/Stmt");
20
43
  const Type_1 = require("../base/Type");
21
44
  const ArkClass_1 = require("./ArkClass");
45
+ const ArkSignature_1 = require("./ArkSignature");
22
46
  const ArkExport_1 = require("./ArkExport");
23
47
  const Const_1 = require("../common/Const");
24
48
  const Position_1 = require("../base/Position");
25
49
  const ArkBaseModel_1 = require("./ArkBaseModel");
26
50
  const ArkError_1 = require("../common/ArkError");
51
+ const SignatureCanonicalizerRegistry_1 = require("../common/SignatureCanonicalizerRegistry");
52
+ const ArkFile_1 = require("./ArkFile");
27
53
  const TSConst_1 = require("../common/TSConst");
28
- const StringUtils_1 = require("../common/StringUtils");
29
54
  const Type_2 = require("../../frontend/cppFrontend/base/Type");
30
55
  const ModelUtils_1 = require("../common/ModelUtils");
56
+ const logger_1 = __importStar(require("../../utils/logger"));
57
+ const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkMethod');
31
58
  exports.arkMethodNodeKind = [
32
59
  'MethodDeclaration',
33
60
  'Constructor',
@@ -44,8 +71,22 @@ exports.arkMethodNodeKind = [
44
71
  * @category core/model
45
72
  */
46
73
  class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
47
- constructor() {
74
+ constructor(declaringClassID, implementationSignature, declareSignatures, outerMethodSigID) {
48
75
  super();
76
+ /** @internal Formal ClassSigID for the declaring class. -1 = not yet interned. */
77
+ this.declaringClassID = -1;
78
+ if (declaringClassID !== undefined) {
79
+ this.declaringClassID = declaringClassID;
80
+ }
81
+ if (implementationSignature) {
82
+ this.setImplementationSignature(implementationSignature);
83
+ }
84
+ if (declareSignatures) {
85
+ this.setDeclareSignatures(declareSignatures);
86
+ }
87
+ if (outerMethodSigID !== undefined) {
88
+ this.outerMethodSigID = outerMethodSigID > 0 ? outerMethodSigID : undefined;
89
+ }
49
90
  }
50
91
  /**
51
92
  * Returns the program language of the file where this method defined.
@@ -71,14 +112,14 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
71
112
  return this.sourceCode;
72
113
  }
73
114
  if (this.implOriginFullPosition !== undefined) {
74
- const code = (0, StringUtils_1.extractSourceTextByFullPosition)(this.getDeclaringArkFile().getCode(), this.implOriginFullPosition);
115
+ const code = this.getDeclaringArkFile().getSourceTextByFullPosition(this.implOriginFullPosition);
75
116
  if (code !== undefined) {
76
117
  this.sourceCode = code;
77
118
  }
78
119
  return code;
79
120
  }
80
121
  if (this.declareOriginFullPositions && this.declareOriginFullPositions.length > 0) {
81
- const code = (0, StringUtils_1.extractSourceTextByFullPosition)(this.getDeclaringArkFile().getCode(), this.declareOriginFullPositions[0]);
122
+ const code = this.getDeclaringArkFile().getSourceTextByFullPosition(this.declareOriginFullPositions[0]);
82
123
  if (code !== undefined) {
83
124
  this.sourceCode = code;
84
125
  }
@@ -90,8 +131,7 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
90
131
  * @deprecated Source text is now stored on ArkFile only. This method has no effect.
91
132
  * @param _code - The source code (ignored).
92
133
  */
93
- setCode(_code) {
94
- }
134
+ setCode(_code) { }
95
135
  /**
96
136
  * @deprecated Since version 1.0.91. Use getDeclareOriginFullPositions().map(p => p.getFirstLine()) instead.
97
137
  * @returns null or the lines of the method's declarations with number type.
@@ -256,13 +296,32 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
256
296
  * @returns The declaring class of the method.
257
297
  */
258
298
  getDeclaringArkClass() {
259
- return this.declaringArkClass;
299
+ if (this.declaringClassID !== -1) {
300
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().classSigCanonicalizer.getModel(this.declaringClassID);
301
+ }
302
+ return undefined;
260
303
  }
304
+ /** @deprecated Use the ID-injecting constructor {@link constructor(declaringClassID, implementationSignature, declareSignatures, outerMethodSigID)}. */
261
305
  setDeclaringArkClass(declaringArkClass) {
262
- this.declaringArkClass = declaringArkClass;
306
+ this.declaringClassID = declaringArkClass.getClassSigID();
307
+ }
308
+ /** @internal Get the formal ClassSigID of the declaring class. Returns -1 if not interned. */
309
+ getDeclaringClassID() {
310
+ return this.declaringClassID;
311
+ }
312
+ /** @internal Get the formal MethodSigID of the outer method. Returns undefined if none. */
313
+ getOuterMethodSigID() {
314
+ return this.outerMethodSigID;
315
+ }
316
+ /** @internal Set the formal MethodSigID of the outer method directly. Non-positive IDs are treated as none. */
317
+ setOuterMethodSigID(sigID) {
318
+ this.outerMethodSigID = sigID > 0 ? sigID : undefined;
263
319
  }
264
320
  getDeclaringArkFile() {
265
- return this.declaringArkClass.getDeclaringArkFile();
321
+ return this.getDeclaringArkClass().getDeclaringArkFile();
322
+ }
323
+ getDeclaringArkFileID() {
324
+ return this.getDeclaringArkClass().getDeclaringFileID();
266
325
  }
267
326
  isDefaultArkMethod() {
268
327
  return this.getName() === Const_1.DEFAULT_ARK_METHOD_NAME;
@@ -279,11 +338,27 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
279
338
  /**
280
339
  * Get all declare signatures.
281
340
  * The results could be null if there is no seperated declaration of the method.
341
+ * Note: the returned array is a rebuilt copy; mutating it does not affect the internal storage.
282
342
  * @returns null or the method declare signatures.
283
343
  */
284
344
  getDeclareSignatures() {
285
- var _a;
286
- return (_a = this.declareSignatures) !== null && _a !== void 0 ? _a : null;
345
+ const ids = this.declareSigIDs;
346
+ if (ids === undefined) {
347
+ return null;
348
+ }
349
+ const canonicalizer = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().methodSigCanonicalizer;
350
+ const result = [];
351
+ for (const id of ids) {
352
+ const sig = canonicalizer.get(id);
353
+ if (sig !== undefined) {
354
+ result.push(sig);
355
+ }
356
+ }
357
+ return result.length > 0 ? result : null;
358
+ }
359
+ /** @internal Get the formal MethodSigIDs of the declaration signatures. Returns undefined if none. */
360
+ getDeclareSigIDs() {
361
+ return this.declareSigIDs;
287
362
  }
288
363
  /**
289
364
  * Get the index of the matched method declare signature among all declare signatures.
@@ -292,8 +367,8 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
292
367
  * @returns -1 or the index of the matched signature.
293
368
  */
294
369
  getDeclareSignatureIndex(targetSignature) {
295
- let declareSignatures = this.declareSignatures;
296
- if (declareSignatures === undefined) {
370
+ const declareSignatures = this.getDeclareSignatures();
371
+ if (declareSignatures === null) {
297
372
  return -1;
298
373
  }
299
374
  for (let i = 0; i < declareSignatures.length; i++) {
@@ -310,7 +385,10 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
310
385
  */
311
386
  getImplementationSignature() {
312
387
  var _a;
313
- return (_a = this.implSignature) !== null && _a !== void 0 ? _a : null;
388
+ if (this.implementSigID === undefined) {
389
+ return null;
390
+ }
391
+ return (_a = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().methodSigCanonicalizer.get(this.implementSigID)) !== null && _a !== void 0 ? _a : null;
314
392
  }
315
393
  /**
316
394
  * Get the method signature of the implementation or the first declaration if there is no implementation.
@@ -319,17 +397,18 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
319
397
  * - Class Signature: indicates which class this method belong to.
320
398
  * - Method SubSignature: indicates the detail info of this method such as method name, parameters, returnType, etc.
321
399
  * @returns The method signature.
322
- * @example
323
- * 1. Get the signature of method mtd.
324
-
325
- ```typescript
326
- let signature = mtd.getSignature();
327
- // ... ...
328
- ```
329
400
  */
330
401
  getSignature() {
331
- var _a;
332
- return (_a = this.implSignature) !== null && _a !== void 0 ? _a : this.declareSignatures[0];
402
+ const impl = this.getImplementationSignature();
403
+ if (impl !== null) {
404
+ return impl;
405
+ }
406
+ const declares = this.getDeclareSignatures();
407
+ if (declares !== null && declares.length > 0) {
408
+ return declares[0];
409
+ }
410
+ logger.error(`A method (SigID=${this.getMethodSigID()}) has neither an implementation nor a declaration signature; returning DEFAULT.`);
411
+ return ArkSignature_1.MethodSignature.DEFAULT;
333
412
  }
334
413
  /**
335
414
  * Set signatures of all declarations.
@@ -337,12 +416,15 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
337
416
  * @param signatures - one signature or a list of signatures.
338
417
  */
339
418
  setDeclareSignatures(signatures) {
340
- if (Array.isArray(signatures)) {
341
- this.declareSignatures = signatures;
342
- }
343
- else {
344
- this.declareSignatures = [signatures];
419
+ const sigList = Array.isArray(signatures) ? signatures : [signatures];
420
+ const canonicalizer = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().methodSigCanonicalizer;
421
+ // Only intern here; the model is registered when the method is added to a class(ArkClass.addMethod).
422
+ // Eager registration would overwrite the model of the previously added same-signature method while builders still need to read it for merging.
423
+ const ids = [];
424
+ for (const sig of sigList) {
425
+ ids.push(canonicalizer.getOrCreateId(sig));
345
426
  }
427
+ this.declareSigIDs = ids;
346
428
  }
347
429
  /**
348
430
  * Reset signature of one declaration with the specified index.
@@ -351,10 +433,13 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
351
433
  * @param index - index of signature want to set.
352
434
  */
353
435
  setDeclareSignatureWithIndex(signature, index) {
354
- if (this.declareSignatures === undefined || this.declareSignatures.length <= index) {
436
+ if (this.declareSigIDs === undefined || this.declareSigIDs.length <= index) {
355
437
  return;
356
438
  }
357
- this.declareSignatures[index] = signature;
439
+ // Only intern here; the model registration stays with ArkClass.addMethod (see setDeclareSignatures).
440
+ const canonicalizer = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().methodSigCanonicalizer;
441
+ const id = canonicalizer.getOrCreateId(signature);
442
+ this.declareSigIDs[index] = id;
358
443
  }
359
444
  /**
360
445
  * Set signature of implementation.
@@ -362,7 +447,100 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
362
447
  * @param signature - signature of implementation.
363
448
  */
364
449
  setImplementationSignature(signature) {
365
- this.implSignature = signature;
450
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
451
+ const canonicalizer = reg.methodSigCanonicalizer;
452
+ const id = canonicalizer.getOrCreateId(signature);
453
+ this.implementSigID = id;
454
+ this.refreshCanonicalParameterNames(canonicalizer, id, signature);
455
+ this.registerImplModelWithArbitration(canonicalizer, id);
456
+ }
457
+ /**
458
+ * @internal Refresh the implementation-side parameter names onto the canonical signature.
459
+ *
460
+ * Parameter names are not part of signature identity (hash/equals/toString use parameter
461
+ * types only), so a declaration and an implementation with differing parameter names share
462
+ * one canonical instance — whichever interned first. The implementation is the authority
463
+ * for body-local generation (`prebuildStmts` reads `getParameters()` through the canonical
464
+ * instance), so when an implementation signature carries different parameter names than the
465
+ * canonical instance, the canonical parameter list is replaced with the implementation's.
466
+ */
467
+ refreshCanonicalParameterNames(canonicalizer, id, implSignature) {
468
+ const canonical = canonicalizer.get(id);
469
+ if (canonical === undefined || canonical === implSignature) {
470
+ return;
471
+ }
472
+ const canonicalParams = canonical.getMethodSubSignature().getParameters();
473
+ const implParams = implSignature.getMethodSubSignature().getParameters();
474
+ const namesDiffer = canonicalParams.length !== implParams.length || canonicalParams.some((p, i) => p.getName() !== implParams[i].getName());
475
+ if (namesDiffer) {
476
+ canonical.getMethodSubSignature().setParameters(implParams);
477
+ }
478
+ }
479
+ /**
480
+ * @internal Register this method as the model of the given implementation SigID, with arbitration:
481
+ * - Sibling methods of the same declaring class never overwrite each other's registration:
482
+ * builders merge same-signature overloads/declarations by reading the previously added
483
+ * method through the canonicalizer, and the final winner is registered by ArkClass.addMethod.
484
+ * - The reverse-lookup slot should be held by the method that actually has a body (C++ decl/impl split).
485
+ * - Setting an implementation signature twice on different methods is anomalous and logged.
486
+ */
487
+ registerImplModelWithArbitration(canonicalizer, id) {
488
+ const existing = canonicalizer.getModel(id);
489
+ if (existing !== undefined && existing !== this) {
490
+ if (this.declaringClassID > 0 && this.declaringClassID === existing.getDeclaringClassID()) {
491
+ return;
492
+ }
493
+ const existingHasBody = existing.getBody() !== undefined;
494
+ const thisHasBody = this.getBody() !== undefined;
495
+ if (this.isCxxMethod()) {
496
+ if (existingHasBody && !thisHasBody) {
497
+ // C++ decl/impl split: the declaration borrows the impl signature. Keep the
498
+ // body-holding implementation in the reverse-lookup slot.
499
+ return;
500
+ }
501
+ if (existingHasBody && thisHasBody) {
502
+ logger.error(`Duplicate method (SigID=${this.getMethodSigID()}), the latter wins.`);
503
+ }
504
+ }
505
+ else {
506
+ logger.error(`Implementation signature (SigID=${this.getMethodSigID()}) is set twice, the latter wins.`);
507
+ }
508
+ }
509
+ canonicalizer.setModel(id, this);
510
+ }
511
+ /** @internal Whether this method belongs to a C++ file. Defensive against unresolved declaring class. */
512
+ isCxxMethod() {
513
+ if (this.declaringClassID <= 0) {
514
+ return false;
515
+ }
516
+ const cls = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().classSigCanonicalizer.getModel(this.declaringClassID);
517
+ if (cls === undefined) {
518
+ return false;
519
+ }
520
+ return cls.getLanguage() === ArkFile_1.Language.CXX;
521
+ }
522
+ /** @internal Get the formal MethodSigID of this method's implementation signature. Returns undefined for declare-only methods. */
523
+ getMethodSigID() {
524
+ return this.implementSigID;
525
+ }
526
+ /**
527
+ * Returns the unique ID of this model — the MethodSigID in the canonicalizer.
528
+ * The signature table and the model table share one dense ID space, so this ID
529
+ * resolves both the signature and the model.
530
+ *
531
+ * A method may be registered under multiple SigIDs (n:1: the implementation slot
532
+ * plus declaration slots all hold this model). This returns the ID of the
533
+ * signature {@link getSignature} would return — the implementation ID when set,
534
+ * otherwise the first declaration ID; 0 (the DEFAULT slot) when neither is set.
535
+ */
536
+ getId() {
537
+ if (this.implementSigID !== undefined) {
538
+ return this.implementSigID;
539
+ }
540
+ if (this.declareSigIDs !== undefined && this.declareSigIDs.length > 0) {
541
+ return this.declareSigIDs[0];
542
+ }
543
+ return 0;
366
544
  }
367
545
  getSubSignature() {
368
546
  return this.getSignature().getMethodSubSignature();
@@ -635,11 +813,11 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
635
813
  errMsg: 'methodSignature and originFullPosition are not matched.',
636
814
  };
637
815
  }
638
- return this.validateFields(['declaringArkClass']);
816
+ return this.validateFields(['declaringClassID']);
639
817
  }
640
818
  matchMethodSignature(args) {
641
819
  var _a, _b, _c;
642
- const signatures = (_a = this.declareSignatures) === null || _a === void 0 ? void 0 : _a.filter((f) => {
820
+ const signatures = (_a = this.getDeclareSignatures()) === null || _a === void 0 ? void 0 : _a.filter((f) => {
643
821
  const parameters = f.getMethodSubSignature().getParameters();
644
822
  const max = parameters.length;
645
823
  let min = 0;
@@ -651,10 +829,44 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
651
829
  return ((_c = (_b = signatures === null || signatures === void 0 ? void 0 : signatures.find((p) => ModelUtils_1.ModelUtils.isMatched(p.getMethodSubSignature().getParameters(), args, this.getDeclaringArkFile().getScene()))) !== null && _b !== void 0 ? _b : signatures === null || signatures === void 0 ? void 0 : signatures[0]) !== null && _c !== void 0 ? _c : this.getSignature());
652
830
  }
653
831
  getOuterMethod() {
654
- return this.outerMethod;
832
+ if (this.outerMethodSigID !== undefined) {
833
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().methodSigCanonicalizer.getModel(this.outerMethodSigID);
834
+ }
835
+ return undefined;
655
836
  }
837
+ /**
838
+ * @internal Sets the outer (enclosing) method of a nested function.
839
+ * Internally only the formal MethodSigID is stored; the outer method itself is resolved back via the method signature canonicalizer.
840
+ * @param method - The outer method of this nested method.
841
+ */
656
842
  setOuterMethod(method) {
657
- this.outerMethod = method;
843
+ const id = method.getMethodSigID();
844
+ this.outerMethodSigID = id !== undefined && id > 0 ? id : undefined;
845
+ }
846
+ /**
847
+ * @internal Register a class declared inside this method body, keyed by its bare source name.
848
+ * The class model itself is stored under the composed name (`Local$Outer-m`) at file/namespace
849
+ * top level; this map preserves the bare-name → ClassSigID scope binding. First registration
850
+ * wins (TS block-scoped shadowing is not modeled at this granularity).
851
+ */
852
+ registerLocalClass(bareName, classSigID) {
853
+ if (!bareName || classSigID <= 0) {
854
+ return;
855
+ }
856
+ if (!this.localClassSigIDs) {
857
+ this.localClassSigIDs = new Map();
858
+ }
859
+ if (!this.localClassSigIDs.has(bareName)) {
860
+ this.localClassSigIDs.set(bareName, classSigID);
861
+ }
862
+ }
863
+ /**
864
+ * @internal Get the ClassSigID of a class declared inside this method body by its bare name.
865
+ * Returns undefined when no such class is registered.
866
+ */
867
+ getLocalClassSigID(bareName) {
868
+ var _a;
869
+ return (_a = this.localClassSigIDs) === null || _a === void 0 ? void 0 : _a.get(bareName);
658
870
  }
659
871
  getFunctionLocal(name) {
660
872
  var _a;
@@ -701,10 +913,11 @@ class ArkMethod extends ArkBaseModel_1.ArkBaseModel {
701
913
  this.clearBodyAndSupplementary();
702
914
  this.freeBodyBuilder();
703
915
  this.freeCxxBodyBuilder();
704
- this.declaringArkClass = undefined;
705
- this.outerMethod = undefined;
706
- this.declareSignatures = undefined;
707
- this.implSignature = undefined;
916
+ this.declaringClassID = -1;
917
+ this.outerMethodSigID = undefined;
918
+ this.declareSigIDs = undefined;
919
+ this.implementSigID = undefined;
920
+ this.localClassSigIDs = undefined;
708
921
  }
709
922
  }
710
923
  exports.ArkMethod = ArkMethod;
@@ -80,7 +80,7 @@ export declare class ArkModule {
80
80
  setModulePath(modulePath: string): void;
81
81
  getModuleName(): string;
82
82
  setModuleName(moduleName: string): void;
83
- getFilesMap(): Map<string, ArkFile>;
83
+ getFilesMap(): Map<number, ArkFile>;
84
84
  getLoadState(): ModuleLoadState;
85
85
  setLoadState(state: ModuleLoadState): void;
86
86
  getModuleType(): ModuleType;
@@ -219,7 +219,7 @@ class ArkModule {
219
219
  }
220
220
  // --- File management ---
221
221
  addFile(arkFile) {
222
- this.filesMap.set(arkFile.getFileSignature().toMapKey(), arkFile);
222
+ this.filesMap.set(arkFile.getFileSigID(), arkFile);
223
223
  }
224
224
  clearFilesMap() {
225
225
  this.filesMap.clear();