arkanalyzer 1.0.82 → 1.0.84

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 (59) hide show
  1. package/lib/Scene.d.ts.map +1 -1
  2. package/lib/Scene.js +2 -1
  3. package/lib/callgraph/algorithm/AbstractAnalysis.d.ts +1 -0
  4. package/lib/callgraph/algorithm/AbstractAnalysis.d.ts.map +1 -1
  5. package/lib/callgraph/algorithm/AbstractAnalysis.js +8 -0
  6. package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts.map +1 -1
  7. package/lib/callgraph/algorithm/ClassHierarchyAnalysis.js +20 -16
  8. package/lib/callgraph/model/CallGraph.d.ts.map +1 -1
  9. package/lib/callgraph/model/CallGraph.js +5 -2
  10. package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
  11. package/lib/core/common/ArkIRTransformer.js +3 -7
  12. package/lib/core/common/ArkValueTransformer.d.ts +4 -2
  13. package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
  14. package/lib/core/common/ArkValueTransformer.js +49 -7
  15. package/lib/core/common/Const.d.ts +10 -0
  16. package/lib/core/common/Const.d.ts.map +1 -1
  17. package/lib/core/common/Const.js +12 -1
  18. package/lib/core/common/DummyMainCreater.d.ts +32 -2
  19. package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
  20. package/lib/core/common/DummyMainCreater.js +235 -97
  21. package/lib/core/common/EtsConst.d.ts +2 -0
  22. package/lib/core/common/EtsConst.d.ts.map +1 -1
  23. package/lib/core/common/EtsConst.js +3 -1
  24. package/lib/core/common/ModelUtils.d.ts +1 -0
  25. package/lib/core/common/ModelUtils.d.ts.map +1 -1
  26. package/lib/core/common/ModelUtils.js +2 -0
  27. package/lib/core/common/SdkUtils.d.ts +2 -0
  28. package/lib/core/common/SdkUtils.d.ts.map +1 -1
  29. package/lib/core/common/SdkUtils.js +13 -1
  30. package/lib/core/graph/BasicBlock.d.ts +1 -1
  31. package/lib/core/graph/BasicBlock.d.ts.map +1 -1
  32. package/lib/core/graph/BasicBlock.js +4 -1
  33. package/lib/core/graph/builder/CfgBuilder.d.ts +1 -0
  34. package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
  35. package/lib/core/graph/builder/CfgBuilder.js +5 -1
  36. package/lib/core/graph/builder/ConditionBuilder.d.ts +1 -0
  37. package/lib/core/graph/builder/ConditionBuilder.d.ts.map +1 -1
  38. package/lib/core/graph/builder/ConditionBuilder.js +40 -24
  39. package/lib/core/inference/ModelInference.d.ts.map +1 -1
  40. package/lib/core/inference/ModelInference.js +9 -3
  41. package/lib/core/inference/arkts/ArkTsInference.d.ts.map +1 -1
  42. package/lib/core/inference/arkts/ArkTsInference.js +2 -1
  43. package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  44. package/lib/core/model/builder/ArkMethodBuilder.js +3 -2
  45. package/lib/save/source/SourceStmt.d.ts +2 -0
  46. package/lib/save/source/SourceStmt.d.ts.map +1 -1
  47. package/lib/save/source/SourceStmt.js +51 -8
  48. package/lib/utils/entryMethodUtils.d.ts.map +1 -1
  49. package/lib/utils/entryMethodUtils.js +20 -11
  50. package/node_modules/ohos-typescript/lib/tsc.js +5724 -5655
  51. package/node_modules/ohos-typescript/lib/tsserver.js +7957 -7935
  52. package/node_modules/ohos-typescript/lib/tsserverlibrary.d.ts +250 -230
  53. package/node_modules/ohos-typescript/lib/tsserverlibrary.js +7933 -7911
  54. package/node_modules/ohos-typescript/lib/typesMap.json +496 -496
  55. package/node_modules/ohos-typescript/lib/typescript.d.ts +250 -230
  56. package/node_modules/ohos-typescript/lib/typescript.js +7834 -7813
  57. package/node_modules/ohos-typescript/lib/typingsInstaller.js +2579 -2378
  58. package/node_modules/ohos-typescript/package.json +1 -1
  59. package/package.json +2 -2
@@ -32,6 +32,11 @@ const ArkSignatureBuilder_1 = require("../model/builder/ArkSignatureBuilder");
32
32
  const TSConst_1 = require("./TSConst");
33
33
  const ArkMethodBuilder_1 = require("../model/builder/ArkMethodBuilder");
34
34
  const ValueUtil_1 = require("./ValueUtil");
35
+ const Const_1 = require("./Const");
36
+ const Ref_1 = require("../base/Ref");
37
+ const EtsConst_1 = require("./EtsConst");
38
+ const COMPONENT_BASE_CLASSES = ['CustomComponent', 'ViewPU'];
39
+ const ABILITY_BASE_CLASSES = ['UIExtensionAbility', 'Ability', 'FormExtensionAbility', 'UIAbility', 'BackupExtensionAbility'];
35
40
  /**
36
41
  收集所有的onCreate,onStart等函数,构造一个虚拟函数,具体为:
37
42
  %statInit()
@@ -57,96 +62,90 @@ return
57
62
  */
