arkanalyzer 1.0.29 → 1.0.31

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 (86) hide show
  1. package/lib/Scene.d.ts +7 -0
  2. package/lib/Scene.d.ts.map +1 -1
  3. package/lib/Scene.js +196 -173
  4. package/lib/VFG/builder/DVFGBuilder.d.ts.map +1 -1
  5. package/lib/VFG/builder/DVFGBuilder.js +11 -6
  6. package/lib/callgraph/algorithm/AbstractAnalysis.d.ts +3 -1
  7. package/lib/callgraph/algorithm/AbstractAnalysis.d.ts.map +1 -1
  8. package/lib/callgraph/algorithm/AbstractAnalysis.js +18 -10
  9. package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
  10. package/lib/callgraph/algorithm/RapidTypeAnalysis.js +8 -7
  11. package/lib/callgraph/common/Statistics.d.ts.map +1 -1
  12. package/lib/callgraph/common/Statistics.js +25 -24
  13. package/lib/callgraph/model/CallGraph.d.ts.map +1 -1
  14. package/lib/callgraph/model/CallGraph.js +0 -1
  15. package/lib/callgraph/pointerAnalysis/Context.d.ts.map +1 -1
  16. package/lib/callgraph/pointerAnalysis/Context.js +0 -1
  17. package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts +9 -3
  18. package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts.map +1 -1
  19. package/lib/callgraph/pointerAnalysis/PTAUtils.js +32 -18
  20. package/lib/callgraph/pointerAnalysis/Pag.d.ts +17 -1
  21. package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
  22. package/lib/callgraph/pointerAnalysis/Pag.js +74 -27
  23. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +51 -18
  24. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
  25. package/lib/callgraph/pointerAnalysis/PagBuilder.js +533 -346
  26. package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
  27. package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +15 -14
  28. package/lib/core/base/Local.js +2 -2
  29. package/lib/core/base/Type.d.ts +10 -1
  30. package/lib/core/base/Type.d.ts.map +1 -1
  31. package/lib/core/base/Type.js +18 -1
  32. package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
  33. package/lib/core/common/ArkValueTransformer.js +3 -1
  34. package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
  35. package/lib/core/common/DummyMainCreater.js +17 -20
  36. package/lib/core/common/IRInference.d.ts.map +1 -1
  37. package/lib/core/common/IRInference.js +21 -12
  38. package/lib/core/common/TypeInference.d.ts +1 -0
  39. package/lib/core/common/TypeInference.d.ts.map +1 -1
  40. package/lib/core/common/TypeInference.js +30 -4
  41. package/lib/core/dataflow/DataflowSolver.d.ts +1 -0
  42. package/lib/core/dataflow/DataflowSolver.d.ts.map +1 -1
  43. package/lib/core/dataflow/DataflowSolver.js +21 -17
  44. package/lib/core/dataflow/ReachingDef.d.ts.map +1 -1
  45. package/lib/core/dataflow/ReachingDef.js +6 -0
  46. package/lib/core/dataflow/UndefinedVariable.d.ts.map +1 -1
  47. package/lib/core/dataflow/UndefinedVariable.js +0 -25
  48. package/lib/core/graph/Cfg.d.ts +1 -0
  49. package/lib/core/graph/Cfg.d.ts.map +1 -1
  50. package/lib/core/graph/Cfg.js +49 -45
  51. package/lib/core/graph/DominanceFinder.js +19 -19
  52. package/lib/core/graph/builder/ViewTreeBuilder.d.ts +1 -0
  53. package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
  54. package/lib/core/graph/builder/ViewTreeBuilder.js +34 -31
  55. package/lib/core/model/ArkMethod.d.ts.map +1 -1
  56. package/lib/core/model/ArkMethod.js +13 -6
  57. package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
  58. package/lib/core/model/builder/builderUtils.js +72 -63
  59. package/lib/save/serializeArkIR.d.ts.map +1 -1
  60. package/lib/save/serializeArkIR.js +11 -24
  61. package/lib/save/source/SourceBody.js +10 -10
  62. package/lib/save/source/SourceFilePrinter.d.ts +1 -0
  63. package/lib/save/source/SourceFilePrinter.d.ts.map +1 -1
  64. package/lib/save/source/SourceFilePrinter.js +11 -8
  65. package/lib/save/source/SourceNamespace.d.ts +1 -0
  66. package/lib/save/source/SourceNamespace.d.ts.map +1 -1
  67. package/lib/save/source/SourceNamespace.js +11 -8
  68. package/lib/save/source/SourceStmt.d.ts +1 -0
  69. package/lib/save/source/SourceStmt.d.ts.map +1 -1
  70. package/lib/save/source/SourceStmt.js +37 -35
  71. package/lib/save/source/SourceTransformer.d.ts +2 -0
  72. package/lib/save/source/SourceTransformer.d.ts.map +1 -1
  73. package/lib/save/source/SourceTransformer.js +64 -54
  74. package/lib/transformer/StaticSingleAssignmentFormer.d.ts +5 -0
  75. package/lib/transformer/StaticSingleAssignmentFormer.d.ts.map +1 -1
  76. package/lib/transformer/StaticSingleAssignmentFormer.js +119 -101
  77. package/lib/utils/CfgStructualAnalysis.d.ts +1 -0
  78. package/lib/utils/CfgStructualAnalysis.d.ts.map +1 -1
  79. package/lib/utils/CfgStructualAnalysis.js +28 -24
  80. package/lib/utils/FileUtils.d.ts.map +1 -1
  81. package/lib/utils/FileUtils.js +14 -12
  82. package/lib/utils/callGraphUtils.d.ts.map +1 -1
  83. package/lib/utils/callGraphUtils.js +26 -23
  84. package/lib/utils/entryMethodUtils.d.ts.map +1 -1
  85. package/lib/utils/entryMethodUtils.js +11 -8
  86. package/package.json +2 -2
