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
@@ -13,24 +13,53 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
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;
18
38
  };
19
39
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.genSignature4ImportClause = exports.fileSignatureCompare = exports.classSignatureCompare = exports.methodSubSignatureCompare = exports.methodSignatureCompare = exports.fieldSignatureCompare = exports.AliasTypeSignature = exports.LocalSignature = exports.MethodSignature = exports.MethodSubSignature = exports.FieldSignature = exports.AliasClassSignature = exports.ClassSignature = exports.NamespaceSignature = exports.FileSignature = void 0;
21
- const path_1 = __importDefault(require("path"));
40
+ exports.genSignature4ImportClause = exports.fileSignatureCompare = exports.classSignatureCompare = exports.methodSubSignatureCompare = exports.methodSignatureCompare = exports.fieldSignatureCompare = exports.AliasTypeSignature = exports.LocalSignature = exports.MethodSignature = exports.MethodSubSignature = exports.FieldSignature = exports.internAliasMethodSignature = exports.AliasClassSignature = exports.ClassSignature = exports.NamespaceSignature = exports.FileSignature = void 0;
22
41
  const pathTransfer_1 = require("../../utils/pathTransfer");
23
42
  const Type_1 = require("../base/Type");
24
43
  const Const_1 = require("../common/Const");
25
- const crypto_utils_1 = require("../../utils/crypto_utils");
44
+ const SignatureCanonicalizerRegistry_1 = require("../common/SignatureCanonicalizerRegistry");
45
+ const SignatureCanonicalizer_1 = require("../common/SignatureCanonicalizer");
46
+ const HashUtils_1 = require("../../utils/HashUtils");
47
+ const logger_1 = __importStar(require("../../utils/logger"));
26
48
  /**
27
49
  * @category core/model
28
50
  */