58
63
  class DummyMainCreater {
59
64
  constructor(scene) {
65
+ // entryMethods includes all UIAbility and Component lifecycle methods as well as all callback methods, but exclude the start and end methods
60
66
  this.entryMethods = [];
67
+ this.entryClasses = [];
68
+ this.abilityCreateMethods = [];
69
+ this.abilityStageCreateMethods = [];
70
+ this.abilityStageDestroyMethods = [];
71
+ this.abilityDestroyMethods = [];
72
+ this.componentAppearMethods = [];
73
+ this.componentDisappearMethods = [];
74
+ this.componentDetachedMethods = [];
75
+ // every declaring class of method in entryMethods have its instance local which is used to be the base of instance invoke expr
61
76
  this.classLocalMap = new Map();
62
77
  this.dummyMain = new ArkMethod_1.ArkMethod();
63
78
  this.tempLocalIndex = 0;
79
+ this.tempBlockIndex = 0;
64
80
  this.scene = scene;
65
81
  // Currently get entries from module.json5 can't visit all of abilities
66
- // Todo: handle ablity/component jump, then get entries from module.json5
67
- this.entryMethods = this.getMethodsFromAllAbilities();
68
- this.entryMethods.push(...this.getEntryMethodsFromComponents());
69
- this.entryMethods.push(...this.getCallbackMethods());
82
+ // Todo: handle ability/component jump, then get entries from module.json5
83
+ this.getMethodsFromAllAbilities();
84
+ this.getEntryMethodsFromComponents();
85
+ this.getCallbackMethods();
70
86
  }
71
87
  setEntryMethods(methods) {
72
88
  this.entryMethods = methods;
73
89
  }
74
90
  createDummyMain() {
75
91
  var _a;
76
- const dummyMainFile = new ArkFile_1.ArkFile(ArkFile_1.Language.JAVASCRIPT);
92
+ // step1: create dummy file
93
+ const dummyMainFile = new ArkFile_1.ArkFile(ArkFile_1.Language.ARKTS1_1);
77
94
  dummyMainFile.setScene(this.scene);
78
- const dummyMainFileSignature = new ArkSignature_1.FileSignature(this.scene.getProjectName(), '@dummyFile');
95
+ const dummyMainFileSignature = new ArkSignature_1.FileSignature(this.scene.getProjectName(), Const_1.DUMMY_FILE);
79
96
  dummyMainFile.setFileSignature(dummyMainFileSignature);
80
97
  this.scene.setFile(dummyMainFile);
98
+ // step2: create dummy class
81
99
  const dummyMainClass = new ArkClass_1.ArkClass();
82
100
  dummyMainClass.setDeclaringArkFile(dummyMainFile);
83
- const dummyMainClassSignature = new ArkSignature_1.ClassSignature('@dummyClass', dummyMainClass.getDeclaringArkFile().getFileSignature(), ((_a = dummyMainClass.getDeclaringArkNamespace()) === null || _a === void 0 ? void 0 : _a.getSignature()) || null);
101
+ const dummyMainClassSignature = new ArkSignature_1.ClassSignature(Const_1.DUMMY_CLASS, dummyMainClass.getDeclaringArkFile().getFileSignature(), ((_a = dummyMainClass.getDeclaringArkNamespace()) === null || _a === void 0 ? void 0 : _a.getSignature()) || null);
84
102
  dummyMainClass.setSignature(dummyMainClassSignature);
85
103
  dummyMainFile.addArkClass(dummyMainClass);
86
- this.dummyMain = new ArkMethod_1.ArkMethod();
104
+ // step3: create dummy method
87
105
  this.dummyMain.setDeclaringArkClass(dummyMainClass);
88
- const methodSubSignature = ArkSignatureBuilder_1.ArkSignatureBuilder.buildMethodSubSignatureFromMethodName('@dummyMain');
106
+ const methodSubSignature = ArkSignatureBuilder_1.ArkSignatureBuilder.buildMethodSubSignatureFromMethodName(Const_1.DUMMY_METHOD);
89
107
  const methodSignature = new ArkSignature_1.MethodSignature(this.dummyMain.getDeclaringArkClass().getSignature(), methodSubSignature);
90
108
  this.dummyMain.setImplementationSignature(methodSignature);
91
109
  this.dummyMain.setLineCol(0);
110
+ this.dummyMain.setIsGeneratedFlag(true);
92
111
  (0, ArkMethodBuilder_1.checkAndUpdateMethod)(this.dummyMain, dummyMainClass);
93
112
  dummyMainClass.addMethod(this.dummyMain);
94
- let defaultMethods = [];
95
- for (const method of this.entryMethods) {
96
- if (method.getDeclaringArkClass().isDefaultArkClass() || method.isStatic()) {
97
- defaultMethods.push(method);
113
+ this.scene.addToMethodsMap(this.dummyMain);
114
+ // step4: create instance local for each class
115
+ for (const cls of this.entryClasses) {
116
+ if (cls.isDefaultArkClass()) {
98
117
  continue;
99
118
  }
100
- const declaringArkClass = method.getDeclaringArkClass();
101
- let newLocal = null;
102
- for (const local of this.classLocalMap.values()) {
103
- if ((local === null || local === void 0 ? void 0 : local.getType()).getClassSignature() === declaringArkClass.getSignature()) {
104
- newLocal = local;
105
- break;
106
- }
107
- }
119
+ let newLocal = this.classLocalMap.get(cls);
108
120
  if (!newLocal) {
109
- newLocal = new Local_1.Local('%' + this.tempLocalIndex, new Type_1.ClassType(declaringArkClass.getSignature()));
110
- this.tempLocalIndex++;
121
+ newLocal = new Local_1.Local('%' + this.tempLocalIndex++, new Type_1.ClassType(cls.getSignature()));
122
+ this.classLocalMap.set(cls, newLocal);
111
123
  }
112
- this.classLocalMap.set(method, newLocal);
113
- }
114
- for (const defaultMethod of defaultMethods) {
115
- this.classLocalMap.set(defaultMethod, null);
116
124
  }
117
- const localSet = new Set(Array.from(this.classLocalMap.values()).filter((value) => value !== null));
118
- const dummyBody = new ArkBody_1.ArkBody(localSet, this.createDummyMainCfg());
119
- this.dummyMain.setBody(dummyBody);
125
+ // step5: create dummy method body
126
+ const localSet = new Set(this.classLocalMap.values());
127
+ const dummyCfg = new Cfg_1.Cfg();
128
+ this.dummyMain.setBody(new ArkBody_1.ArkBody(localSet, dummyCfg));
129
+ dummyCfg.setDeclaringMethod(this.dummyMain);
130
+ this.createDummyMainCfg();
120
131
  this.addCfg2Stmt();
121
- this.scene.addToMethodsMap(this.dummyMain);
122
132
  }
123
- addStaticInit(dummyCfg, firstBlock) {
124
- let isStartingStmt = true;
133
+ addStaticInit(firstBlock) {
125
134
  for (const method of this.scene.getStaticInitMethods()) {
126
135
  const staticInvokeExpr = new Expr_1.ArkStaticInvokeExpr(method.getSignature(), []);
127
136
  const invokeStmt = new Stmt_1.ArkInvokeStmt(staticInvokeExpr);
128
- if (isStartingStmt) {
129
- dummyCfg.setStartingStmt(invokeStmt);
130
- isStartingStmt = false;
131
- }
132
137
  firstBlock.addStmt(invokeStmt);
133
138
  }
134
139
  }
135
140
  addClassInit(firstBlock) {
136
- const locals = Array.from(new Set(this.classLocalMap.values()));
137
- for (const local of locals) {
138
- if (!local) {
139
- continue;
140
- }
141
- let clsType = local.getType();
142
- let cls = this.scene.getClass(clsType.getClassSignature());
143
- const assStmt = new Stmt_1.ArkAssignStmt(local, new Expr_1.ArkNewExpr(clsType));
141
+ for (const [cls, local] of this.classLocalMap) {
142
+ const assStmt = new Stmt_1.ArkAssignStmt(local, new Expr_1.ArkNewExpr(cls.getSignature().getType()));
144
143
  firstBlock.addStmt(assStmt);
145
144
  local.setDeclaringStmt(assStmt);
146
145
  let consMtd = cls.getMethodWithName(TSConst_1.CONSTRUCTOR_NAME);
147
146
  if (consMtd) {
148
147
  let ivkExpr = new Expr_1.ArkInstanceInvokeExpr(local, consMtd.getSignature(), []);
149
- let ivkStmt = new Stmt_1.ArkInvokeStmt(ivkExpr);
148
+ let ivkStmt = new Stmt_1.ArkAssignStmt(local, ivkExpr);
150
149
  firstBlock.addStmt(ivkStmt);
151
150
  }
152
151
  }
@@ -184,64 +183,84 @@ class DummyMainCreater {
184
183
  count++;
185
184
  const condition = new Expr_1.ArkConditionExpr(countLocal, new Constant_1.Constant(count.toString(), Type_1.NumberType.getInstance()), Expr_1.RelationalBinaryOperator.Equality);
186
185
  const ifStmt = new Stmt_1.ArkIfStmt(condition);
187
- const ifBlock = new BasicBlock_1.BasicBlock();
186
+ const ifBlock = new BasicBlock_1.BasicBlock(this.tempBlockIndex++);
188
187
  ifBlock.addStmt(ifStmt);
189
188
  dummyCfg.addBlock(ifBlock);
190
189
  for (const block of lastBlocks) {
191
- ifBlock.addPredecessorBlock(block);
192
- block.addSuccessorBlock(ifBlock);
193
- }
194
- const invokeBlock = new BasicBlock_1.BasicBlock();
195
- const paramLocals = [];
196
- this.addParamInit(method, paramLocals, invokeBlock);
197
- const local = this.classLocalMap.get(method);
198
- let invokeExpr;
199
- if (local) {
200
- invokeExpr = new Expr_1.ArkInstanceInvokeExpr(local, method.getSignature(), paramLocals);
201
- }
202
- else {
203
- invokeExpr = new Expr_1.ArkStaticInvokeExpr(method.getSignature(), paramLocals);
190
+ this.linkBlocks(block, ifBlock);
204
191
  }
205
- const invokeStmt = new Stmt_1.ArkInvokeStmt(invokeExpr);
206
- invokeBlock.addStmt(invokeStmt);
192
+ const invokeBlock = new BasicBlock_1.BasicBlock(this.tempBlockIndex++);
193
+ this.addMethodsInvokeStmt(invokeBlock, [method]);
207
194
  dummyCfg.addBlock(invokeBlock);
208
- ifBlock.addSuccessorBlock(invokeBlock);
209
- invokeBlock.addPredecessorBlock(ifBlock);
195
+ this.linkBlocks(ifBlock, invokeBlock);
210
196
  lastBlocks = [ifBlock, invokeBlock];
211
197
  }
212
198
  for (const block of lastBlocks) {
213
- block.addSuccessorBlock(whileBlock);
214
- whileBlock.addPredecessorBlock(block);
199
+ this.linkBlocks(block, whileBlock);
215
200
  }
216
201
  }
217
202
  createDummyMainCfg() {
218
- const dummyCfg = new Cfg_1.Cfg();
219
- dummyCfg.setDeclaringMethod(this.dummyMain);
220
- const firstBlock = new BasicBlock_1.BasicBlock();
221
- this.addStaticInit(dummyCfg, firstBlock);
203
+ const dummyCfg = this.dummyMain.getCfg();
204
+ // step1: create the first block which includes:
205
+ // 1. all static invoke of static init methods
206
+ // 2. all class new expr
207
+ // 3. all instance invoke of instance init methods
208
+ // 4. all start lifecycle methods in sequence
209
+ const firstBlock = new BasicBlock_1.BasicBlock(this.tempBlockIndex++);
210
+ const dummyClassType = new Type_1.ClassType(this.dummyMain.getDeclaringArkClass().getSignature());
211
+ const startingStmt = new Stmt_1.ArkAssignStmt(new Local_1.Local(TSConst_1.THIS_NAME, dummyClassType), new Ref_1.ArkThisRef(dummyClassType));
212
+ firstBlock.addStmt(startingStmt);
213
+ dummyCfg.setStartingStmt(startingStmt);
214
+ this.addStaticInit(firstBlock);
222
215
  this.addClassInit(firstBlock);
216
+ this.addMethodsInvokeStmt(firstBlock, this.abilityCreateMethods);
217
+ this.addMethodsInvokeStmt(firstBlock, this.abilityStageCreateMethods);
218
+ this.addMethodsInvokeStmt(firstBlock, this.componentAppearMethods);
223
219
  const countLocal = new Local_1.Local('count', Type_1.NumberType.getInstance());
220
+ this.dummyMain.getBody().addLocal(countLocal.getName(), countLocal);
224
221
  const zero = ValueUtil_1.ValueUtil.getOrCreateNumberConst(0);
225
222
  const countAssignStmt = new Stmt_1.ArkAssignStmt(countLocal, zero);
226
- const truE = ValueUtil_1.ValueUtil.getBooleanConstant(true);
227
- const conditionTrue = new Expr_1.ArkConditionExpr(truE, zero, Expr_1.RelationalBinaryOperator.Equality);
228
- const whileStmt = new Stmt_1.ArkIfStmt(conditionTrue);
229
223
  firstBlock.addStmt(countAssignStmt);
230
224
  dummyCfg.addBlock(firstBlock);
231
- dummyCfg.setStartingStmt(firstBlock.getHead());
232
- const whileBlock = new BasicBlock_1.BasicBlock();
225
+ // step2: create the while condition block
226
+ const whileBlock = new BasicBlock_1.BasicBlock(this.tempBlockIndex++);
227
+ const conditionTrue = new Expr_1.ArkConditionExpr(ValueUtil_1.ValueUtil.getBooleanConstant(true), ValueUtil_1.ValueUtil.getBooleanConstant(false), Expr_1.RelationalBinaryOperator.InEquality);
228
+ const whileStmt = new Stmt_1.ArkIfStmt(conditionTrue);
233
229
  whileBlock.addStmt(whileStmt);
234
230
  dummyCfg.addBlock(whileBlock);
235
- firstBlock.addSuccessorBlock(whileBlock);
236
- whileBlock.addPredecessorBlock(firstBlock);
231
+ this.linkBlocks(firstBlock, whileBlock);
232
+ // step3: create the following cfgs
237
233
  this.addBranches(whileBlock, countLocal, dummyCfg);
234
+ // step4: create the last return block
235
+ const returnBlock = new BasicBlock_1.BasicBlock(this.tempBlockIndex++);
236
+ this.addMethodsInvokeStmt(returnBlock, this.componentDisappearMethods);
237
+ this.addMethodsInvokeStmt(returnBlock, this.abilityStageDestroyMethods);
238
+ this.addMethodsInvokeStmt(returnBlock, this.componentDetachedMethods);
239
+ this.addMethodsInvokeStmt(returnBlock, this.abilityDestroyMethods);
238
240
  const returnStmt = new Stmt_1.ArkReturnVoidStmt();
239
- const returnBlock = new BasicBlock_1.BasicBlock();
240
241
  returnBlock.addStmt(returnStmt);
241
242
  dummyCfg.addBlock(returnBlock);
242
- whileBlock.addSuccessorBlock(returnBlock);
243
- returnBlock.addPredecessorBlock(whileBlock);
244
- return dummyCfg;
243
+ this.linkBlocks(whileBlock, returnBlock);
244
+ }
245
+ addMethodsInvokeStmt(block, methods) {
246
+ for (const method of methods) {
247
+ const paramLocals = [];
248
+ this.addParamInit(method, paramLocals, block);
249
+ const local = this.classLocalMap.get(method.getDeclaringArkClass());
250
+ let invokeExpr;
251
+ if (local) {
252
+ invokeExpr = new Expr_1.ArkInstanceInvokeExpr(local, method.getSignature(), paramLocals);
253
+ }
254
+ else {
255
+ invokeExpr = new Expr_1.ArkStaticInvokeExpr(method.getSignature(), paramLocals);
256
+ }
257
+ const invokeStmt = new Stmt_1.ArkInvokeStmt(invokeExpr);
258
+ block.addStmt(invokeStmt);
259
+ }
260
+ }
261
+ linkBlocks(firstBlock, nextBlock) {
262
+ firstBlock.addSuccessorBlock(nextBlock);
263
+ nextBlock.addPredecessorBlock(firstBlock);
245
264
  }
246
265
  addCfg2Stmt() {
247
266
  const cfg = this.dummyMain.getCfg();
@@ -258,26 +277,37 @@ class DummyMainCreater {
258
277
  return this.dummyMain;
259
278
  }
260
279
  getEntryMethodsFromComponents() {
261
- const COMPONENT_BASE_CLASSES = ['CustomComponent', 'ViewPU'];
262
- let methods = [];
263
280
  this.scene
264
281
  .getClasses()
265
282
  .filter(cls => {
266
283
  if (COMPONENT_BASE_CLASSES.includes(cls.getSuperClassName())) {
267
284
  return true;
268
285
  }
269
- if (cls.hasDecorator('Component')) {
270
- return true;
271
- }
272
- return false;
286
+ return cls.hasDecorator(EtsConst_1.COMPONENT);
273
287
  })
274
288
  .forEach(cls => {
275
- methods.push(...cls.getMethods().filter(mtd => entryMethodUtils_1.COMPONENT_LIFECYCLE_METHOD_NAME.includes(mtd.getName())));
289
+ this.entryClasses.push(cls);
290
+ for (const mtd of cls.getMethods()) {
291
+ const name = mtd.getName();
292
+ if (name === Const_1.COMPONENT_START_METHOD) {
293
+ this.componentAppearMethods.push(mtd);
294
+ continue;
295
+ }
296
+ if (name === Const_1.COMPONENT_DISAPPEAR_METHOD) {
297
+ this.componentDisappearMethods.push(mtd);
298
+ continue;
299
+ }
300
+ if (name === Const_1.COMPONENT_DETACHED_METHOD) {
301
+ this.componentDetachedMethods.push(mtd);
302
+ continue;
303
+ }
304
+ if (entryMethodUtils_1.COMPONENT_LIFECYCLE_METHOD_NAME.includes(name)) {
305
+ this.entryMethods.push(mtd);
306
+ }
307
+ }
276
308
  });
277
- return methods;
278
309
  }
279
310
  classInheritsAbility(arkClass) {
280
- const ABILITY_BASE_CLASSES = ['UIExtensionAbility', 'Ability', 'FormExtensionAbility', 'UIAbility', 'BackupExtensionAbility'];
281
311
  if (ABILITY_BASE_CLASSES.includes(arkClass.getSuperClassName())) {
282
312
  return true;
283
313
  }
@@ -291,17 +321,36 @@ class DummyMainCreater {
291
321
  return false;
292
322
  }
293
323
  getMethodsFromAllAbilities() {
294
- let methods = [];
295
324
  this.scene
296
325
  .getClasses()
297
326
  .filter(cls => this.classInheritsAbility(cls))
298
327
  .forEach(cls => {
299
- methods.push(...cls.getMethods().filter(mtd => entryMethodUtils_1.LIFECYCLE_METHOD_NAME.includes(mtd.getName())));
328
+ this.entryClasses.push(cls);
329
+ for (const mtd of cls.getMethods()) {
330
+ const name = mtd.getName();
331
+ if (name === Const_1.ABILITY_CREATE_METHOD) {
332
+ this.abilityCreateMethods.push(mtd);
333
+ continue;
334
+ }
335
+ if (name === Const_1.ABILITY_STAGE_CREATE_METHOD) {
336
+ this.abilityStageCreateMethods.push(mtd);
337
+ continue;
338
+ }
339
+ if (name === Const_1.ABILITY_STAGE_DESTROY_METHOD) {
340
+ this.abilityStageDestroyMethods.push(mtd);
341
+ continue;
342
+ }
343
+ if (name === Const_1.ABILITY_DESTROY_METHOD) {
344
+ this.abilityDestroyMethods.push(mtd);
345
+ continue;
346
+ }
347
+ if (entryMethodUtils_1.LIFECYCLE_METHOD_NAME.includes(name)) {
348
+ this.entryMethods.push(mtd);
349
+ }
350
+ }
300
351
  });
301
- return methods;
302
352
  }
303
353
  getCallbackMethods() {
304
- const callbackMethods = [];
305
354
  this.scene.getMethods().forEach(method => {
306
355
  if (!method.getCfg()) {
307
356
  return;
@@ -311,12 +360,101 @@ class DummyMainCreater {
311
360
  .getStmts()
312
361
  .forEach(stmt => {
313
362
  const cbMethod = (0, entryMethodUtils_1.getCallbackMethodFromStmt)(stmt, this.scene);
314
- if (cbMethod && !callbackMethods.includes(cbMethod)) {
315
- callbackMethods.push(cbMethod);
363
+ if (cbMethod && !this.entryMethods.includes(cbMethod)) {
364
+ this.entryMethods.push(cbMethod);
316
365
  }
317
366
  });
318
367
  });
319
- return callbackMethods;
368
+ }
369
+ /**
370
+ * Analysis the coverage of files, methods, stmts when starting from the dummy main method according to the given call graph.
371
+ * @param callGraph - the call graph create within ArkAnalyzer
372
+ * @param generated - whether to include the generated methods
373
+ */
374
+ analysisCoverage(callGraph, generated = true) {
375
+ const analysis = new CoverageAnalysis(this.scene, this.dummyMain, callGraph, generated);
376
+ return analysis.calculateCoverage();
320
377
  }
321
378
  }
322
379
  exports.DummyMainCreater = DummyMainCreater;
380
+ class CoverageAnalysis {
381
+ constructor(scene, entry, callGraph, generated = true) {
382
+ this.visitedFiles = new Set();
383
+ this.visitedMethods = new Set();
384
+ this.visitedStmts = new Set();
385
+ this.scene = scene;
386
+ this.callGraph = callGraph;
387
+ this.entry = entry;
388
+ this.totalFiles = new Set(scene.getFiles());
389
+ this.totalMethods = new Set();
390
+ this.totalFiles.forEach(file => {
391
+ file.getClasses().forEach(cls => {
392
+ cls.getMethods(generated).forEach(method => {
393
+ this.totalMethods.add(method);
394
+ });
395
+ });
396
+ });
397
+ // if entry method is dummy main, then it is also generated, but still need to include it
398
+ this.totalMethods.add(entry);
399
+ this.totalStmts = new Set();
400
+ this.totalMethods.forEach(method => {
401
+ var _a;
402
+ (_a = method.getCfg()) === null || _a === void 0 ? void 0 : _a.getStmts().forEach(stmt => {
403
+ this.totalStmts.add(stmt);
404
+ });
405
+ });
406
+ }
407
+ addVisitedFile(file) {
408
+ this.visitedFiles.add(file);
409
+ }
410
+ addVisitedMethod(method) {
411
+ this.visitedMethods.add(method);
412
+ }
413
+ addVisitedStmt(stmt) {
414
+ this.visitedStmts.add(stmt);
415
+ }
416
+ calculateCoverage() {
417
+ this.goThroughMethod(this.entry);
418
+ return {
419
+ filesCoverage: this.visitedFiles.size / this.totalFiles.size,
420
+ methodsCoverage: this.visitedMethods.size / this.totalMethods.size,
421
+ stmtsCoverage: this.visitedStmts.size / this.totalStmts.size,
422
+ totalFiles: this.totalFiles.size,
423
+ totalMethods: this.totalMethods.size,
424
+ totalStmts: this.totalStmts.size,
425
+ visitedFiles: this.visitedFiles.size,
426
+ visitedMethods: this.visitedMethods.size,
427
+ visitedStmts: this.visitedStmts.size,
428
+ };
429
+ }
430
+ /**
431
+ * Scan all invoke stmts of the given method, and go through all callee methods of this given method recursively.
432
+ * @param method
433
+ * @private
434
+ */
435
+ goThroughMethod(method) {
436
+ var _a;
437
+ const file = method.getDeclaringArkFile();
438
+ if (!this.totalFiles.has(file) || !this.totalMethods.has(method) || this.visitedMethods.has(method)) {
439
+ return;
440
+ }
441
+ this.addVisitedMethod(method);
442
+ this.addVisitedFile(file);
443
+ const stmts = (_a = method.getCfg()) === null || _a === void 0 ? void 0 : _a.getStmts();
444
+ if (!stmts) {
445
+ return;
446
+ }
447
+ stmts.forEach(stmt => {
448
+ this.addVisitedStmt(stmt);
449
+ });
450
+ const node = this.callGraph.getCallGraphNodeByMethod(method.getSignature());
451
+ for (const outEdge of node.getOutgoingEdges()) {
452
+ const calleeSig = outEdge.getDstNode().getMethod();
453
+ const callee = this.scene.getMethod(calleeSig);
454
+ if (!callee) {
455
+ continue;
456
+ }
457
+ this.goThroughMethod(callee);
458
+ }
459
+ }
460
+ }
@@ -73,4 +73,6 @@ export declare const ON_OFF: Set<string>;
73
73
  export declare const OH_PACKAGE_JSON5 = "oh-package.json5";
74
74
  export declare const BUILD_PROFILE_JSON5 = "build-profile.json5";
75
75
  export declare const COMPONENT: string;
76
+ export declare const COMMON_METHOD: string;
77
+ export declare const COMPONENT_EXTEND_DECORATOR: Set<string>;
76
78
  //# sourceMappingURL=EtsConst.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EtsConst.d.ts","sourceRoot":"","sources":["../../../src/core/common/EtsConst.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAy4BhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAkB,CAAC;AACpD,eAAO,MAAM,uBAAuB,EAAE,MAAsB,CAAC;AAE7D,eAAO,MAAM,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAAkG,CAAC;AAEpJ,eAAO,MAAM,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAqD/C,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAqE,CAAC;AAClH,eAAO,MAAM,eAAe,EAAE,MAAgB,CAAC;AAC/C,eAAO,MAAM,iBAAiB,EAAE,MAAkB,CAAC;AACnD,eAAO,MAAM,uBAAuB,EAAE,MAAuB,CAAC;AAC9D,eAAO,MAAM,kBAAkB,EAAE,MAAmB,CA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AAM,MAAM,EAAE,GAAG,CAAC,MAAM,CAA0B,CAAC;AAE1D,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,SAAS,EAAE,MAAoB,CAAC;AAC7C,eAAO,MAAM,aAAa,EAAE,MAAuB,CAAC;AACpD,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAqD,CAAC"}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.COMPONENT = exports.BUILD_PROFILE_JSON5 = exports.OH_PACKAGE_JSON5 = exports.ON_OFF = exports.CALL_BACK = exports.COMPONENT_ATTRIBUTE = exports.COMPONENT_INSTANCE = exports.COMPONENT_COMMON = exports.SPECIAL_CONTAINER_COMPONENT = exports.COMPONENT_BUILD_FUNCTION = exports.COMPONENT_BRANCH_FUNCTION = exports.COMPONENT_IF_BRANCH = exports.COMPONENT_IF = exports.COMPONENT_REPEAT = exports.COMPONENT_CUSTOMVIEW = exports.COMPONENT_POP_FUNCTION = exports.COMPONENT_CREATE_FUNCTION = exports.isEtsContainerComponent = exports.isEtsSystemComponent = exports.isEtsAtomicComponent = exports.COMPONENT_BEHAVIOR = exports.BUILDER_PARAM_DECORATOR = exports.BUILDER_DECORATOR = exports.ENTRY_DECORATOR = exports.COMPONENT_DECORATOR = exports.BUILDIN_ATOMIC_COMPONENT = exports.BUILDIN_SYSTEM_COMPONENT = exports.COMPONENT_LAZY_FOR_EACH = exports.COMPONENT_FOR_EACH = exports.ETS_COMPILER_OPTIONS = void 0;
17
+ exports.COMPONENT_EXTEND_DECORATOR = exports.COMMON_METHOD = exports.COMPONENT = exports.BUILD_PROFILE_JSON5 = exports.OH_PACKAGE_JSON5 = exports.ON_OFF = exports.CALL_BACK = exports.COMPONENT_ATTRIBUTE = exports.COMPONENT_INSTANCE = exports.COMPONENT_COMMON = exports.SPECIAL_CONTAINER_COMPONENT = exports.COMPONENT_BUILD_FUNCTION = exports.COMPONENT_BRANCH_FUNCTION = exports.COMPONENT_IF_BRANCH = exports.COMPONENT_IF = exports.COMPONENT_REPEAT = exports.COMPONENT_CUSTOMVIEW = exports.COMPONENT_POP_FUNCTION = exports.COMPONENT_CREATE_FUNCTION = exports.isEtsContainerComponent = exports.isEtsSystemComponent = exports.isEtsAtomicComponent = exports.COMPONENT_BEHAVIOR = exports.BUILDER_PARAM_DECORATOR = exports.BUILDER_DECORATOR = exports.ENTRY_DECORATOR = exports.COMPONENT_DECORATOR = exports.BUILDIN_ATOMIC_COMPONENT = exports.BUILDIN_SYSTEM_COMPONENT = exports.COMPONENT_LAZY_FOR_EACH = exports.COMPONENT_FOR_EACH = exports.ETS_COMPILER_OPTIONS = void 0;
18
18
  exports.ETS_COMPILER_OPTIONS = {
19
19
  ets: {
20
20
  emitDecorators: [
@@ -1012,3 +1012,5 @@ exports.ON_OFF = new Set(['on', 'off']);
1012
1012
  exports.OH_PACKAGE_JSON5 = 'oh-package.json5';
1013
1013
  exports.BUILD_PROFILE_JSON5 = 'build-profile.json5';
1014
1014
  exports.COMPONENT = 'Component';
1015
+ exports.COMMON_METHOD = 'CommonMethod';
1016
+ exports.COMPONENT_EXTEND_DECORATOR = new Set(['Extend', 'Styles', 'AnimatableExtend']);
@@ -13,6 +13,7 @@ import { MethodParameter } from '../model/builder/ArkMethodBuilder';
13
13
  import { Value } from '../base/Value';
14
14
  export declare class ModelUtils {
15
15
  static implicitArkUIBuilderMethods: Set<ArkMethod>;
16
+ static popMethodSignatureCache: Map<string, MethodSignature>;
16
17
  static dispose(): void;
17
18
  static getMethodSignatureFromArkClass(arkClass: ArkClass, methodName: string): MethodSignature | null;
18
19
  static getClassWithNameInNamespaceRecursively(className: string, ns: ArkNamespace): ArkClass | null;
@@ -1 +1 @@
1
- {"version":3,"file":"ModelUtils.d.ts","sourceRoot":"","sources":["../../../src/core/common/ModelUtils.ts"],"names":[],"mapp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itArkUIBuilderMethods.clear();
74
+ this.popMethodSignatureCache.clear();
74
75
  }
75
76
  static getMethodSignatureFromArkClass(arkClass, methodName) {
76
77
  for (const arkMethod of arkClass.getMethods()) {
@@ -648,6 +649,7 @@ class ModelUtils {
648
649
  }
649
650
  exports.ModelUtils = ModelUtils;
650
651
  ModelUtils.implicitArkUIBuilderMethods = new Set();
652
+ ModelUtils.popMethodSignatureCache = new Map();
651
653
  const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ModelUtils');
652
654
  let moduleMap;
653
655
  /**
@@ -4,6 +4,7 @@ import { ArkClass } from '../model/ArkClass';
4
4
  import { ArkMethod } from '../model/ArkMethod';
5
5
  import { AbstractFieldRef } from '../base/Ref';
6
6
  import { Sdk } from '../../Config';
7
+ import { Scene } from '../../Scene';
7
8
  export declare class SdkUtils {
8
9
  private static esVersion;
9
10
  private static esVersionMap;
@@ -27,5 +28,6 @@ export declare class SdkUtils {
27
28
  private static loadGlobalLocal;
28
29
  static copyMembers(from: ArkClass, to: ArkClass): void;
29
30
  static computeGlobalThis(leftOp: AbstractFieldRef, arkMethod: ArkMethod): void;
31
+ static extendArkUI(scene: Scene): void;
30
32
  }
31
33
  //# sourceMappingURL=SdkUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SdkUtils.d.ts","sourceRoot":"","sources":["../../../src/core/common/SdkUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAI3D,OAAO,EAAE,QAAQ,EAAiB,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAMnC,qBAAa,QAAQ;IACjB,OAAO,CAAC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AAI;IAiBpF,OAAO,CAAC,MAAM,CAAC,aAAa;WAWd,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,QAAQ,GAAE,OAAe,GAAG,IAAI;WAY3F,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI;IAgBrF,OAAO,CAAC,MAAM,CAAC,SAAS;IAiBxB,OAAO,CAAC,MAAM,CAAC,eAAe;WA0BhB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,GAAG,IAAI;WAqB/C,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;WAWvE,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAWhD"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
3
+ * Copyright (c) 2024-2026 Huawei Device Co., Ltd.
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
6
6
  * You may obtain a copy of the License at
@@ -48,6 +48,7 @@ const Const_1 = require("./Const");
48
48
  const ArkClass_1 = require("../model/ArkClass");
49
49
  const ArkSignature_1 = require("../model/ArkSignature");
50
50
  const Local_1 = require("../base/Local");
51
+ const ArkMethod_1 = require("../model/ArkMethod");
51
52
  const path_1 = __importDefault(require("path"));
52
53
  const Type_1 = require("../base/Type");
53
54
  const ArkNamespace_1 = require("../model/ArkNamespace");
@@ -277,6 +278,17 @@ class SdkUtils {
277
278
  globalThis.addExportInfo(exportInfo);
278
279
  }
279
280
  }
281
+ static extendArkUI(scene) {
282
+ const cls = scene.getSdkGlobal(EtsConst_1.COMMON_METHOD);
283
+ if (cls instanceof ArkClass_1.ArkClass) {
284
+ const mtd = new ArkMethod_1.ArkMethod();
285
+ mtd.setDeclaringArkClass(cls);
286
+ const methodSubSignature = new ArkSignature_1.MethodSubSignature(EtsConst_1.COMPONENT_POP_FUNCTION, [], Type_1.VoidType.getInstance(), false);
287
+ mtd.setDeclareSignatures(new ArkSignature_1.MethodSignature(cls.getSignature(), methodSubSignature));
288
+ mtd.setIsGeneratedFlag(true);
289
+ cls.addMethod(mtd);
290
+ }
291
+ }
280
292
  }
281
293
  exports.SdkUtils = SdkUtils;
282
294
  SdkUtils.esVersion = 'ES2017';
@@ -17,7 +17,7 @@ export declare class BasicBlock {
17
17
  private successorBlocks;
18
18
  private exceptionalSuccessorBlocks?;
19
19
  private exceptionalPredecessorBlocks?;
20
- constructor();
20
+ constructor(id?: number);
21
21
  getId(): number;
22
22
  setId(id: number): void;
23
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"BasicBlock.d.ts","sourceRoot":"","sources":["../../../src/core/graph/BasicBlock.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+C,IAAI,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAgB,MAAM,oBAAoB,CAAC;AAK5D;;;;;;;;;GASG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,eAAe,CAAoB;IAC3C,OAAO,CAAC,0BAA0B,CAAC,CAAe;IAClD,OAAO,CAAC,4BAA4B,CAAC,CAAe;;IAI7C,KAAK,IAAI,MAAM;IAIf,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI9B;;;OAGG;IACI,QAAQ,IAAI,IAAI,EAAE;IAIlB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAIhC;;;OAGG;IACI,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI;IAQzC;;;OAGG;IACI,OAAO,CAAC,IAAI,EAA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IAAI,IAAI,GAAG,IAAI;IAU7B;;;;;;;;;;;;;;;;;OAiBG;IACI,aAAa,IAAI,UAAU,EAAE;IAIpC;;;OAGG;IACI,eAAe,IAAI,UAAU,EAAE;IAI/B,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAI5C,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO;IAQ5D,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO;IAS1D,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAKhC,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAI1C,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IASlD,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IAShD,QAAQ,IAAI,MAAM;IAQlB,QAAQ,IAAI,QAAQ;IA6B3B,OAAO,CAAC,SAAS;IASV,6BAA6B,IAAI,UAAU,EAAE,GAAG,SAAS;IAIzD,+BAA+B,IAAI,UAAU,EAAE,GAAG,SAAS;IAI3D,8BAA8B,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAMvD,4BAA4B,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAM/D"}
@@ -54,11 +54,14 @@ const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER,
54
54
  * reach these basic blocks through edges.
55
55
  */
56
56
  class BasicBlock {
57
- constructor() {
57
+ constructor(id) {
58
58
  this.id = -1;
59
59
  this.stmts = [];
60
60
  this.predecessorBlocks = [];
61
61
  this.successorBlocks = [];
62
+ if (id !== undefined) {
63
+ this.id = id;
64
+ }
62
65
  }
63
66
  getId() {
64
67
  return this.id;