@@ -22,25 +22,13 @@ const DominanceFinder_1 = require("../core/graph/DominanceFinder");
22
22
  const DominanceTree_1 = require("../core/graph/DominanceTree");
23
23
  class StaticSingleAssignmentFormer {
24
24
  transformBody(body) {
25
- var _a;
26
25
  let cfg = body.getCfg();
27
26
  let blockToDefs = new Map();
28
27
  let localToBlocks = new Map();
29
28
  for (const block of cfg.getBlocks()) {
30
29
  let defs = new Set();
31
30
  for (const stmt of block.getStmts()) {
32
- if (stmt.getDef() != null && stmt.getDef() instanceof Local_1.Local) {
33
- let local = stmt.getDef();
34
- defs.add(local);
35
- if (localToBlocks.has(local)) {
36
- (_a = localToBlocks.get(local)) === null || _a === void 0 ? void 0 : _a.add(block);
37
- }
38
- else {
39
- let blcoks = new Set();
40
- blcoks.add(block);
41
- localToBlocks.set(local, blcoks);
42
- }
43
- }
31
+ this.transformStmt(stmt, defs, localToBlocks, block);
44
32
  }
45
33
  blockToDefs.set(block, defs);
46
34
  }
@@ -50,8 +38,22 @@ class StaticSingleAssignmentFormer {
50
38
  let dominanceTree = new DominanceTree_1.DominanceTree(dominanceFinder);
51
39
  this.renameLocals(body, dominanceTree, blockToPhiStmts);
52
40
  }
41
+ transformStmt(stmt, defs, localToBlocks, block) {
42
+ var _a;
43
+ if (stmt.getDef() != null && stmt.getDef() instanceof Local_1.Local) {
44
+ let local = stmt.getDef();
45
+ defs.add(local);
46
+ if (localToBlocks.has(local)) {
47
+ (_a = localToBlocks.get(local)) === null || _a === void 0 ? void 0 : _a.add(block);
48
+ }
49
+ else {
50
+ let blcoks = new Set();
51
+ blcoks.add(block);
52
+ localToBlocks.set(local, blcoks);
53
+ }
54
+ }
55
+ }
53
56
  decideBlockToPhiStmts(body, dominanceFinder, blockToDefs, localToBlocks) {
54
- var _a, _b, _c, _d;
55
57
  let blockToPhiStmts = new Map();
56
58
  let blockToPhiLocals = new Map();
57
59
  let localToPhiBlock = new Map();
@@ -63,50 +65,57 @@ class StaticSingleAssignmentFormer {
63
65
  let block = blocks.splice(0, 1).at(0);
64
66
  let dfs = dominanceFinder.getDominanceFrontiers(block);
65
67
  for (const df of dfs) {
66
- if (!phiBlocks.has(df)) {
67
- phiBlocks.add(df);
68
- let phiStmt = this.createEmptyPhiStmt(local);
69
- if (blockToPhiStmts.has(df)) {
70
- (_a = blockToPhiStmts.get(df)) === null || _a === void 0 ? void 0 : _a.add(phiStmt);
71
- (_b = blockToPhiLocals.get(df)) === null || _b === void 0 ? void 0 : _b.add(local);
72
- }
73
- else {
74
- let phiStmts = new Set();
75
- phiStmts.add(phiStmt);
76
- blockToPhiStmts.set(df, phiStmts);
77
- let phiLocals = new Set();
78
- phiLocals.add(local);
79
- blockToPhiLocals.set(df, phiLocals);
80
- }
81
- (_c = blockToDefs.get(df)) === null || _c === void 0 ? void 0 : _c.add(local);
82
- if (!((_d = blockToDefs.get(df)) === null || _d === void 0 ? void 0 : _d.has(local))) {
83
- blocks.push(df);
84
- }
85
- }
68
+ this.handleDf(blockToPhiStmts, blockToPhiLocals, phiBlocks, df, local, blockToDefs, blocks);
86
69
  }
87
70
  }
88
71
  }
89
72
  return blockToPhiStmts;
90
73
  }
91
- addPhiStmts(blockToPhiStmts, cfg, blockToDefs) {
74
+ handleDf(blockToPhiStmts, blockToPhiLocals, phiBlocks, df, local, blockToDefs, blocks) {
75
+ var _a, _b, _c, _d;
76
+ if (!phiBlocks.has(df)) {
77
+ phiBlocks.add(df);
78
+ let phiStmt = this.createEmptyPhiStmt(local);
79
+ if (blockToPhiStmts.has(df)) {
80
+ (_a = blockToPhiStmts.get(df)) === null || _a === void 0 ? void 0 : _a.add(phiStmt);
81
+ (_b = blockToPhiLocals.get(df)) === null || _b === void 0 ? void 0 : _b.add(local);
82
+ }
83
+ else {
84
+ let phiStmts = new Set();
85
+ phiStmts.add(phiStmt);
86
+ blockToPhiStmts.set(df, phiStmts);
87
+ let phiLocals = new Set();
88
+ phiLocals.add(local);
89
+ blockToPhiLocals.set(df, phiLocals);
90
+ }
91
+ (_c = blockToDefs.get(df)) === null || _c === void 0 ? void 0 : _c.add(local);
92
+ if (!((_d = blockToDefs.get(df)) === null || _d === void 0 ? void 0 : _d.has(local))) {
93
+ blocks.push(df);
94
+ }
95
+ }
96
+ }
97
+ handleBlockWithSucc(blockToPhiStmts, succ, blockToDefs, block, phiArgsNum) {
92
98
  var _a;
99
+ for (const phi of blockToPhiStmts.get(succ)) {
100
+ let local = phi.getDef();
101
+ if ((_a = blockToDefs.get(block)) === null || _a === void 0 ? void 0 : _a.has(local)) {
102
+ if (phiArgsNum.has(phi)) {
103
+ let num = phiArgsNum.get(phi);
104
+ phiArgsNum.set(phi, num + 1);
105
+ }
106
+ else {
107
+ phiArgsNum.set(phi, 1);
108
+ }
109
+ }
110
+ }
111
+ }
112
+ addPhiStmts(blockToPhiStmts, cfg, blockToDefs) {
93
113
  let phiArgsNum = new Map();
94
114
  for (const block of cfg.getBlocks()) {
95
115
  let succs = Array.from(block.getSuccessors());
96
116
  for (const succ of succs) {
97
117
  if (blockToPhiStmts.has(succ)) {
98
- for (const phi of blockToPhiStmts.get(succ)) {
99
- let local = phi.getDef();
100
- if ((_a = blockToDefs.get(block)) === null || _a === void 0 ? void 0 : _a.has(local)) {
101
- if (phiArgsNum.has(phi)) {
102
- let num = phiArgsNum.get(phi);
103
- phiArgsNum.set(phi, num + 1);
104
- }
105
- else {
106
- phiArgsNum.set(phi, 1);
107
- }
108
- }
109
- }
118
+ this.handleBlockWithSucc(blockToPhiStmts, succ, blockToDefs, block, phiArgsNum);
110
119
  }
111
120
  }
112
121
  }
@@ -123,8 +132,35 @@ class StaticSingleAssignmentFormer {
123
132
  }
124
133
  }
125
134
  }
135
+ renameUseAndDef(stmt, localToNameStack, nextFreeIdx, newLocals, newPhiStmts) {
136
+ var _a;
137
+ let uses = stmt.getUses();
138
+ if (uses.length > 0 && !this.constainsPhiExpr(stmt)) {
139
+ for (const use of uses) {
140
+ if (use instanceof Local_1.Local) {
141
+ let nameStack = localToNameStack.get(use);
142
+ let newUse = nameStack[nameStack.length - 1];
143
+ stmt.replaceUse(use, newUse);
144
+ }
145
+ }
146
+ }
147
+ // rename def
148
+ let def = stmt.getDef();
149
+ if (def != null && def instanceof Local_1.Local) {
150
+ let newName = def.getName() + '#' + nextFreeIdx;
151
+ nextFreeIdx++;
152
+ let newDef = new Local_1.Local(newName);
153
+ newDef.setOriginalValue(def);
154
+ newLocals.add(newDef);
155
+ (_a = localToNameStack.get(def)) === null || _a === void 0 ? void 0 : _a.push(newDef);
156
+ stmt.setLeftOp(newDef);
157
+ if (this.constainsPhiExpr(stmt)) {
158
+ newPhiStmts.add(stmt);
159
+ }
160
+ }
161
+ return nextFreeIdx;
162
+ }
126
163
  renameLocals(body, dominanceTree, blockToPhiStmts) {
127
- var _a, _b;
128
164
  let newLocals = new Set(body.getLocals().values());
129
165
  let localToNameStack = new Map();
130
166
  for (const local of newLocals) {
@@ -137,31 +173,8 @@ class StaticSingleAssignmentFormer {
137
173
  for (const block of dfsBlocks) {
138
174
  let newPhiStmts = new Set();
139
175
  for (const stmt of block.getStmts()) {
140
- // rename uses
141
- let uses = stmt.getUses();
142
- if (uses.length > 0 && !this.constainsPhiExpr(stmt)) {
143
- for (const use of uses) {
144
- if (use instanceof Local_1.Local) {
145
- let nameStack = localToNameStack.get(use);
146
- let newUse = nameStack[nameStack.length - 1];
147
- stmt.replaceUse(use, newUse);
148
- }
149
- }
150
- }
151
- // rename def
152
- let def = stmt.getDef();
153
- if (def != null && def instanceof Local_1.Local) {
154
- let newName = def.getName() + '#' + nextFreeIdx;
155
- nextFreeIdx++;
156
- let newDef = new Local_1.Local(newName);
157
- newDef.setOriginalValue(def);
158
- newLocals.add(newDef);
159
- (_a = localToNameStack.get(def)) === null || _a === void 0 ? void 0 : _a.push(newDef);
160
- stmt.setLeftOp(newDef);
161
- if (this.constainsPhiExpr(stmt)) {
162
- newPhiStmts.add(stmt);
163
- }
164
- }
176
+ // rename uses and def
177
+ nextFreeIdx = this.renameUseAndDef(stmt, localToNameStack, nextFreeIdx, newLocals, newPhiStmts);
165
178
  }
166
179
  visited.add(block);
167
180
  blockStack.push(block);
@@ -171,40 +184,45 @@ class StaticSingleAssignmentFormer {
171
184
  // rename phiStmts' args
172
185
  let succs = Array.from(block.getSuccessors());
173
186
  for (const succ of succs) {
174
- if (blockToPhiStmts.has(succ)) {
175
- let phiStmts = blockToPhiStmts.get(succ);
176
- for (const phiStmt of phiStmts) {
177
- let def = phiStmt.getDef();
178
- let oriDef = this.getOriginalLocal(def, new Set(localToNameStack.keys()));
179
- let nameStack = localToNameStack.get(oriDef);
180
- let arg = nameStack[nameStack.length - 1];
181
- this.addNewArgToPhi(phiStmt, arg, block);
182
- }
187
+ if (!blockToPhiStmts.has(succ)) {
188
+ continue;
189
+ }
190
+ let phiStmts = blockToPhiStmts.get(succ);
191
+ for (const phiStmt of phiStmts) {
192
+ let def = phiStmt.getDef();
193
+ let oriDef = this.getOriginalLocal(def, new Set(localToNameStack.keys()));
194
+ let nameStack = localToNameStack.get(oriDef);
195
+ let arg = nameStack[nameStack.length - 1];
196
+ this.addNewArgToPhi(phiStmt, arg, block);
183
197
  }
184
198
  }
185
199
  // if a block's children in dominance tree are visited, remove it
186
- let top = blockStack[blockStack.length - 1];
187
- let children = dominanceTree.getChildren(top);
188
- while (this.containsAllChildren(visited, children)) {
189
- blockStack.pop();
190
- for (const stmt of top.getStmts()) {
191
- let def = stmt.getDef();
192
- if (def != null && def instanceof Local_1.Local) {
193
- let oriDef = this.getOriginalLocal(def, new Set(localToNameStack.keys()));
194
- (_b = localToNameStack.get(oriDef)) === null || _b === void 0 ? void 0 : _b.pop();
195
- }
196
- }
197
- // next block to check
198
- if (blockStack.length > 0) {
199
- top = blockStack[blockStack.length - 1];
200
- children = dominanceTree.getChildren(top);
201
- }
202
- else {
203
- break;
200
+ this.removeVisitedTree(blockStack, dominanceTree, visited, localToNameStack);
201
+ }
202
+ body.setLocals(newLocals);
203
+ }
204
+ removeVisitedTree(blockStack, dominanceTree, visited, localToNameStack) {
205
+ var _a;
206
+ let top = blockStack[blockStack.length - 1];
207
+ let children = dominanceTree.getChildren(top);
208
+ while (this.containsAllChildren(visited, children)) {
209
+ blockStack.pop();
210
+ for (const stmt of top.getStmts()) {
211
+ let def = stmt.getDef();
212
+ if (def != null && def instanceof Local_1.Local) {
213
+ let oriDef = this.getOriginalLocal(def, new Set(localToNameStack.keys()));
214
+ (_a = localToNameStack.get(oriDef)) === null || _a === void 0 ? void 0 : _a.pop();
204
215
  }
205
216
  }
217
+ // next block to check
218
+ if (blockStack.length > 0) {
219
+ top = blockStack[blockStack.length - 1];
220
+ children = dominanceTree.getChildren(top);
221
+ }
222
+ else {
223
+ break;
224
+ }
206
225
  }
207
- body.setLocals(newLocals);
208
226
  }
209
227
  constainsPhiExpr(stmt) {
210
228
  if (stmt instanceof Stmt_1.ArkAssignStmt && stmt.getUses().length > 0) {
@@ -32,6 +32,7 @@ export declare class AbstractFlowGraph {
32
32
  private structuralAnalysis;
33
33
  private dfsPostOrder;
34
34
  private buildCyclicStructural;
35
+ private handleRegion;
35
36
  private prepareBuildLoops;
36
37
  private buildDominator;
37
38
  private getBackEdges;
@@ -1 +1 @@
1
- {"version":3,"file":"CfgStructualAnalysis.d.ts","sourceRoot":"","sources":["../../src/utils/CfgStructualAnalysis.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,oBAAY,aAAa;IACrB,MAAM,IAAA;IACN,EAAE,IAAA;IACF,IAAI,IAAA;IACJ,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,EAAE,IAAA;IACF,QAAQ,IAAA;IACR,KAAK,IAAA;IACL,GAAG,IAAA;IACH,YAAY,IAAA;IACZ,GAAG,KAAA;IACH,KAAK,KAAA;IACL,OAAO,KAAA;CACV;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;AAE7F,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,QAAQ,CAAwC;IACxD,OAAO,CAAC,WAAW,CAAsC;IACzD,OAAO,CAAC,YAAY,CAAmD;IACvE,OAAO,CAAC,OAAO,CAAmD;gBAE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AO,IAAI,UAAU;IAIrB,OAAO,IAAI,YAAY,EAAE;IAIzB,OAAO,CAAC,IAAI,EAAE,YAAY;IAI1B,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY;IAShD,UAAU,CAAC,GAAG,EAAE,YAAY;IAS5B,OAAO,IAAI,YAAY,EAAE;IAIzB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAQlC,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY;IAShD,UAAU,CAAC,GAAG,EAAE,YAAY;IAS5B,QAAQ,CAAC,EAAE,EAAE,UAAU;IAIvB,QAAQ,IAAI,UAAU,GAAG,SAAS;IAIlC,SAAS,IAAI,OAAO;IAapB,aAAa,IAAI,OAAO;CAWlC"}
@@ -145,22 +145,25 @@ class AbstractFlowGraph {
145
145
  this.structTypes.set(region, rtype);
146
146
  let blocks = new Set();
147
147
  for (const s of nset) {
148
- if (!this.structOf.has(s)) {
149
- this.structOf.set(s, region);
150
- }
151
- if (this.structBlocks.has(s)) {
152
- for (const b of this.structBlocks.get(s)) {
153
- blocks.add(b);
154
- }
155
- }
156
- else {
157
- blocks.add(s);
158
- }
148
+ this.handleRegion(s, region, blocks);
159
149
  }
160
150
  this.structBlocks.set(region, blocks);
161
151
  this.loopMap.set(region.header, region);
162
152
  }
163
153
  }
154
+ handleRegion(s, region, blocks) {
155
+ if (!this.structOf.has(s)) {
156
+ this.structOf.set(s, region);
157
+ }
158
+ if (this.structBlocks.has(s)) {
159
+ for (const b of this.structBlocks.get(s)) {
160
+ blocks.add(b);
161
+ }
162
+ }
163
+ else {
164
+ blocks.add(s);
165
+ }
166
+ }
164
167
  prepareBuildLoops() {
165
168
  let dom = this.buildDominator();
166
169
  let loops = [];
@@ -590,22 +593,23 @@ class AbstractFlowGraph {
590
593
  reduce(rtype, nodeSet) {
591
594
  let region = this.createRegion(rtype, nodeSet);
592
595
  region === null || region === void 0 ? void 0 : region.replace();
593
- if (region) {
594
- this.structTypes.set(region, rtype);
595
- let blocks = new Set();
596
- for (const s of nodeSet) {
597
- this.structOf.set(s, region);
598
- if (this.structBlocks.has(s)) {
599
- for (const b of this.structBlocks.get(s)) {
600
- blocks.add(b);
601
- }
602
- }
603
- else {
604
- blocks.add(s);
596
+ if (region === undefined) {
597
+ return undefined;
598
+ }
599
+ this.structTypes.set(region, rtype);
600
+ let blocks = new Set();
601
+ for (const s of nodeSet) {
602
+ this.structOf.set(s, region);
603
+ if (this.structBlocks.has(s)) {
604
+ for (const b of this.structBlocks.get(s)) {
605
+ blocks.add(b);
605
606
  }
606
607
  }
607
- this.structBlocks.set(region, blocks);
608
+ else {
609
+ blocks.add(s);
610
+ }
608
611
  }
612
+ this.structBlocks.set(region, blocks);
609
613
  return region;
610
614
  }
611
615
  setIntersect(a, b) {
@@ -1 +1 @@
1
- {"version":3,"file":"FileUtils.d.ts","sourceRoot":"","sources":["../../src/utils/FileUtils.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,qBAAa,SAAS;IAClB,gBAAuB,WAAW;;;MAGjC;WAEa,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;WASzC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;WASrC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;WAIrC,iBAAiB,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;WA4BxE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,QAAQ;CAc1F;AAED,qBAAa,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;gBAED,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAIzC;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,GAAG,CAAC,MAAM,CAAqB,GAAG,MAAM,CA0BrH"}
1
+ {"version":3,"file":"FileUtils.d.ts","sourceRoot":"","sources":["../../src/utils/FileUtils.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,qBAAa,SAAS;IAClB,gBAAuB,WAAW;;;MAGjC;WAEa,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;WASzC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;WASrC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;WAIrC,iBAAiB,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC;WA8BlG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,QAAQ;CAc1F;AAED,qBAAa,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;gBAED,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAIzC;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,GAAG,CAAC,MAAM,CAAqB,GAAG,MAAM,CA0BrH"}
@@ -79,19 +79,21 @@ class FileUtils {
79
79
  }
80
80
  });
81
81
  ohPkgContentMap.forEach((content, filePath) => {
82
- if (content.dependencies) {
83
- Object.entries(content.dependencies).forEach(([name, value]) => {
84
- if (!moduleMap.get(name)) {
85
- const modulePath = path_1.default.resolve(path_1.default.dirname(filePath), value.replace('file:', ''));
86
- const key = path_1.default.resolve(modulePath, EtsConst_1.OH_PACKAGE_JSON5);
87
- const target = ohPkgContentMap.get(key);
88
- if (target) {
89
- moduleMap.set(name, new ModulePath(modulePath, target.main ?
90
- path_1.default.resolve(modulePath, target.main) : ''));
91
- }
92
- }
93
- });
82
+ if (!content.dependencies) {
83
+ return;
94
84
  }
85
+ Object.entries(content.dependencies).forEach(([name, value]) => {
86
+ if (moduleMap.get(name)) {
87
+ return;
88
+ }
89
+ const modulePath = path_1.default.resolve(path_1.default.dirname(filePath), value.replace('file:', ''));
90
+ const key = path_1.default.resolve(modulePath, EtsConst_1.OH_PACKAGE_JSON5);
91
+ const target = ohPkgContentMap.get(key);
92
+ if (target) {
93
+ moduleMap.set(name, new ModulePath(modulePath, target.main ?
94
+ path_1.default.resolve(modulePath, target.main) : ''));
95
+ }
96
+ });
95
97
  });
96
98
  return moduleMap;
97
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"callGraphUtils.d.ts","sourceRoot":"","sources":["../../src/utils/callGraphUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAM7E,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,cAAc,CAAyB;IAE/C,IAAI,QAAQ,IAAI,eAAe,EAAE,CAEhC;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,EAEnC;IAED,IAAI,aAAa,IAAI,eAAe,EAAE,CAErC;IAED,IAAI,aAAa,CAAC,IAAI,EAAE,eAAe,EAAE,EAExC;IAEM,cAAc,CAAC,SAAS,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS;IAIvE,mBAAmB,CAAC,SAAS,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O,CAOtG;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAY5D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,GAAG,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAsB1I;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO/D"}
@@ -92,15 +92,16 @@ class SceneManager {
92
92
  }
93
93
  getMethod(method) {
94
94
  let targetMethod = this._scene.getMethod(method);
95
- if (targetMethod == null) {
96
- // 支持SDK调用解析
97
- let file = this._scene.getFile(method.getDeclaringClassSignature().getDeclaringFileSignature());
98
- if (file) {
99
- const methods = ModelUtils_1.ModelUtils.getAllMethodsInFile(file);
100
- for (let methodUnderFile of methods) {
101
- if (method.toString() === methodUnderFile.getSignature().toString()) {
102
- return methodUnderFile;
103
- }
95
+ if (targetMethod != null) {
96
+ return targetMethod;
97
+ }
98
+ // 支持SDK调用解析
99
+ let file = this._scene.getFile(method.getDeclaringClassSignature().getDeclaringFileSignature());
100
+ if (file) {
101
+ const methods = ModelUtils_1.ModelUtils.getAllMethodsInFile(file);
102
+ for (let methodUnderFile of methods) {
103
+ if (method.toString() === methodUnderFile.getSignature().toString()) {
104
+ return methodUnderFile;
104
105
  }
105
106
  }
106
107
  }
@@ -110,14 +111,15 @@ class SceneManager {
110
111
  if (typeof arkClass.getClassName() === "undefined")
111
112
  return null;
112
113
  let classInstance = this._scene.getClass(arkClass);
113
- if (classInstance == null) {
114
- let sdkOrTargetProjectFile = this._scene.getFile(arkClass.getDeclaringFileSignature());
115
- // TODO: support get sdk class, targetProject class waiting to be supported
116
- if (sdkOrTargetProjectFile != null) {
117
- for (let classUnderFile of ModelUtils_1.ModelUtils.getAllClassesInFile(sdkOrTargetProjectFile)) {
118
- if (classUnderFile.getSignature().toString() === arkClass.toString()) {
119
- return classUnderFile;
120
- }
114
+ if (classInstance != null) {
115
+ return classInstance;
116
+ }
117
+ let sdkOrTargetProjectFile = this._scene.getFile(arkClass.getDeclaringFileSignature());
118
+ // TODO: support get sdk class, targetProject class waiting to be supported
119
+ if (sdkOrTargetProjectFile != null) {
120
+ for (let classUnderFile of ModelUtils_1.ModelUtils.getAllClassesInFile(sdkOrTargetProjectFile)) {
121
+ if (classUnderFile.getSignature().toString() === arkClass.toString()) {
122
+ return classUnderFile;
121
123
  }
122
124
  }
123
125
  }
@@ -132,12 +134,13 @@ class SceneManager {
132
134
  if (tempClass == null)
133
135
  continue;
134
136
  let firstLevelSubclasses = Array.from(tempClass.getExtendedClasses().values());
135
- if (firstLevelSubclasses) {
136
- for (let subclass of firstLevelSubclasses) {
137
- if (!isItemRegistered(subclass, extendedClasses, (a, b) => a.getSignature().toString() === b.getSignature().toString())) {
138
- // 子类未处理,加入到classList
139
- classList.push(subclass);
140
- }
137
+ if (!firstLevelSubclasses) {
138
+ continue;
139
+ }
140
+ for (let subclass of firstLevelSubclasses) {
141
+ if (!isItemRegistered(subclass, extendedClasses, (a, b) => a.getSignature().toString() === b.getSignature().toString())) {
142
+ // 子类未处理,加入到classList
143
+ classList.push(subclass);
141
144
  }
142
145
  }
143
146
  // 当前类处理完毕,标记为已处理
@@ -1 +1 @@
1
- {"version":3,"file":"entryMethodUtils.d.ts","sourceRoot":"","sources":["../../src/utils/entryMethodUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,eAAO,MAAM,qBAAqB,EAAE,MAAM,EA2BvC,CAAC;AACJ,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAiBtC,CAAC;AAEJ,eAAO,MAAM,+BAA+B,EAAE,MAAM,EAkBnD,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAcpF;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,QAS5C"}
1
+ {"version":3,"file":"entryMethodUtils.d.ts","sourceRoot":"","sources":["../../src/utils/entryMethodUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,eAAO,MAAM,qBAAqB,EAAE,MAAM,EA2BvC,CAAC;AACJ,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAiBtC,CAAC;AAEJ,eAAO,MAAM,+BAA+B,EAAE,MAAM,EAkBnD,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAkBpF;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,QAS5C"}
@@ -83,14 +83,17 @@ exports.COMPONENT_LIFECYCLE_METHOD_NAME = [
83
83
  ];
84
84
  function getCallbackMethodFromStmt(stmt, scene) {
85
85
  const invokeExpr = stmt.getInvokeExpr();
86
- if (invokeExpr && invokeExpr.getMethodSignature().getDeclaringClassSignature().getClassName() === '' && exports.CALLBACK_METHOD_NAME.includes(invokeExpr.getMethodSignature().getMethodSubSignature().getMethodName())) {
87
- for (const arg of invokeExpr.getArgs()) {
88
- const argType = arg.getType();
89
- if (argType instanceof Type_1.FunctionType) {
90
- const cbMethod = scene.getMethod(argType.getMethodSignature());
91
- if (cbMethod) {
92
- return cbMethod;
93
- }
86
+ if (invokeExpr === undefined ||
87
+ invokeExpr.getMethodSignature().getDeclaringClassSignature().getClassName() !== '' ||
88
+ !exports.CALLBACK_METHOD_NAME.includes(invokeExpr.getMethodSignature().getMethodSubSignature().getMethodName())) {
89
+ return null;
90
+ }
91
+ for (const arg of invokeExpr.getArgs()) {
92
+ const argType = arg.getType();
93
+ if (argType instanceof Type_1.FunctionType) {
94
+ const cbMethod = scene.getMethod(argType.getMethodSignature());
95
+ if (cbMethod) {
96
+ return cbMethod;
94
97
  }
95
98
  }
96
99
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arkanalyzer",
3
- "version": "1.0.29",
4
- "commit_id": "48e41990",
3
+ "version": "1.0.31",
4
+ "commit_id": "b0ddd978",
5
5
  "files": [
6
6
  "docs",
7
7
  "lib",