29
51
  class FileSignature {
52
+ /** The canonical DEFAULT signature (formal sigID 0 in the registry). */
53
+ static get DEFAULT() {
54
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().fileSigCanonicalizer.get(0);
55
+ }
30
56
  constructor(projectName, fileName) {
31
57
  this.projectName = projectName;
32
58
  this.fileName = (0, pathTransfer_1.transfer2UnixPath)(fileName);
33
- this.hashcode = crypto_utils_1.CryptoUtils.hashcode(this.toString());
59
+ let h = 0xdeadbeef;
60
+ h = (0, HashUtils_1.hashCombineU32)(h, (0, HashUtils_1.hashString32)(this.projectName));
61
+ h = (0, HashUtils_1.hashCombineU32)(h, (0, HashUtils_1.hashString32)(this.fileName));
62
+ this.hashCode = h >>> 0;
34
63
  }
35
64
  getProjectName() {
36
65
  return this.projectName;
@@ -41,65 +70,245 @@ class FileSignature {
41
70
  toString() {
42
71
  return `@${this.projectName}/${this.fileName}: `;
43
72
  }
73
+ /**
74
+ * @deprecated No longer used internally since the ID refactor: identity comparison
75
+ * uses {@link signatureEquals} (hash + equals), indexing uses the canonicalizer.
76
+ * Kept for backward compatibility only — for identity checks use `equals()`
77
+ * (with `getHashCode()` fast reject), for debug output use `toString()`.
78
+ *
79
+ * Implementation note: identity projection (= toString, projectName + fileName are the complete identity fields) — collision-free.
80
+ */
44
81
  toMapKey() {
45
- return `${this.hashcode}${path_1.default.basename(this.fileName)}`;
82
+ return this.toString();
83
+ }
84
+ getHashCode() {
85
+ return this.hashCode;
86
+ }
87
+ equals(other) {
88
+ if (this === other) {
89
+ return true;
90
+ }
91
+ return this.projectName === other.projectName && this.fileName === other.fileName;
92
+ }
93
+ /** @internal FileSignature is never unclear (it is the identity root). */
94
+ isUnclear() {
95
+ return false;
46
96
  }
47
97
  }
48
98
  exports.FileSignature = FileSignature;
49
- FileSignature.DEFAULT = new FileSignature(Const_1.UNKNOWN_PROJECT_NAME, Const_1.UNKNOWN_FILE_NAME);
50
99
  class NamespaceSignature {
51
- constructor(namespaceName, declaringFileSignature, declaringNamespaceSignature = null) {
100
+ /** The canonical DEFAULT signature (formal sigID 0 in the registry). */
101
+ static get DEFAULT() {
102
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().namespaceSigCanonicalizer.get(0);
103
+ }
104
+ constructor(namespaceName, declaringFileOrID, declaringNSOrID) {
105
+ function computeHashCode(fileId, namespaceName, declaringNSId) {
106
+ let h = 0xdeadbeef;
107
+ h = (0, HashUtils_1.hashCombineU32)(h, fileId);
108
+ h = (0, HashUtils_1.hashCombineU32)(h, (0, HashUtils_1.hashString32)(namespaceName));
109
+ h = (0, HashUtils_1.hashCombineU32)(h, declaringNSId !== null && declaringNSId !== void 0 ? declaringNSId : 0);
110
+ return h >>> 0;
111
+ }
52
112
  this.namespaceName = namespaceName;
53
- this.declaringFileSignature = declaringFileSignature;
54
- this.declaringNamespaceSignature = declaringNamespaceSignature;
113
+ if (typeof declaringFileOrID === 'number') {
114
+ this.declaringFileSigID = declaringFileOrID;
115
+ this.declaringNamespaceSigID = typeof declaringNSOrID === 'number' ? declaringNSOrID : undefined;
116
+ this.hashCode = computeHashCode(this.declaringFileSigID, this.namespaceName, this.declaringNamespaceSigID);
117
+ return;
118
+ }
119
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
120
+ let fileSigID;
121
+ let nsSigID;
122
+ // FileSignature 永不 unclear——身份根。
123
+ const fileExistingId = reg.fileSigCanonicalizer.getExistingId(declaringFileOrID);
124
+ if (fileExistingId !== -1) {
125
+ fileSigID = fileExistingId;
126
+ }
127
+ else {
128
+ NamespaceSignature.logger.error(`Clear FileSignature declaring not interned — defaulting to ID 0: ${declaringFileOrID.toString()}`);
129
+ fileSigID = 0;
130
+ }
131
+ // namespace 无 temp 空间。
132
+ if (declaringNSOrID instanceof NamespaceSignature) {
133
+ if (declaringNSOrID.isUnclear()) {
134
+ NamespaceSignature.logger.error(`Unclear NamespaceSignature — marking -1: ${declaringNSOrID.toString()}`);
135
+ nsSigID = -1;
136
+ }
137
+ else {
138
+ const nsExistingId = reg.namespaceSigCanonicalizer.getExistingId(declaringNSOrID);
139
+ if (nsExistingId !== -1) {
140
+ nsSigID = nsExistingId;
141
+ }
142
+ else {
143
+ NamespaceSignature.logger.error(`Clear NamespaceSignature declaring not interned — marking -1: ${declaringNSOrID.toString()}`);
144
+ nsSigID = -1;
145
+ }
146
+ }
147
+ }
148
+ this.declaringFileSigID = fileSigID;
149
+ this.declaringNamespaceSigID = nsSigID;
150
+ this.hashCode = computeHashCode(this.declaringFileSigID, this.namespaceName, this.declaringNamespaceSigID);
55
151
  }
56
152
  getNamespaceName() {
57
153
  return this.namespaceName;
58
154
  }
155
+ /** @internal Get the formal NamespaceSigID of this signature (interning it if needed). */
156
+ getNamespaceSigID() {
157
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().namespaceSigCanonicalizer.getExistingId(this);
158
+ }
59
159
  getDeclaringFileSignature() {
60
- return this.declaringFileSignature;
160
+ const sig = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().fileSigCanonicalizer.get(this.declaringFileSigID);
161
+ if (sig !== undefined) {
162
+ return sig;
163
+ }
164
+ // Stale SigID (registry disposed and rebuilt): degrade to DEFAULT instead of crashing.
165
+ NamespaceSignature.logger.error(`NamespaceSignature '${this.namespaceName}' has a stale declaring file SigID ${this.declaringFileSigID}; returning DEFAULT.`);
166
+ return FileSignature.DEFAULT;
167
+ }
168
+ /** @internal Get the formal FileSigID of the declaring file. (Renamed from
169
+ * getDeclaringFileSigId to align the casing with ClassSignature/getFileSigID.) */
170
+ getDeclaringFileSigID() {
171
+ return this.declaringFileSigID;
172
+ }
173
+ /** @internal Get the formal NamespaceSigID of the declaring namespace. undefined = top-level. */
174
+ getDeclaringNamespaceSigID() {
175
+ return this.declaringNamespaceSigID;
61
176
  }
62
177
  getDeclaringNamespaceSignature() {
63
- return this.declaringNamespaceSignature;
178
+ if (this.declaringNamespaceSigID === undefined) {
179
+ return null;
180
+ }
181
+ const sig = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().namespaceSigCanonicalizer.get(this.declaringNamespaceSigID);
182
+ if (sig !== undefined) {
183
+ return sig;
184
+ }
185
+ // Stale SigID (registry disposed and rebuilt): degrade to DEFAULT instead of crashing.
186
+ NamespaceSignature.logger.error(`NamespaceSignature '${this.namespaceName}' has a stale declaring namespace SigID ${this.declaringNamespaceSigID}; returning DEFAULT.`);
187
+ return NamespaceSignature.DEFAULT;
64
188
  }
65
189
  toString() {
66
- if (this.declaringNamespaceSignature) {
67
- return this.declaringNamespaceSignature.toString() + '.' + this.namespaceName;
68
- }
69
- else {
70
- return this.declaringFileSignature.toString() + this.namespaceName;
190
+ const declaringNS = this.getDeclaringNamespaceSignature();
191
+ if (declaringNS !== null) {
192
+ return declaringNS.toString() + '.' + this.namespaceName;
71
193
  }
194
+ return this.getDeclaringFileSignature().toString() + this.namespaceName;
72
195
  }
196
+ /**
197
+ * @deprecated No longer used internally since the ID refactor: identity comparison
198
+ * uses {@link signatureEquals} (hash + equals), indexing uses the canonicalizer.
199
+ * Kept for backward compatibility only — for identity checks use `equals()`
200
+ * (with `getHashCode()` fast reject), for debug output use `toString()`.
201
+ */
73
202
  toMapKey() {
74
- if (this.declaringNamespaceSignature) {
75
- return this.declaringNamespaceSignature.toMapKey() + '.' + this.namespaceName;
203
+ const declaringNS = this.getDeclaringNamespaceSignature();
204
+ if (declaringNS !== null) {
205
+ return declaringNS.toMapKey() + '.' + this.namespaceName;
76
206
  }
77
- else {
78
- return this.declaringFileSignature.toMapKey() + this.namespaceName;
207
+ return this.getDeclaringFileSignature().toMapKey() + this.namespaceName;
208
+ }
209
+ getHashCode() {
210
+ return this.hashCode;
211
+ }
212
+ equals(other) {
213
+ if (this === other) {
214
+ return true;
79
215
  }
216
+ if (this.namespaceName !== other.namespaceName) {
217
+ return false;
218
+ }
219
+ if (this.declaringFileSigID !== other.declaringFileSigID) {
220
+ return false;
221
+ }
222
+ return this.declaringNamespaceSigID === other.declaringNamespaceSigID;
223
+ }
224
+ /** Whether this signature's declaring file is unknown (FileSignature.DEFAULT). */
225
+ isUnclear() {
226
+ return this.declaringFileSigID === 0 && this.namespaceName !== Const_1.UNKNOWN_NAMESPACE_NAME;
80
227
  }
81
228
  }
82
229
  exports.NamespaceSignature = NamespaceSignature;
83
- NamespaceSignature.DEFAULT = new NamespaceSignature(Const_1.UNKNOWN_NAMESPACE_NAME, FileSignature.DEFAULT, null);
230
+ NamespaceSignature.logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'NamespaceSignature');
84
231
  class ClassSignature {
85
- constructor(className, declaringFileSignature, declaringNamespaceSignature = null) {
232
+ /** The canonical DEFAULT signature (formal sigID 0 in the registry). */
233
+ static get DEFAULT() {
234
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().classSigCanonicalizer.get(0);
235
+ }
236
+ constructor(className, declaringFileOrID, declaringNSOrID) {
86
237
  this.className = className;
87
- this.declaringFileSignature = declaringFileSignature;
88
- this.declaringNamespaceSignature = declaringNamespaceSignature;
238
+ if (typeof declaringFileOrID === 'number') {
239
+ this.declaringFileSigID = declaringFileOrID;
240
+ this.declaringNamespaceSigID = typeof declaringNSOrID === 'number' ? declaringNSOrID : undefined;
241
+ this.recomputeHashCode();
242
+ return;
243
+ }
244
+ let fileSigID;
245
+ let nsSigID;
246
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
247
+ // FileSignature 永不 unclear——身份根。
248
+ const fileExistingId = reg.fileSigCanonicalizer.getExistingId(declaringFileOrID);
249
+ if (fileExistingId !== -1) {
250
+ fileSigID = fileExistingId;
251
+ }
252
+ else {
253
+ ClassSignature.logger.error(`Clear FileSignature declaring not interned — defaulting to ID 0: ${declaringFileOrID.toString()}`);
254
+ fileSigID = 0;
255
+ }
256
+ // namespace 无 temp 空间。
257
+ if (declaringNSOrID instanceof NamespaceSignature) {
258
+ if (declaringNSOrID.isUnclear()) {
259
+ nsSigID = -1;
260
+ }
261
+ else {
262
+ const nsExistingId = reg.namespaceSigCanonicalizer.getExistingId(declaringNSOrID);
263
+ if (nsExistingId !== -1) {
264
+ nsSigID = nsExistingId;
265
+ }
266
+ else {
267
+ ClassSignature.logger.error(`Clear NamespaceSignature declaring not interned — marking -1: ${declaringNSOrID.toString()}`);
268
+ nsSigID = -1;
269
+ }
270
+ }
271
+ }
272
+ this.declaringFileSigID = fileSigID;
273
+ this.declaringNamespaceSigID = nsSigID;
274
+ this.recomputeHashCode();
89
275
  }
90
276
  /**
91
277
  * Returns the declaring file signature.
92
278
  * @returns The declaring file signature.
93
279
  */
94
280
  getDeclaringFileSignature() {
95
- return this.declaringFileSignature;
281
+ const sig = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().fileSigCanonicalizer.get(this.declaringFileSigID);
282
+ if (sig !== undefined) {
283
+ return sig;
284
+ }
285
+ // Stale SigID (registry disposed and rebuilt): degrade to DEFAULT instead of crashing.
286
+ ClassSignature.logger.error(`ClassSignature '${this.className}' has a stale declaring file SigID ${this.declaringFileSigID}; returning DEFAULT.`);
287
+ return FileSignature.DEFAULT;
96
288
  }
97
289
  /**
98
290
  * Get the declaring namespace's signature.
99
291
  * @returns the declaring namespace's signature.
100
292
  */
101
293
  getDeclaringNamespaceSignature() {
102
- return this.declaringNamespaceSignature;
294
+ if (this.declaringNamespaceSigID === undefined) {
295
+ return null;
296
+ }
297
+ const sig = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().namespaceSigCanonicalizer.get(this.declaringNamespaceSigID);
298
+ if (sig !== undefined) {
299
+ return sig;
300
+ }
301
+ // Stale SigID (registry disposed and rebuilt): degrade to DEFAULT instead of crashing.
302
+ ClassSignature.logger.error(`ClassSignature '${this.className}' has a stale declaring namespace SigID ${this.declaringNamespaceSigID}; returning DEFAULT.`);
303
+ return NamespaceSignature.DEFAULT;
304
+ }
305
+ /** @internal Get the formal FileSigID of the declaring file. */
306
+ getDeclaringFileSigID() {
307
+ return this.declaringFileSigID;
308
+ }
309
+ /** @internal Get the formal NamespaceSigID of the declaring namespace. Returns undefined for top-level classes. */
310
+ getDeclaringNamespaceSigID() {
311
+ return this.declaringNamespaceSigID;
103
312
  }
104
313
  /**
105
314
  * Get the **string** name of class from the the class signature. The default value is `""`.
@@ -108,6 +317,34 @@ class ClassSignature {
108
317
  getClassName() {
109
318
  return this.className;
110
319
  }
320
+ /** @internal Recompute the cached hash from the current parts (constructor and probe). */
321
+ recomputeHashCode() {
322
+ var _a;
323
+ let h = 0xdeadbeef;
324
+ h = (0, HashUtils_1.hashCombineU32)(h, this.declaringFileSigID);
325
+ h = (0, HashUtils_1.hashCombineU32)(h, (0, HashUtils_1.hashString32)(this.className));
326
+ h = (0, HashUtils_1.hashCombineU32)(h, (_a = this.declaringNamespaceSigID) !== null && _a !== void 0 ? _a : 0);
327
+ this.hashCode = h >>> 0;
328
+ }
329
+ /**
330
+ * @internal Shared mutable probe for existence-check lookups (getClassWithName and
331
+ * friends), which built a throwaway ClassSignature - object plus string hash - on every
332
+ * probe (~1.5GB per full build). Consume the result in a single expression: the next
333
+ * probe call rewrites the parts. Never store or intern the returned instance.
334
+ */
335
+ static probe(className, declaringFileSigID, declaringNamespaceSigID) {
336
+ let p = ClassSignature.probeInstance;
337
+ if (p === undefined) {
338
+ p = new ClassSignature(className, declaringFileSigID, declaringNamespaceSigID);
339
+ ClassSignature.probeInstance = p;
340
+ return p;
341
+ }
342
+ p.className = className;
343
+ p.declaringFileSigID = declaringFileSigID;
344
+ p.declaringNamespaceSigID = declaringNamespaceSigID;
345
+ p.recomputeHashCode();
346
+ return p;
347
+ }
111
348
  /**
112
349
  *
113
350
  * @returns The name of the declare class.
@@ -122,6 +359,11 @@ class ClassSignature {
122
359
  }
123
360
  return this.className;
124
361
  }
362
+ /**
363
+ * @deprecated Mutating the class name breaks the cached hash (the signature would intern
364
+ * to a different SigID than a freshly built one with the new name). Build a new
365
+ * ClassSignature instead.
366
+ */
125
367
  setClassName(className) {
126
368
  this.className = className;
127
369
  }
@@ -129,31 +371,82 @@ class ClassSignature {
129
371
  return new Type_1.ClassType(this);
130
372
  }
131
373
  toString() {
132
- if (this.declaringNamespaceSignature) {
133
- return this.declaringNamespaceSignature.toString() + '.' + this.className;
134
- }
135
- else {
136
- return this.declaringFileSignature.toString() + this.className;
374
+ const declaringNS = this.getDeclaringNamespaceSignature();
375
+ if (declaringNS !== null) {
376
+ return declaringNS.toString() + '.' + this.getClassName();
137
377
  }
378
+ return this.getDeclaringFileSignature().toString() + this.getClassName();
138
379
  }
380
+ /**
381
+ * @deprecated No longer used internally since the ID refactor: identity comparison
382
+ * uses {@link signatureEquals} (hash + equals), indexing uses the canonicalizer.
383
+ * Kept for backward compatibility only — for identity checks use `equals()`
384
+ * (with `getHashCode()` fast reject), for debug output use `toString()`.
385
+ */
139
386
  toMapKey() {
140
- if (this.declaringNamespaceSignature) {
141
- return this.declaringNamespaceSignature.toMapKey() + '.' + this.className;
387
+ const declaringNS = this.getDeclaringNamespaceSignature();
388
+ if (declaringNS !== null) {
389
+ return declaringNS.toMapKey() + '.' + this.getClassName();
142
390
  }
143
- else {
144
- return this.declaringFileSignature.toMapKey() + this.className;
391
+ return this.getDeclaringFileSignature().toMapKey() + this.getClassName();
392
+ }
393
+ getHashCode() {
394
+ return this.hashCode;
395
+ }
396
+ equals(other) {
397
+ if (this === other) {
398
+ return true;
145
399
  }
400
+ // display 归一化:alias 与任何普通签名值不等——alias 的身份含 aliasName 维度(见 AliasClassSignature.equals)。对称性由子类 equals 对非
401
+ // alias 返回 false 共同保证。
402
+ if (other instanceof AliasClassSignature) {
403
+ return false;
404
+ }
405
+ if (this.className !== other.className) {
406
+ return false;
407
+ }
408
+ if (this.declaringFileSigID !== other.declaringFileSigID) {
409
+ return false;
410
+ }
411
+ return this.declaringNamespaceSigID === other.declaringNamespaceSigID;
412
+ }
413
+ /**
414
+ * @internal Whether this signature's declaring file is unknown (FileSignature.DEFAULT).
415
+ * Direct field check (no registry lookup): unclear iff declaring file is DEFAULT (FileSigID 0)
416
+ * and this is not the DEFAULT placeholder itself (distinguished by the '%unk' name).
417
+ * This is a hot path in Method/FieldSignature constructor temp/formal branching.
418
+ */
419
+ isUnclear() {
420
+ return this.declaringFileSigID === 0 && this.className !== Const_1.UNKNOWN_CLASS_NAME;
146
421
  }
147
422
  }
148
423
  exports.ClassSignature = ClassSignature;
149
- ClassSignature.DEFAULT = new ClassSignature(Const_1.UNKNOWN_CLASS_NAME, FileSignature.DEFAULT, null);
424
+ ClassSignature.logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ClassSignature');
150
425
  /**
151
426
  * `AliasClassSignature` is used to extend `ClassSignature`, preserving the actual name used during invocation.
152
427
  */
153
428
  class AliasClassSignature extends ClassSignature {
154
429
  constructor(aliasName, signature) {
155
- super(signature.getClassName(), signature.getDeclaringFileSignature(), signature.getDeclaringNamespaceSignature());
430
+ var _a;
431
+ super(signature.getClassName(), signature.getDeclaringFileSigID(), signature.getDeclaringNamespaceSigID());
156
432
  this.aliasName = aliasName;
433
+ let h = 0xdeadbeef;
434
+ h = (0, HashUtils_1.hashCombineU32)(h, this.getDeclaringFileSigID());
435
+ h = (0, HashUtils_1.hashCombineU32)(h, (0, HashUtils_1.hashString32)(aliasName));
436
+ h = (0, HashUtils_1.hashCombineU32)(h, (_a = this.getDeclaringNamespaceSigID()) !== null && _a !== void 0 ? _a : 0);
437
+ this.aliasHashCode = h >>> 0;
438
+ // formal 直存 + 双注册 origin model。前置:origin 必已在 formal(两个产生点
439
+ // ——组件 pop 构建、Interface 替换——的前提都是真实类已注册);origin model
440
+ // 缺失时 alias 条目暂无 model(Validator M3 将暴露该形态)。
441
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
442
+ const aliasID = reg.classSigCanonicalizer.getOrCreateId(this);
443
+ const originID = reg.classSigCanonicalizer.getExistingId(signature);
444
+ if (originID !== -1) {
445
+ const originModel = reg.classSigCanonicalizer.getModel(originID);
446
+ if (originModel !== undefined) {
447
+ reg.classSigCanonicalizer.setModel(aliasID, originModel);
448
+ }
449
+ }
157
450
  }
158
451
  /**
159
452
  * Returns the name used in the code.
@@ -167,20 +460,206 @@ class AliasClassSignature extends ClassSignature {
167
460
  getOriginName() {
168
461
  return super.getClassName();
169
462
  }
463
+ /** alias 身份 hash(aliasName 替代 origin className 参与)。 */
464
+ getHashCode() {
465
+ return this.aliasHashCode;
466
+ }
467
+ /** 比较 aliasName + origin 维度;alias 与普通签名永不相等。 */
468
+ equals(other) {
469
+ if (this === other) {
470
+ return true;
471
+ }
472
+ if (!(other instanceof AliasClassSignature)) {
473
+ return false;
474
+ }
475
+ if (this.aliasName !== other.aliasName) {
476
+ return false;
477
+ }
478
+ if (this.getDeclaringFileSigID() !== other.getDeclaringFileSigID()) {
479
+ return false;
480
+ }
481
+ return this.getDeclaringNamespaceSigID() === other.getDeclaringNamespaceSigID();
482
+ }
170
483
  }
171
484
  exports.AliasClassSignature = AliasClassSignature;
485
+ /**
486
+ * @internal
487
+ * display 归一化:将 alias MethodSignature intern 进 methodSig formal 空间并双注册 origin 的 ArkMethod model(与 AliasClassSignature 构造器的 class 侧双注册
488
+ * 对称)。产生点(组件 pop 构建 / Interface 替换)在把签名交给 expr 之前调用——expr 的 route() formal 命中持 SigID,scene.getMethod 经 getModel 直命中
489
+ * 真实方法(callgraph/ViewTree findMethod 全链路无需 fallback)。
490
+ */
491
+ function internAliasMethodSignature(aliasSignature, originSignature) {
492
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
493
+ const aliasID = reg.methodSigCanonicalizer.getOrCreateId(aliasSignature);
494
+ const originID = reg.methodSigCanonicalizer.getExistingId(originSignature);
495
+ if (originID === -1) {
496
+ return;
497
+ }
498
+ const originModel = reg.methodSigCanonicalizer.getModel(originID);
499
+ if (originModel !== undefined) {
500
+ reg.methodSigCanonicalizer.setModel(aliasID, originModel);
501
+ }
502
+ }
503
+ exports.internAliasMethodSignature = internAliasMethodSignature;
172
504
  class FieldSignature {
173
- constructor(fieldName, declaringSignature, type, staticFlag = false) {
505
+ /** The canonical DEFAULT signature (formal sigID 0 in the registry). */
506
+ static get DEFAULT() {
507
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().fieldSigCanonicalizer.get(0);
508
+ }
509
+ constructor(fieldName, declaringOrID, type, staticFlag = false, namespaceDeclared, declaringClassTempSigID) {
174
510
  this.fieldName = fieldName;
175
- this.declaringSignature = declaringSignature;
176
511
  this.type = type;
177
512
  this.staticFlag = staticFlag;
513
+ if (typeof declaringOrID === 'number' && !namespaceDeclared) {
514
+ // Class-side SigID path: direct field assignment (formal or temp via optional param).
515
+ this.declaringClassSigID = declaringOrID;
516
+ this.declaringClassTempSigID = declaringClassTempSigID;
517
+ this.declaringNamespaceSigID = undefined;
518
+ }
519
+ else {
520
+ this.setDeclaringFields(declaringOrID, namespaceDeclared !== null && namespaceDeclared !== void 0 ? namespaceDeclared : false);
521
+ }
522
+ this.recomputeHashCode();
523
+ }
524
+ /**
525
+ * @internal 解析 declaring 并写入三个 SigID 字段(构造器与 {@link applyFields}共用):
526
+ * 数字重载直存;
527
+ * 对象重载按 isUnclear 分流(unclear class → temp 登记;clear → formal 只读命中;unclear ns → 仅标记 -1)。
528
+ */
529
+ setDeclaringFields(declaringOrID, namespaceDeclared = false) {
530
+ if (typeof declaringOrID === 'number') {
531
+ this.declaringClassSigID = undefined;
532
+ this.declaringClassTempSigID = undefined;
533
+ this.declaringNamespaceSigID = undefined;
534
+ if (namespaceDeclared) {
535
+ this.declaringNamespaceSigID = declaringOrID;
536
+ }
537
+ else {
538
+ this.declaringClassSigID = declaringOrID;
539
+ }
540
+ return;
541
+ }
542
+ this.declaringClassSigID = undefined;
543
+ this.declaringClassTempSigID = undefined;
544
+ this.declaringNamespaceSigID = undefined;
545
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
546
+ if (declaringOrID instanceof ClassSignature) {
547
+ if (declaringOrID.isUnclear()) {
548
+ this.declaringClassSigID = -1;
549
+ this.declaringClassTempSigID = reg.tempClassSigCanonicalizer.register(declaringOrID);
550
+ }
551
+ else {
552
+ const existingId = reg.classSigCanonicalizer.getExistingId(declaringOrID);
553
+ if (existingId !== -1) {
554
+ this.declaringClassSigID = existingId;
555
+ }
556
+ else {
557
+ FieldSignature.logger.error(`Clear ClassSignature declaring not interned — routing to temp: ${declaringOrID.toString()}`);
558
+ this.declaringClassSigID = -1;
559
+ this.declaringClassTempSigID = reg.tempClassSigCanonicalizer.register(declaringOrID);
560
+ }
561
+ }
562
+ }
563
+ else {
564
+ // namespace 无 temp 空间。
565
+ if (declaringOrID.isUnclear()) {
566
+ FieldSignature.logger.error(`Clear ClassSignature declaring not interned — routing to temp: ${declaringOrID.toString()}`);
567
+ this.declaringNamespaceSigID = -1;
568
+ }
569
+ else {
570
+ const existingNsId = reg.namespaceSigCanonicalizer.getExistingId(declaringOrID);
571
+ if (existingNsId !== -1) {
572
+ this.declaringNamespaceSigID = existingNsId;
573
+ }
574
+ else {
575
+ FieldSignature.logger.error(`Clear NamespaceSignature declaring not interned — marking -1: ${declaringOrID.toString()}`);
576
+ this.declaringNamespaceSigID = -1;
577
+ }
578
+ }
579
+ }
580
+ }
581
+ /**
582
+ * @internal Shared mutable probe for existence-check lookups (getFieldWithName and
583
+ * friends). Consume the result in a single expression; never store or intern it.
584
+ */
585
+ static probe(fieldName, declaringClassSigID, type, staticFlag) {
586
+ let p = FieldSignature.probeInstance;
587
+ if (p === undefined) {
588
+ p = new FieldSignature(fieldName, declaringClassSigID, type, staticFlag);
589
+ FieldSignature.probeInstance = p;
590
+ return p;
591
+ }
592
+ p.applyFields(fieldName, declaringClassSigID, type, staticFlag, false);
593
+ return p;
594
+ }
595
+ /** @internal 按当前字段值重算 hash(applyFields 就地演进后调用,值与 hash 保持一致)。 */
596
+ recomputeHashCode() {
597
+ var _a, _b, _c;
598
+ let h = 0xdeadbeef;
599
+ h = (0, HashUtils_1.hashCombineU32)(h, (_a = this.declaringClassSigID) !== null && _a !== void 0 ? _a : 0);
600
+ h = (0, HashUtils_1.hashCombineU32)(h, (_b = this.declaringNamespaceSigID) !== null && _b !== void 0 ? _b : 0);
601
+ h = (0, HashUtils_1.hashCombineU32)(h, (_c = this.declaringClassTempSigID) !== null && _c !== void 0 ? _c : 0);
602
+ h = (0, HashUtils_1.hashCombineU32)(h, (0, HashUtils_1.hashString32)(this.fieldName));
603
+ h = (0, HashUtils_1.hashCombineU32)(h, this.staticFlag ? 1 : 0);
604
+ this.hashCode = h >>> 0;
605
+ }
606
+ /**
607
+ * @internal 参数式就地演进原语——不经过中间实例 N,直接按参数赋值字段 + 解析 declaring + 重算 hash(编号不变)。供持有者更新入口的参数式路径
608
+ * (决策表"未毕业抄写"分支的零分配版)使用。
609
+ */
610
+ applyFields(fieldName, declaringOrID, type, staticFlag, namespaceDeclared = false) {
611
+ this.fieldName = fieldName;
612
+ this.type = type;
613
+ this.staticFlag = staticFlag;
614
+ this.setDeclaringFields(declaringOrID, namespaceDeclared);
615
+ this.recomputeHashCode();
178
616
  }
179
617
  getDeclaringSignature() {
180
- return this.declaringSignature;
618
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
619
+ if (this.declaringClassSigID !== undefined && this.declaringClassSigID >= 0) {
620
+ const sig = reg.classSigCanonicalizer.get(this.declaringClassSigID);
621
+ if (sig !== undefined) {
622
+ return sig;
623
+ }
624
+ }
625
+ else if (this.declaringNamespaceSigID !== undefined && this.declaringNamespaceSigID >= 0) {
626
+ const sig = reg.namespaceSigCanonicalizer.get(this.declaringNamespaceSigID);
627
+ if (sig !== undefined) {
628
+ return sig;
629
+ }
630
+ }
631
+ else if (this.declaringClassTempSigID !== undefined) {
632
+ const sig = reg.tempClassSigCanonicalizer.get(this.declaringClassTempSigID);
633
+ if (sig !== undefined) {
634
+ return sig;
635
+ }
636
+ const formalId = reg.tempClassSigCanonicalizer.getReplacement(this.declaringClassTempSigID);
637
+ if (formalId !== -1) {
638
+ const formalSig = reg.classSigCanonicalizer.get(formalId);
639
+ if (formalSig !== undefined) {
640
+ return formalSig;
641
+ }
642
+ }
643
+ }
644
+ // Stale SigID (registry disposed and rebuilt): degrade to DEFAULT instead of crashing.
645
+ FieldSignature.logger.error(`FieldSignature '${this.fieldName}' has a stale declaring SigID (class=${this.declaringClassSigID}, namespace=${this.declaringNamespaceSigID}, temp=${this.declaringClassTempSigID}); returning ClassSignature.DEFAULT.`);
646
+ return ClassSignature.DEFAULT;
647
+ }
648
+ /** @internal Get the formal ClassSigID of the declaring class. Returns -1 if unclear (temp-held), undefined if declared by namespace. */
649
+ getDeclaringClassSigID() {
650
+ return this.declaringClassSigID;
651
+ }
652
+ /** @internal Get the formal NamespaceSigID of the declaring namespace. Returns -1 if unclear (temp-held), undefined if declared by class. */
653
+ getDeclaringNamespaceSigID() {
654
+ return this.declaringNamespaceSigID;
655
+ }
656
+ /** @internal Get the temp ClassSigID of the unclear declaring class. Returns undefined if clear or declared by namespace. */
657
+ getDeclaringClassTempSigID() {
658
+ return this.declaringClassTempSigID;
181
659
  }
182
660
  getBaseName() {
183
- return this.declaringSignature instanceof ClassSignature ? this.declaringSignature.getClassName() : this.declaringSignature.getNamespaceName();
661
+ const declaringSignature = this.getDeclaringSignature();
662
+ return declaringSignature instanceof ClassSignature ? declaringSignature.getClassName() : declaringSignature.getNamespaceName();
184
663
  }
185
664
  getFieldName() {
186
665
  return this.fieldName;
@@ -206,8 +685,52 @@ class FieldSignature {
206
685
  }
207
686
  return this.getDeclaringSignature().toString() + '.' + tmpSig;
208
687
  }
688
+ /**
689
+ * @deprecated No longer used internally since the ID refactor: identity comparison
690
+ * uses {@link signatureEquals} (hash + equals), indexing uses the canonicalizer.
691
+ * Kept for backward compatibility only — for identity checks use `equals()`
692
+ * (with `getHashCode()` fast reject), for debug output use `toString()`.
693
+ */
694
+ toMapKey() {
695
+ let tmpSig = this.fieldName;
696
+ if (this.isStatic()) {
697
+ tmpSig = '[static]' + tmpSig;
698
+ }
699
+ return this.getDeclaringSignature().toMapKey() + '.' + tmpSig;
700
+ }
701
+ getHashCode() {
702
+ return this.hashCode;
703
+ }
704
+ equals(other) {
705
+ if (this === other) {
706
+ return true;
707
+ }
708
+ if (this.fieldName !== other.fieldName) {
709
+ return false;
710
+ }
711
+ if (this.staticFlag !== other.staticFlag) {
712
+ return false;
713
+ }
714
+ return this.declaringClassSigID === other.declaringClassSigID &&
715
+ this.declaringNamespaceSigID === other.declaringNamespaceSigID &&
716
+ this.declaringClassTempSigID === other.declaringClassTempSigID;
717
+ }
718
+ /**
719
+ * @internal Whether the declaring signature is unclear (temp-held, unresolved).
720
+ * Direct field check (no registry lookup, no declaring signature chain traversal):
721
+ * class-side unclear = declaringClassSigID is non-positive — -1 (temp-held) or 0
722
+ * (DEFAULT class as declaring, i.e. "method on an unknown class" — stub builders
723
+ * like ArkSignatureBuilder.buildMethodSignatureFromMethodName pass 0 directly);
724
+ * namespace-side unclear = declaringNamespaceSigID === -1.
725
+ * A positive formal declaring ID implies the declaring entity went through the
726
+ * formal path — no chain check needed.
727
+ */
728
+ isUnclear() {
729
+ return this.declaringClassSigID === -1 || this.declaringClassSigID === 0 || this.declaringNamespaceSigID === -1;
730
+ }
209
731
  }
210
732
  exports.FieldSignature = FieldSignature;
733
+ FieldSignature.logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'FieldSignature');
211
734
  class MethodSubSignature {
212
735
  constructor(methodName, parameters, returnType, staticFlag = false) {
213
736
  this.methodName = methodName;
@@ -221,6 +744,17 @@ class MethodSubSignature {
221
744
  getParameters() {
222
745
  return this.parameters;
223
746
  }
747
+ /**
748
+ * @internal Replace the parameter list.
749
+ *
750
+ * Parameter NAMES are not part of the signature identity (hash/equals/toString only use
751
+ * parameter types), so distinct declarations/implementations of the same method share one
752
+ * canonical signature instance. The implementation side is the authority for body-local
753
+ * generation, so its parameter names are refreshed onto the canonical instance.
754
+ */
755
+ setParameters(parameters) {
756
+ this.parameters = parameters;
757
+ }
224
758
  getParameterTypes() {
225
759
  const parameterTypes = [];
226
760
  this.parameters.forEach(parameter => {
@@ -241,7 +775,9 @@ class MethodSubSignature {
241
775
  let paraStr = '';
242
776
  this.getParameterTypes().forEach(parameterType => {
243
777
  const typeStr = parameterType
244
- ? (visited ? parameterType.toStringWithVisited(visited) : parameterType.toString())
778
+ ? visited
779
+ ? parameterType.toStringWithVisited(visited)
780
+ : parameterType.toString()
245
781
  : Type_1.UnknownType.getInstance().toString();
246
782
  paraStr += typeStr + ', ';
247
783
  });
@@ -254,13 +790,80 @@ class MethodSubSignature {
254
790
  }
255
791
  }
256
792
  exports.MethodSubSignature = MethodSubSignature;
793
+ /**
794
+ * @internal Value-semantic equality between two MethodSubSignatures, semantically equivalent to `a.toString() === b.toString()` plus return-type equality,
795
+ * but short-circuits from cheap to expensive with NO string building in the common mismatch cases.
796
+ */
797
+ function methodSubSignatureValueEquals(a, b) {
798
+ var _a, _b, _c, _d;
799
+ if (a === b) {
800
+ return true;
801
+ }
802
+ if (a.isStatic() !== b.isStatic()) {
803
+ return false;
804
+ }
805
+ if (a.getMethodName() !== b.getMethodName()) {
806
+ return false;
807
+ }
808
+ const ap = a.getParameters();
809
+ const bp = b.getParameters();
810
+ if (ap.length !== bp.length) {
811
+ return false;
812
+ }
813
+ for (let i = 0; i < ap.length; i++) {
814
+ const at = (_a = ap[i]) === null || _a === void 0 ? void 0 : _a.getType();
815
+ const bt = (_b = bp[i]) === null || _b === void 0 ? void 0 : _b.getType();
816
+ if (at === bt) {
817
+ continue;
818
+ }
819
+ if (((_c = at === null || at === void 0 ? void 0 : at.toString()) !== null && _c !== void 0 ? _c : Type_1.UnknownType.getInstance().toString()) !== ((_d = bt === null || bt === void 0 ? void 0 : bt.toString()) !== null && _d !== void 0 ? _d : Type_1.UnknownType.getInstance().toString())) {
820
+ return false;
821
+ }
822
+ }
823
+ return a.getReturnType().toString() === b.getReturnType().toString();
824
+ }
257
825
  /**
258
826
  * @category core/model
259
827
  */
260
828
  class MethodSignature {
261
- constructor(declaringClassSignature, methodSubSignature) {
262
- this.declaringClassSignature = declaringClassSignature;
829
+ /** The canonical DEFAULT signature (formal sigID 0 in the registry). */
830
+ static get DEFAULT() {
831
+ return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().methodSigCanonicalizer.get(0);
832
+ }
833
+ constructor(declaringClassOrID, methodSubSignature, declaringClassTempSigID) {
834
+ var _a;
263
835
  this.methodSubSignature = methodSubSignature;
836
+ if (typeof declaringClassOrID === 'number') {
837
+ this.declaringClassSigID = declaringClassOrID;
838
+ this.declaringClassTempSigID = declaringClassTempSigID;
839
+ }
840
+ else {
841
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
842
+ if (declaringClassOrID.isUnclear()) {
843
+ this.declaringClassSigID = -1;
844
+ this.declaringClassTempSigID = reg.tempClassSigCanonicalizer.register(declaringClassOrID);
845
+ }
846
+ else {
847
+ const existingId = reg.classSigCanonicalizer.getExistingId(declaringClassOrID);
848
+ if (existingId !== -1) {
849
+ this.declaringClassSigID = existingId;
850
+ }
851
+ else {
852
+ MethodSignature.logger.error(`Clear ClassSignature declaring not interned — routing to temp: ${declaringClassOrID.toString()}`);
853
+ this.declaringClassSigID = -1;
854
+ this.declaringClassTempSigID = reg.tempClassSigCanonicalizer.register(declaringClassOrID);
855
+ }
856
+ }
857
+ }
858
+ // Hash inputs are lifetime-stable identity fields ONLY: declaring SigIDs, method name, parameter count, static flag.
859
+ // Parameter TYPES and the return type are deliberately excluded — they are mutable in place during inference.
860
+ let h = 0xdeadbeef;
861
+ h = (0, HashUtils_1.hashCombineU32)(h, this.declaringClassSigID);
862
+ h = (0, HashUtils_1.hashCombineU32)(h, (_a = this.declaringClassTempSigID) !== null && _a !== void 0 ? _a : 0);
863
+ h = (0, HashUtils_1.hashCombineU32)(h, (0, HashUtils_1.hashString32)(methodSubSignature.getMethodName()));
864
+ h = (0, HashUtils_1.hashCombineU32)(h, methodSubSignature.getParameters().length);
865
+ h = (0, HashUtils_1.hashCombineU32)(h, methodSubSignature.isStatic() ? 1 : 0);
866
+ this.hashCode = h >>> 0;
264
867
  }
265
868
  /**
266
869
  * Return the declaring class signature.
@@ -271,17 +874,39 @@ class MethodSignature {
271
874
  * A namespace signature can indicate its **string** name of namespace and its file signature.
272
875
  * - Class Name: the **string** name of this class.
273
876
  * @returns The declaring class signature.
274
- * @example
275
- * 1. get class signature from ArkMethod.
276
-
277
- ```typescript
278
- let methodSignature = expr.getMethodSignature();
279
- let name = methodSignature.getDeclaringClassSignature().getClassName();
280
- ```
281
- *
282
877
  */
283
878
  getDeclaringClassSignature() {
284
- return this.declaringClassSignature;
879
+ const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
880
+ if (this.declaringClassSigID >= 0) {
881
+ const sig = reg.classSigCanonicalizer.get(this.declaringClassSigID);
882
+ if (sig !== undefined) {
883
+ return sig;
884
+ }
885
+ }
886
+ else if (this.declaringClassTempSigID !== undefined) {
887
+ const sig = reg.tempClassSigCanonicalizer.get(this.declaringClassTempSigID);
888
+ if (sig !== undefined) {
889
+ return sig;
890
+ }
891
+ const formalId = reg.tempClassSigCanonicalizer.getReplacement(this.declaringClassTempSigID);
892
+ if (formalId !== -1) {
893
+ const formalSig = reg.classSigCanonicalizer.get(formalId);
894
+ if (formalSig !== undefined) {
895
+ return formalSig;
896
+ }
897
+ }
898
+ }
899
+ // Stale SigID (registry disposed and rebuilt): degrade to DEFAULT instead of crashing.
900
+ MethodSignature.logger.error(`MethodSignature '${this.methodSubSignature.getMethodName()}' has a stale declaring class SigID ${this.declaringClassSigID} (temp=${this.declaringClassTempSigID}); returning DEFAULT.`);
901
+ return ClassSignature.DEFAULT;
902
+ }
903
+ /** @internal Get the formal ClassSigID of the declaring class. Returns -1 if unclear (temp-held). */
904
+ getDeclaringClassSigID() {
905
+ return this.declaringClassSigID;
906
+ }
907
+ /** @internal Get the temp ClassSigID of the unclear declaring class. Returns undefined if clear. */
908
+ getDeclaringClassTempSigID() {
909
+ return this.declaringClassTempSigID;
285
910
  }
286
911
  /**
287
912
  * Returns the sub-signature of this method signature.
@@ -296,20 +921,49 @@ class MethodSignature {
296
921
  return this.methodSubSignature.getReturnType();
297
922
  }
298
923
  toString(ptrName, visited) {
299
- return this.declaringClassSignature.toString() + '.' +
300
- this.methodSubSignature.toString(ptrName, visited);
924
+ return this.getDeclaringClassSignature().toString() + '.' + this.methodSubSignature.toString(ptrName, visited);
301
925
  }
926
+ /**
927
+ * @deprecated No longer used internally since the ID refactor: identity comparison
928
+ * uses {@link signatureEquals} (hash + equals), indexing uses the canonicalizer.
929
+ * Kept for backward compatibility only — for identity checks use `equals()`
930
+ * (with `getHashCode()` fast reject), for debug output use `toString()`.
931
+ */
302
932
  toMapKey() {
303
- return this.declaringClassSignature.toMapKey() + '.' + this.methodSubSignature.toString();
933
+ return this.getDeclaringClassSignature().toMapKey() + '.' + this.methodSubSignature.toString();
934
+ }
935
+ getHashCode() {
936
+ return this.hashCode;
937
+ }
938
+ equals(other) {
939
+ if (this === other) {
940
+ return true;
941
+ }
942
+ if (this.declaringClassSigID !== other.declaringClassSigID) {
943
+ return false;
944
+ }
945
+ if (this.declaringClassTempSigID !== other.declaringClassTempSigID) {
946
+ return false;
947
+ }
948
+ return methodSubSignatureValueEquals(this.methodSubSignature, other.methodSubSignature);
949
+ }
950
+ isUnclear() {
951
+ return this.declaringClassSigID === -1 || this.declaringClassSigID === 0;
304
952
  }
305
953
  isMatch(signature) {
306
- return this.toString() === signature.toString() && this.getType().toString() === signature.getType().toString();
954
+ if (!(0, SignatureCanonicalizer_1.signatureEquals)(this.getDeclaringClassSignature(), signature.getDeclaringClassSignature())) {
955
+ return false;
956
+ }
957
+ // Sub-signature comparison shares the field-level path with equals (was: full
958
+ // MethodSignature.toString() building ×2 + returnType.toString() ×2 per call).
959
+ return methodSubSignatureValueEquals(this.methodSubSignature, signature.methodSubSignature);
307
960
  }
308
961
  getParamLength() {
309
962
  return this.methodSubSignature.getParameters().filter(p => !p.getName().startsWith(Const_1.LEXICAL_ENV_NAME_PREFIX)).length;
310
963
  }
311
964
  }
312
965
  exports.MethodSignature = MethodSignature;
966
+ MethodSignature.logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'MethodSignature');
313
967
  class LocalSignature {
314
968
  constructor(name, declaringMethodSignature) {
315
969
  this.name = name;
@@ -342,57 +996,33 @@ class AliasTypeSignature {
342
996
  }
343
997
  }
344
998
  exports.AliasTypeSignature = AliasTypeSignature;
345
- //TODO, reconstruct
999
+ /**
1000
+ * Legacy free-function comparators — kept for API compatibility (external callers may exist).
1001
+ * Behavior aligns with the corresponding signature classes' `equals()`:
1002
+ * - classSignatureCompare compares the declaring namespace (silently ignoring it misjudges same-name classes in different namespaces as equal);
1003
+ * - methodSubSignatureCompare compares parameter/return types by value (`===` reference comparison misjudges value-equal distinct Type instances as different).
1004
+ */
346
1005
  function fieldSignatureCompare(leftSig, rightSig) {
347
- if (leftSig.getDeclaringSignature().toString() === rightSig.getDeclaringSignature().toString() && leftSig.getFieldName() === rightSig.getFieldName()) {
348
- return true;
349
- }
350
- return false;
1006
+ return (0, SignatureCanonicalizer_1.signatureEquals)(leftSig.getDeclaringSignature(), rightSig.getDeclaringSignature()) && leftSig.getFieldName() === rightSig.getFieldName();
351
1007
  }
352
1008
  exports.fieldSignatureCompare = fieldSignatureCompare;
353
1009
  function methodSignatureCompare(leftSig, rightSig) {
354
- if (classSignatureCompare(leftSig.getDeclaringClassSignature(), rightSig.getDeclaringClassSignature()) &&
355
- methodSubSignatureCompare(leftSig.getMethodSubSignature(), rightSig.getMethodSubSignature())) {
356
- return true;
357
- }
358
- return false;
1010
+ return (0, SignatureCanonicalizer_1.signatureEquals)(leftSig.getDeclaringClassSignature(), rightSig.getDeclaringClassSignature()) &&
1011
+ methodSubSignatureValueEquals(leftSig.getMethodSubSignature(), rightSig.getMethodSubSignature());
359
1012
  }
360
1013
  exports.methodSignatureCompare = methodSignatureCompare;
361
1014
  function methodSubSignatureCompare(leftSig, rightSig) {
362
- if (leftSig.getMethodName() === rightSig.getMethodName() &&
363
- arrayCompare(leftSig.getParameterTypes(), rightSig.getParameterTypes()) &&
364
- leftSig.getReturnType() === rightSig.getReturnType() &&
365
- leftSig.isStatic() === rightSig.isStatic()) {
366
- return true;
367
- }
368
- return false;
1015
+ return methodSubSignatureValueEquals(leftSig, rightSig);
369
1016
  }
370
1017
  exports.methodSubSignatureCompare = methodSubSignatureCompare;
371
1018
  function classSignatureCompare(leftSig, rightSig) {
372
- if (fileSignatureCompare(leftSig.getDeclaringFileSignature(), rightSig.getDeclaringFileSignature()) && leftSig.getClassName() === rightSig.getClassName()) {
373
- return true;
374
- }
375
- return false;
1019
+ return (0, SignatureCanonicalizer_1.signatureEquals)(leftSig, rightSig);
376
1020
  }
377
1021
  exports.classSignatureCompare = classSignatureCompare;
378
1022
  function fileSignatureCompare(leftSig, rightSig) {
379
- if (leftSig.getFileName() === rightSig.getFileName() && leftSig.getProjectName() === rightSig.getProjectName()) {
380
- return true;
381
- }
382
- return false;
1023
+ return leftSig.equals(rightSig);
383
1024
  }
384
1025
  exports.fileSignatureCompare = fileSignatureCompare;
385
- function arrayCompare(leftArray, rightArray) {
386
- if (leftArray.length !== rightArray.length) {
387
- return false;
388
- }
389
- for (let i = 0; i < leftArray.length; i++) {
390
- if (leftArray[i] !== rightArray[i]) {
391
- return false;
392
- }
393
- }
394
- return true;
395
- }
396
1026
  function genSignature4ImportClause(arkFileName, importClauseName) {
397
1027
  return `<${arkFileName}>.<${importClauseName}>`;
398
1028
  }