arkanalyzer 1.0.40 → 1.0.42

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 (115) hide show
  1. package/config/arkanalyzer.json +1 -2
  2. package/lib/Scene.d.ts.map +1 -1
  3. package/lib/Scene.js +9 -2
  4. package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts.map +1 -1
  5. package/lib/callgraph/algorithm/ClassHierarchyAnalysis.js +3 -4
  6. package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
  7. package/lib/callgraph/algorithm/RapidTypeAnalysis.js +7 -8
  8. package/lib/callgraph/model/CallGraph.d.ts +5 -5
  9. package/lib/callgraph/model/CallGraph.d.ts.map +1 -1
  10. package/lib/callgraph/model/CallGraph.js +18 -21
  11. package/lib/callgraph/model/CallSite.d.ts +16 -6
  12. package/lib/callgraph/model/CallSite.d.ts.map +1 -1
  13. package/lib/callgraph/model/CallSite.js +48 -8
  14. package/lib/callgraph/model/builder/CallGraphBuilder.d.ts +0 -1
  15. package/lib/callgraph/model/builder/CallGraphBuilder.d.ts.map +1 -1
  16. package/lib/callgraph/model/builder/CallGraphBuilder.js +0 -8
  17. package/lib/callgraph/pointerAnalysis/Pag.d.ts +3 -6
  18. package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
  19. package/lib/callgraph/pointerAnalysis/Pag.js +6 -29
  20. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +6 -15
  21. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
  22. package/lib/callgraph/pointerAnalysis/PagBuilder.js +63 -81
  23. package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts +2 -1
  24. package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
  25. package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +12 -8
  26. package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.d.ts +9 -3
  27. package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.d.ts.map +1 -1
  28. package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.js +12 -5
  29. package/lib/callgraph/pointerAnalysis/context/Context.d.ts +69 -0
  30. package/lib/callgraph/pointerAnalysis/context/Context.d.ts.map +1 -0
  31. package/lib/callgraph/pointerAnalysis/context/Context.js +202 -0
  32. package/lib/callgraph/pointerAnalysis/context/ContextItem.d.ts +40 -0
  33. package/lib/callgraph/pointerAnalysis/context/ContextItem.d.ts.map +1 -0
  34. package/lib/callgraph/pointerAnalysis/context/ContextItem.js +99 -0
  35. package/lib/callgraph/pointerAnalysis/context/ContextSelector.d.ts +46 -0
  36. package/lib/callgraph/pointerAnalysis/context/ContextSelector.d.ts.map +1 -0
  37. package/lib/callgraph/pointerAnalysis/context/ContextSelector.js +138 -0
  38. package/lib/core/base/Expr.d.ts +1 -0
  39. package/lib/core/base/Expr.d.ts.map +1 -1
  40. package/lib/core/base/Expr.js +9 -0
  41. package/lib/core/common/ArkIRTransformer.d.ts +1 -0
  42. package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
  43. package/lib/core/common/ArkIRTransformer.js +58 -2
  44. package/lib/core/common/ArkValueTransformer.d.ts +1 -1
  45. package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
  46. package/lib/core/common/IRInference.d.ts +1 -1
  47. package/lib/core/common/IRInference.d.ts.map +1 -1
  48. package/lib/core/common/IRInference.js +7 -3
  49. package/lib/core/common/ModelUtils.js +1 -1
  50. package/lib/core/common/SdkUtils.d.ts +2 -1
  51. package/lib/core/common/SdkUtils.d.ts.map +1 -1
  52. package/lib/core/common/SdkUtils.js +33 -23
  53. package/lib/core/common/TypeInference.d.ts.map +1 -1
  54. package/lib/core/common/TypeInference.js +5 -3
  55. package/lib/core/dataflow/DataflowSolver.js +3 -3
  56. package/lib/core/dataflow/UndefinedVariable.js +2 -2
  57. package/lib/core/graph/BaseExplicitGraph.d.ts +1 -0
  58. package/lib/core/graph/BaseExplicitGraph.d.ts.map +1 -1
  59. package/lib/core/graph/BaseExplicitGraph.js +3 -0
  60. package/lib/core/graph/BasicBlock.d.ts.map +1 -1
  61. package/lib/core/graph/BasicBlock.js +9 -4
  62. package/lib/core/graph/Cfg.d.ts.map +1 -1
  63. package/lib/core/graph/Cfg.js +4 -1
  64. package/lib/core/graph/builder/CfgBuilder.d.ts +2 -1
  65. package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
  66. package/lib/core/graph/builder/CfgBuilder.js +54 -10
  67. package/lib/core/graph/builder/ConditionBuilder.d.ts +2 -1
  68. package/lib/core/graph/builder/ConditionBuilder.d.ts.map +1 -1
  69. package/lib/core/graph/builder/ConditionBuilder.js +7 -3
  70. package/lib/core/graph/builder/TrapBuilder.d.ts +19 -1
  71. package/lib/core/graph/builder/TrapBuilder.d.ts.map +1 -1
  72. package/lib/core/graph/builder/TrapBuilder.js +195 -68
  73. package/lib/core/model/ArkMethod.d.ts.map +1 -1
  74. package/lib/core/model/ArkMethod.js +3 -4
  75. package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
  76. package/lib/core/model/builder/ArkClassBuilder.js +42 -21
  77. package/lib/core/model/builder/ArkImportBuilder.js +28 -25
  78. package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  79. package/lib/core/model/builder/ArkMethodBuilder.js +1 -2
  80. package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
  81. package/lib/core/model/builder/builderUtils.js +2 -1
  82. package/lib/index.d.ts +0 -1
  83. package/lib/index.d.ts.map +1 -1
  84. package/lib/index.js +2 -4
  85. package/lib/pass/Context.d.ts +47 -0
  86. package/lib/pass/Context.d.ts.map +1 -0
  87. package/lib/pass/Context.js +72 -0
  88. package/lib/pass/Dispatcher.d.ts +102 -0
  89. package/lib/pass/Dispatcher.d.ts.map +1 -0
  90. package/lib/pass/Dispatcher.js +202 -0
  91. package/lib/pass/Pass.d.ts +83 -0
  92. package/lib/pass/Pass.d.ts.map +1 -0
  93. package/lib/pass/Pass.js +95 -0
  94. package/lib/pass/ScenePassMgr.d.ts +73 -0
  95. package/lib/pass/ScenePassMgr.d.ts.map +1 -0
  96. package/lib/pass/ScenePassMgr.js +156 -0
  97. package/lib/pass/SceneValidator.d.ts +215 -0
  98. package/lib/pass/SceneValidator.d.ts.map +1 -0
  99. package/lib/pass/SceneValidator.js +339 -0
  100. package/lib/save/JsonPrinter.d.ts.map +1 -1
  101. package/lib/save/JsonPrinter.js +26 -102
  102. package/lib/save/arkir/ArkIRMethodPrinter.d.ts.map +1 -1
  103. package/lib/save/arkir/ArkIRMethodPrinter.js +13 -5
  104. package/lib/save/source/SourceStmt.d.ts +1 -0
  105. package/lib/save/source/SourceStmt.d.ts.map +1 -1
  106. package/lib/save/source/SourceStmt.js +13 -8
  107. package/lib/utils/FileUtils.d.ts.map +1 -1
  108. package/lib/utils/FileUtils.js +13 -6
  109. package/lib/utils/ValueAsserts.d.ts +9 -0
  110. package/lib/utils/ValueAsserts.d.ts.map +1 -0
  111. package/lib/utils/ValueAsserts.js +89 -0
  112. package/package.json +2 -2
  113. package/lib/callgraph/pointerAnalysis/Context.d.ts +0 -38
  114. package/lib/callgraph/pointerAnalysis/Context.d.ts.map +0 -1
  115. package/lib/callgraph/pointerAnalysis/Context.js +0 -154
@@ -316,32 +316,28 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
316
316
  const instanceInitStmts = [];
317
317
  let staticBlockId = 0;
318
318
  clsNode.members.forEach(member => {
319
- if (ohos_typescript_1.default.isMethodDeclaration(member) ||
320
- ohos_typescript_1.default.isConstructorDeclaration(member) ||
321
- ohos_typescript_1.default.isMethodSignature(member) ||
322
- ohos_typescript_1.default.isConstructSignatureDeclaration(member) ||
323
- ohos_typescript_1.default.isAccessor(member) ||
324
- ohos_typescript_1.default.isCallSignatureDeclaration(member)) {
319
+ if (isClassMethod(member)) {
325
320
  // these node types have been handled at the beginning of this function by calling buildMethodsForClass
326
321
  return;
327
322
  }
328
- else if (ohos_typescript_1.default.isPropertyDeclaration(member) || ohos_typescript_1.default.isPropertySignature(member)) {
323
+ if (ohos_typescript_1.default.isPropertyDeclaration(member) || ohos_typescript_1.default.isPropertySignature(member)) {
329
324
  const arkField = (0, ArkFieldBuilder_1.buildProperty2ArkField)(member, sourceFile, cls);
330
- if (ohos_typescript_1.default.isClassDeclaration(clsNode) || ohos_typescript_1.default.isClassExpression(clsNode) || ohos_typescript_1.default.isStructDeclaration(clsNode)) {
331
- if (arkField.isStatic()) {
332
- getInitStmts(staticIRTransformer, arkField, member.initializer);
333
- arkField.getInitializer().forEach(stmt => staticInitStmts.push(stmt));
334
- }
335
- else {
336
- if (!instanceIRTransformer) {
337
- console.log(clsNode.getText(sourceFile));
338
- }
339
- getInitStmts(instanceIRTransformer, arkField, member.initializer);
340
- arkField.getInitializer().forEach(stmt => instanceInitStmts.push(stmt));
341
- }
325
+ if (!ohos_typescript_1.default.isClassDeclaration(clsNode) && !ohos_typescript_1.default.isClassExpression(clsNode) && !ohos_typescript_1.default.isStructDeclaration(clsNode)) {
326
+ return;
327
+ }
328
+ if (arkField.isStatic()) {
329
+ getInitStmts(staticIRTransformer, arkField, member.initializer);
330
+ arkField.getInitializer().forEach(stmt => staticInitStmts.push(stmt));
331
+ return;
342
332
  }
333
+ if (!instanceIRTransformer) {
334
+ console.log(clsNode.getText(sourceFile));
335
+ }
336
+ getInitStmts(instanceIRTransformer, arkField, member.initializer);
337
+ arkField.getInitializer().forEach(stmt => instanceInitStmts.push(stmt));
338
+ return;
343
339
  }
344
- else if (ohos_typescript_1.default.isEnumMember(member)) {
340
+ if (ohos_typescript_1.default.isEnumMember(member)) {
345
341
  const arkField = (0, ArkFieldBuilder_1.buildProperty2ArkField)(member, sourceFile, cls);
346
342
  getInitStmts(staticIRTransformer, arkField, member.initializer);
347
343
  arkField.getInitializer().forEach(stmt => staticInitStmts.push(stmt));
@@ -369,6 +365,14 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
369
365
  (0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticInitStmts, staticIRTransformer.getThisLocal());
370
366
  }
371
367
  }
368
+ function isClassMethod(member) {
369
+ return (ohos_typescript_1.default.isMethodDeclaration(member) ||
370
+ ohos_typescript_1.default.isConstructorDeclaration(member) ||
371
+ ohos_typescript_1.default.isMethodSignature(member) ||
372
+ ohos_typescript_1.default.isConstructSignatureDeclaration(member) ||
373
+ ohos_typescript_1.default.isAccessor(member) ||
374
+ ohos_typescript_1.default.isCallSignatureDeclaration(member));
375
+ }
372
376
  function buildMethodsForClass(clsNode, cls, sourceFile) {
373
377
  clsNode.members.forEach(member => {
374
378
  if (ohos_typescript_1.default.isMethodDeclaration(member) ||
@@ -394,6 +398,24 @@ function buildParameterProperty2ArkField(params, cls, sourceFile) {
394
398
  return;
395
399
  }
396
400
  params.forEach(parameter => {
401
+ let fieldName;
402
+ if (ohos_typescript_1.default.isIdentifier(parameter.name)) {
403
+ fieldName = parameter.name.text;
404
+ }
405
+ else if (ohos_typescript_1.default.isObjectBindingPattern(parameter.name)) {
406
+ // TODO
407
+ logger.warn(`Need to support param property with ObjectBindingPattern node type: ${cls.getSignature().toString()}!`);
408
+ return;
409
+ }
410
+ else if (ohos_typescript_1.default.isArrayBindingPattern(parameter.name)) {
411
+ // TODO
412
+ logger.warn(`Need to support param property with ArrayBindingPattern node type: ${cls.getSignature().toString()}!`);
413
+ return;
414
+ }
415
+ else {
416
+ logger.warn(`Need to support param property with new node type: ${cls.getSignature().toString()}!`);
417
+ return;
418
+ }
397
419
  if (parameter.modifiers === undefined || !ohos_typescript_1.default.isIdentifier(parameter.name)) {
398
420
  return;
399
421
  }
@@ -402,7 +424,6 @@ function buildParameterProperty2ArkField(params, cls, sourceFile) {
402
424
  field.setCode(parameter.getText(sourceFile));
403
425
  field.setCategory(ArkField_1.FieldCategory.PARAMETER_PROPERTY);
404
426
  field.setOriginPosition(Position_1.LineColPosition.buildFromNode(parameter, sourceFile));
405
- let fieldName = parameter.name.text;
406
427
  let fieldType;
407
428
  if (parameter.type) {
408
429
  fieldType = (0, builderUtils_1.buildGenericType)((0, builderUtils_1.tsNode2Type)(parameter.type, sourceFile, field), field);
@@ -54,9 +54,10 @@ function buildImportDeclarationNode(node, sourceFile, arkFile) {
54
54
  importInfo.setTsSourceCode(tsSourceCode);
55
55
  IRUtils_1.IRUtils.setComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
56
56
  importInfos.push(importInfo);
57
+ return importInfos;
57
58
  }
58
59
  //just like: import fs from 'fs'
59
- if (node.importClause && node.importClause.name && ohos_typescript_1.default.isIdentifier(node.importClause.name)) {
60
+ if (node.importClause.name && ohos_typescript_1.default.isIdentifier(node.importClause.name)) {
60
61
  let importClauseName = node.importClause.name.text;
61
62
  const pos = Position_1.LineColPosition.buildFromNode(node.importClause.name, sourceFile);
62
63
  let importType = 'Identifier';
@@ -66,34 +67,36 @@ function buildImportDeclarationNode(node, sourceFile, arkFile) {
66
67
  IRUtils_1.IRUtils.setComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
67
68
  importInfos.push(importInfo);
68
69
  }
70
+ if (node.importClause.namedBindings === undefined) {
71
+ return importInfos;
72
+ }
69
73
  // just like: import {xxx} from './yyy'
70
- if (node.importClause && node.importClause.namedBindings && ohos_typescript_1.default.isNamedImports(node.importClause.namedBindings)) {
71
- let importType = 'NamedImports';
72
- if (node.importClause.namedBindings.elements) {
73
- node.importClause.namedBindings.elements.forEach(element => {
74
- if (element.name && ohos_typescript_1.default.isIdentifier(element.name)) {
75
- let importClauseName = element.name.text;
76
- const pos = Position_1.LineColPosition.buildFromNode(element, sourceFile);
77
- if (element.propertyName && ohos_typescript_1.default.isIdentifier(element.propertyName)) {
78
- let importInfo = new ArkImport_1.ImportInfo();
79
- importInfo.build(importClauseName, importType, importFrom, pos, modifiers, element.propertyName.text);
80
- importInfo.setTsSourceCode(tsSourceCode);
81
- IRUtils_1.IRUtils.setComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
82
- importInfos.push(importInfo);
83
- }
84
- else {
85
- let importInfo = new ArkImport_1.ImportInfo();
86
- importInfo.build(importClauseName, importType, importFrom, pos, modifiers);
87
- importInfo.setTsSourceCode(tsSourceCode);
88
- IRUtils_1.IRUtils.setComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
89
- importInfos.push(importInfo);
90
- }
91
- }
92
- });
74
+ if (ohos_typescript_1.default.isNamedImports(node.importClause.namedBindings)) {
75
+ const elements = node.importClause.namedBindings.elements;
76
+ if (elements === undefined) {
77
+ return importInfos;
93
78
  }
79
+ let importType = 'NamedImports';
80
+ elements.forEach(element => {
81
+ if (element.name === undefined || !ohos_typescript_1.default.isIdentifier(element.name)) {
82
+ return;
83
+ }
84
+ let importClauseName = element.name.text;
85
+ const pos = Position_1.LineColPosition.buildFromNode(element, sourceFile);
86
+ let importInfo = new ArkImport_1.ImportInfo();
87
+ if (element.propertyName && ohos_typescript_1.default.isIdentifier(element.propertyName)) {
88
+ importInfo.build(importClauseName, importType, importFrom, pos, modifiers, element.propertyName.text);
89
+ }
90
+ else {
91
+ importInfo.build(importClauseName, importType, importFrom, pos, modifiers);
92
+ }
93
+ importInfo.setTsSourceCode(tsSourceCode);
94
+ IRUtils_1.IRUtils.setComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
95
+ importInfos.push(importInfo);
96
+ });
94
97
  }
95
98
  // just like: import * as ts from 'ohos-typescript'
96
- if (node.importClause && node.importClause.namedBindings && ohos_typescript_1.default.isNamespaceImport(node.importClause.namedBindings)) {
99
+ if (ohos_typescript_1.default.isNamespaceImport(node.importClause.namedBindings)) {
97
100
  let importType = 'NamespaceImport';
98
101
  if (node.importClause.namedBindings.name && ohos_typescript_1.default.isIdentifier(node.importClause.namedBindings.name)) {
99
102
  let importClauseName = node.importClause.namedBindings.name.text;
@@ -1 +1 @@
1
- {"version":3,"file":"ArkMethodBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkMethodBuilder.ts"],"names":[],"mapp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,WAAW,CAAuC;IAC1D,OAAO,CAAC,aAAa,CAAsC;;IAIpD,OAAO,IAAI,MAAM;IAIjB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI3B,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAIzB,UAAU,IAAI,OAAO;IAIrB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAIpC,iBAAiB,IAAI,OAAO;IAI5B,iBAAiB,CAAC,cAAc,EAAE,OAAO,GAAG,IAAI;IAIhD,aAAa,CAAC,OAAO,EAAE,6BAA6B,GAAG,IAAI;IAI3D,cAAc,IAAI,6BAA6B,EAAE;IAIjD,cAAc,CAAC,WAAW,EAAE,6BAA6B,EAAE,GAAG,IAAI;IAIlE,eAAe,CAAC,OAAO,EAAE,4BAA4B,GAAG,IAAI;IAI5D,gBAAgB,IAAI,4BAA4B,EAAE;IAIlD,gBAAgB,CAAC,aAAa,EAAE,4BAA4B,EAAE,GAAG,IAAI;IAIrE,OAAO,IAAI,KAAK,EAAE;CAG5B;AAsBD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CA0DnE;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,SAAS,EAAE,qBAAqB,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAuB5G;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,SAAS,GAAG,IAAI,CA+BjE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAepE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI,CAsC3E"}
@@ -391,8 +391,7 @@ function addInitInConstructor(constructor) {
391
391
  if (cfg === undefined) {
392
392
  return;
393
393
  }
394
- const blocks = cfg.getBlocks();
395
- const firstBlockStmts = [...blocks][0].getStmts();
394
+ const firstBlockStmts = cfg.getStartingBlock().getStmts();
396
395
  let index = 0;
397
396
  for (let i = 0; i < firstBlockStmts.length; i++) {
398
397
  const stmt = firstBlockStmts[i];
@@ -1 +1 @@
1
- {"version":3,"file":"builderUtils.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/builderUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,oBAAoB,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EACH,SAAS,EAIT,WAAW,EAGX,IAAI,EAIP,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAA4D,eAAe,EAAiC,MAAM,oBAAoB,CAAC;AAyB9I,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,GAAG,MAAM,CAUlE;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,EAAE,CAAC,wBAAwB,GAAG,MAAM,CAYxF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,CAUxF;AA2BD,wBAAgB,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAUpD;AAED,wBAAgB,oBAAoB,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAkBxG;AAED,wBAAgB,mBAAmB,CAC/B,cAAc,EAAE,EAAE,CAAC,SAAS,CAAC,wBAAwB,CAAC,EACtD,UAA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ACnD,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAC7C,IAAI,CA8FN;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAiDxD"}
@@ -281,7 +281,8 @@ function buildParameters(params, arkInstance, sourceFile) {
281
281
  }
282
282
  // initializer
283
283
  if (parameter.initializer) {
284
- //TODO?
284
+ // For param with initializer, it is actually optional param. The cfgBuilder will do the last initializer things.
285
+ methodParameter.setOptional(true);
285
286
  }
286
287
  // dotDotDotToken
287
288
  if (parameter.dotDotDotToken) {
package/lib/index.d.ts CHANGED
@@ -4,7 +4,6 @@ export { RapidTypeAnalysis } from './callgraph/algorithm/RapidTypeAnalysis';
4
4
  export { PTAStat, PAGStat, CGStat } from './callgraph/common/Statistics';
5
5
  export * from './callgraph/model/CallGraph';
6
6
  export { CallGraphBuilder } from './callgraph/model/builder/CallGraphBuilder';
7
- export { KLimitedContextSensitive } from './callgraph/pointerAnalysis/Context';
8
7
  export { DummyCallCreator } from './callgraph/pointerAnalysis/DummyCallCreator';
9
8
  export * from './callgraph/pointerAnalysis/Pag';
10
9
  export { CSFuncID, PagBuilder } from './callgraph/pointerAnalysis/PagBuilder';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAG5E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGzE,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,C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AqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,cAAc,4CAA4C,CAAC;AAG3D,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,CAAC"}
package/lib/index.js CHANGED
@@ -31,8 +31,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  return (mod && mod.__esModule) ? mod : { "default": mod };
32
32
  };
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.ArkFile = exports.SCCDetection = exports.BaseExplicitGraph = exports.BaseNode = exports.BaseEdge = exports.DominanceTree = exports.DominanceFinder = exports.Cfg = exports.BasicBlock = exports.UndefinedVariableSolver = exports.UndefinedVariableChecker = exports.Fact = exports.PathEdge = exports.PathEdgePoint = exports.DataflowSolver = exports.DataflowResult = exports.DataflowProblem = exports.Scope = exports.VisibleValue = exports.ValueUtil = exports.TypeInference = exports.StmtUseReplacer = exports.RefUseReplacer = exports.IRUtils = exports.ExprUseReplacer = exports.DummyMainCreater = exports.ModelUtils = exports.FullPosition = exports.LineColPosition = exports.Local = exports.DefUseChain = exports.Decorator = exports.Constant = exports.DVFGBuilder = exports.DVFG = exports.DiffPTData = exports.PtsSet = exports.PointerAnalysisConfig = exports.PointerAnalysis = exports.PagBuilder = exports.CSFuncID = exports.DummyCallCreator = exports.KLimitedContextSensitive = exports.CallGraphBuilder = exports.CGStat = exports.PAGStat = exports.PTAStat = exports.RapidTypeAnalysis = exports.ClassHierarchyAnalysis = exports.AbstractAnalysis = void 0;
35
- exports.ts = exports.Logger = exports.LOG_MODULE_TYPE = exports.LOG_LEVEL = exports.ViewTreePrinter = exports.GraphPrinter = exports.JsonPrinter = exports.SourceFilePrinter = exports.SourceNamespacePrinter = exports.SourceClassPrinter = exports.SourceMethodPrinter = exports.DotFilePrinter = exports.DotNamespacePrinter = exports.DotClassPrinter = exports.DotMethodPrinter = exports.PrinterBuilder = exports.Printer = exports.Scene = exports.SceneConfig = exports.ArkBody = exports.ImportInfo = exports.ExportInfo = exports.ArkField = exports.ArkMethod = exports.ArkClass = exports.ArkNamespace = void 0;
34
+ exports.ArkNamespace = exports.ArkFile = exports.SCCDetection = exports.BaseExplicitGraph = exports.BaseNode = exports.BaseEdge = exports.DominanceTree = exports.DominanceFinder = exports.Cfg = exports.BasicBlock = exports.UndefinedVariableSolver = exports.UndefinedVariableChecker = exports.Fact = exports.PathEdge = exports.PathEdgePoint = exports.DataflowSolver = exports.DataflowResult = exports.DataflowProblem = exports.Scope = exports.VisibleValue = exports.ValueUtil = exports.TypeInference = exports.StmtUseReplacer = exports.RefUseReplacer = exports.IRUtils = exports.ExprUseReplacer = exports.DummyMainCreater = exports.ModelUtils = exports.FullPosition = exports.LineColPosition = exports.Local = exports.DefUseChain = exports.Decorator = exports.Constant = exports.DVFGBuilder = exports.DVFG = exports.DiffPTData = exports.PtsSet = exports.PointerAnalysisConfig = exports.PointerAnalysis = exports.PagBuilder = exports.CSFuncID = exports.DummyCallCreator = exports.CallGraphBuilder = exports.CGStat = exports.PAGStat = exports.PTAStat = exports.RapidTypeAnalysis = exports.ClassHierarchyAnalysis = exports.AbstractAnalysis = void 0;
35
+ exports.ts = exports.Logger = exports.LOG_MODULE_TYPE = exports.LOG_LEVEL = exports.ViewTreePrinter = exports.GraphPrinter = exports.JsonPrinter = exports.SourceFilePrinter = exports.SourceNamespacePrinter = exports.SourceClassPrinter = exports.SourceMethodPrinter = exports.DotFilePrinter = exports.DotNamespacePrinter = exports.DotClassPrinter = exports.DotMethodPrinter = exports.PrinterBuilder = exports.Printer = exports.Scene = exports.SceneConfig = exports.ArkBody = exports.ImportInfo = exports.ExportInfo = exports.ArkField = exports.ArkMethod = exports.ArkClass = void 0;
36
36
  // callgraph/algorithm
37
37
  var AbstractAnalysis_1 = require("./callgraph/algorithm/AbstractAnalysis");
38
38
  Object.defineProperty(exports, "AbstractAnalysis", { enumerable: true, get: function () { return AbstractAnalysis_1.AbstractAnalysis; } });
@@ -50,8 +50,6 @@ __exportStar(require("./callgraph/model/CallGraph"), exports);
50
50
  var CallGraphBuilder_1 = require("./callgraph/model/builder/CallGraphBuilder");
51
51
  Object.defineProperty(exports, "CallGraphBuilder", { enumerable: true, get: function () { return CallGraphBuilder_1.CallGraphBuilder; } });
52
52
  // callgraph/pointerAnalysis
53
- var Context_1 = require("./callgraph/pointerAnalysis/Context");
54
- Object.defineProperty(exports, "KLimitedContextSensitive", { enumerable: true, get: function () { return Context_1.KLimitedContextSensitive; } });
55
53
  var DummyCallCreator_1 = require("./callgraph/pointerAnalysis/DummyCallCreator");
56
54
  Object.defineProperty(exports, "DummyCallCreator", { enumerable: true, get: function () { return DummyCallCreator_1.DummyCallCreator; } });
57
55
  __exportStar(require("./callgraph/pointerAnalysis/Pag"), exports);
@@ -0,0 +1,47 @@
1
+ export type AnyKey<T> = {
2
+ new (): T;
3
+ };
4
+ export interface CtxArg {
5
+ readonly name: string;
6
+ }
7
+ export type UniMap<T> = Map<AnyKey<T>, T>;
8
+ interface Upper {
9
+ readonly upper: Upper;
10
+ readonly unreachable: boolean;
11
+ }
12
+ /**
13
+ * Represents the root implementation of the Upper interface.
14
+ * Provides a singleton instance to ensure a single point of access.
15
+ * The class is designed to maintain immutability for its properties.
16
+ * The `getInstance` method allows retrieval of the singleton instance.
17
+ */
18
+ export declare class UpperRoot implements Upper {
19
+ readonly upper: any;
20
+ readonly unreachable = true;
21
+ private static INSTANCE;
22
+ static getInstance(): UpperRoot;
23
+ }
24
+ /**
25
+ * Represents a context that manages a map of arguments and provides methods to manipulate them.
26
+ * Implements the Upper interface, allowing for hierarchical structures.
27
+ * The context maintains a reference to its upper context and provides utilities to traverse the hierarchy.
28
+ *
29
+ * The `unreachable` property indicates whether this context is considered unreachable in the hierarchy.
30
+ * The `upper` property refers to the parent or enclosing context.
31
+ * The `args` property is a map that stores key-value pairs specific to this context.
32
+ *
33
+ * Provides methods to retrieve, add, and remove entries from the argument map.
34
+ * Allows traversal to the root context in the hierarchy by following the chain of upper contexts.
35
+ */
36
+ export declare class Context<U extends Upper, T> implements Upper {
37
+ unreachable: boolean;
38
+ upper: U;
39
+ protected args: UniMap<T>;
40
+ constructor(upper: U);
41
+ get<K extends T>(k: AnyKey<K>): K | undefined;
42
+ set<K extends T>(k: AnyKey<K>, v: K): void;
43
+ remove<K extends T>(k: AnyKey<K>): K | undefined;
44
+ root(): Upper;
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=Context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/pass/Context.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IAAE,QAAO,CAAC,CAAA;CAAE,CAAC;AAErC,MAAM,WAAW,MAAM;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAGD,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1C,UAAU,KAAK;IACX,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,qBAAa,SAAU,YAAW,KAAK;IACnC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;IACpB,QAAQ,CAAC,WAAW,QAAQ;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmB;IAE1C,MAAM,CAAC,WAAW,IAAI,SAAS;CAGlC;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,OAAO,CAAC,CAAC,SAAS,KAAK,EAAE,CAAC,CAAE,YAAW,KAAK;IACrD,WAAW,EAAE,OAAO,CAAS;IAC7B,KAAK,EAAE,CAAC,CAAC;IACT,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;gBAEd,KAAK,EAAE,CAAC;IAKpB,GAAG,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAI7C,GAAG,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI;IAI1C,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAMhD,IAAI,IAAI,KAAK;CAQhB"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Context = exports.UpperRoot = void 0;
18
+ /**
19
+ * Represents the root implementation of the Upper interface.
20
+ * Provides a singleton instance to ensure a single point of access.
21
+ * The class is designed to maintain immutability for its properties.
22
+ * The `getInstance` method allows retrieval of the singleton instance.
23
+ */
24
+ class UpperRoot {
25
+ constructor() {
26
+ this.unreachable = true;
27
+ }
28
+ static getInstance() {
29
+ return UpperRoot.INSTANCE;
30
+ }
31
+ }
32
+ exports.UpperRoot = UpperRoot;
33
+ UpperRoot.INSTANCE = new UpperRoot();
34
+ /**
35
+ * Represents a context that manages a map of arguments and provides methods to manipulate them.
36
+ * Implements the Upper interface, allowing for hierarchical structures.
37
+ * The context maintains a reference to its upper context and provides utilities to traverse the hierarchy.
38
+ *
39
+ * The `unreachable` property indicates whether this context is considered unreachable in the hierarchy.
40
+ * The `upper` property refers to the parent or enclosing context.
41
+ * The `args` property is a map that stores key-value pairs specific to this context.
42
+ *
43
+ * Provides methods to retrieve, add, and remove entries from the argument map.
44
+ * Allows traversal to the root context in the hierarchy by following the chain of upper contexts.
45
+ */
46
+ class Context {
47
+ constructor(upper) {
48
+ this.unreachable = false;
49
+ this.upper = upper;
50
+ this.args = new Map();
51
+ }
52
+ get(k) {
53
+ return this.args.get(k);
54
+ }
55
+ set(k, v) {
56
+ this.args.set(k, v);
57
+ }
58
+ remove(k) {
59
+ const v = this.get(k);
60
+ this.args.delete(k);
61
+ return v;
62
+ }
63
+ root() {
64
+ let up = this;
65
+ // upper is root,
66
+ while (!up.upper.unreachable) {
67
+ up = up.upper;
68
+ }
69
+ return up;
70
+ }
71
+ }
72
+ exports.Context = Context;
@@ -0,0 +1,102 @@
1
+ import { Value } from '../core/base/Value';
2
+ import { ArkAliasTypeDefineStmt, ArkAssignStmt, ArkIfStmt, ArkInvokeStmt, ArkReturnStmt, ArkReturnVoidStmt, ArkThrowStmt, Stmt } from '../core/base/Stmt';
3
+ import { AbstractBinopExpr, AbstractExpr, AbstractInvokeExpr, AliasTypeExpr, ArkAwaitExpr, ArkCastExpr, ArkConditionExpr, ArkDeleteExpr, ArkInstanceInvokeExpr, ArkInstanceOfExpr, ArkNewArrayExpr, ArkNewExpr, ArkNormalBinopExpr, ArkPhiExpr, ArkPtrInvokeExpr, ArkStaticInvokeExpr, ArkTypeOfExpr, ArkUnopExpr, ArkYieldExpr } from '../core/base/Expr';
4
+ import { FallAction, MethodCtx } from './Pass';
5
+ import { BigIntConstant, BooleanConstant, Constant, NullConstant, NumberConstant, StringConstant, UndefinedConstant } from '../core/base/Constant';
6
+ import { ArkMethod } from '../core/model/ArkMethod';
7
+ import { Local } from '../core/base/Local';
8
+ import { AbstractFieldRef, AbstractRef, ArkCaughtExceptionRef, ArkInstanceFieldRef, ArkParameterRef, ArkStaticFieldRef, ArkThisRef, ClosureFieldRef, GlobalRef } from '../core/base/Ref';
9
+ /**
10
+ * Represents a function type that processes a value and context, optionally returning a FallAction to control flow.
11
+ * This function is invoked with a value of type T , a context object and a method object, and it can decide whether to skip subsequent passes.
12
+
13
+ * @param value:T - The inst to be executed
14
+ * @param ctx:MethodCtx - The method context of this inst
15
+ * @param mtd:ArkMethod - The method of this inst
16
+ * @returns If a FallAction is returned, it indicates the action to take regarding skipping or halting further processing.
17
+ * Returning nothing or void implies no special action, allowing the next passes to execute normally.
18
+ */
19
+ export interface InstPass<T> {
20
+ (value: T, ctx: MethodCtx, mtd: ArkMethod): FallAction | void;
21
+ }
22
+ type IndexOf<T extends readonly any[]> = Extract<keyof T, `${number}`>;
23
+ /**
24
+ * Represents all statement types used within the system.
25
+ */
26
+ declare const STMTS: readonly [typeof ArkAssignStmt, typeof ArkInvokeStmt, typeof ArkIfStmt, typeof ArkReturnStmt, typeof ArkReturnVoidStmt, typeof ArkThrowStmt, typeof ArkAliasTypeDefineStmt, typeof Stmt];
27
+ /**
28
+ * class of stmts
29
+ */
30
+ export type StmtClass = typeof STMTS[number];
31
+ /**
32
+ * stmts classes
33
+ */
34
+ export type StmtTy = {
35
+ [K in IndexOf<typeof STMTS>]: InstanceType<typeof STMTS[K]>;
36
+ }[IndexOf<typeof STMTS>];
37
+ type StmtPass = {
38
+ [K in IndexOf<typeof STMTS>]: InstPass<InstanceType<typeof STMTS[K]>>;
39
+ }[IndexOf<typeof STMTS>];
40
+ type StmtList<S extends StmtClass> = [S, InstPass<InstanceType<S>>[] | InstPass<InstanceType<S>>];
41
+ /**
42
+ * Represents an initialization statement type derived from the `STMTS` constant.
43
+ * This type maps each index of the `STMTS` array to a corresponding `StmtList` type,
44
+ * effectively creating a union of all possible statement list types defined by `STMTS`.
45
+ * It is used to ensure type safety and consistency when working with statement lists
46
+ * associated with the `STMTS` entries.
47
+ */
48
+ export type StmtInit = {
49
+ [K in IndexOf<typeof STMTS>]: StmtList<typeof STMTS[K]>;
50
+ }[IndexOf<typeof STMTS>];
51
+ /**
52
+ * Represents all values types used within the system.
53
+ */
54
+ declare const VALUES: readonly [typeof AliasTypeExpr, typeof ArkUnopExpr, typeof ArkPhiExpr, typeof ArkCastExpr, typeof ArkInstanceOfExpr, typeof ArkTypeOfExpr, typeof ArkNormalBinopExpr, typeof ArkConditionExpr, typeof AbstractBinopExpr, typeof ArkYieldExpr, typeof ArkAwaitExpr, typeof ArkDeleteExpr, typeof ArkNewArrayExpr, typeof ArkNewExpr, typeof ArkPtrInvokeExpr, typeof ArkStaticInvokeExpr, typeof ArkInstanceInvokeExpr, typeof AbstractInvokeExpr, typeof AbstractExpr, typeof ClosureFieldRef, typeof GlobalRef, typeof ArkCaughtExceptionRef, typeof ArkThisRef, typeof ArkParameterRef, typeof ArkStaticFieldRef, typeof ArkInstanceFieldRef, typeof AbstractFieldRef, typeof AbstractRef, typeof UndefinedConstant, typeof NullConstant, typeof StringConstant, typeof BigIntConstant, typeof NumberConstant, typeof BooleanConstant, typeof Constant, typeof Local];
55
+ /**
56
+ * class of stmts
57
+ */
58
+ type ValueClass = typeof VALUES[number];
59
+ /**
60
+ * stmts classes
61
+ */
62
+ export type ValueTy = {
63
+ [K in IndexOf<typeof VALUES>]: InstanceType<typeof VALUES[K]>;
64
+ }[IndexOf<typeof VALUES>];
65
+ type ValuePass = {
66
+ [K in IndexOf<typeof VALUES>]: InstPass<InstanceType<typeof VALUES[K]>>;
67
+ }[IndexOf<typeof VALUES>];
68
+ type ValuePair<S extends ValueClass> = [S, InstPass<InstanceType<S>>[] | InstPass<InstanceType<S>>];
69
+ /**
70
+ * Represents an initialization value for a specific index in the VALUES array.
71
+ * This type maps each index of the VALUES array to a corresponding ValuePair type,
72
+ * ensuring that only valid initialization values for the given index are allowed.
73
+ * The resulting type is a union of all possible ValuePair types derived from the VALUES array.
74
+ */
75
+ export type ValueInit = {
76
+ [K in IndexOf<typeof VALUES>]: ValuePair<typeof VALUES[K]>;
77
+ }[IndexOf<typeof VALUES>];
78
+ /**
79
+ * the dispatch table, it can be cached
80
+ */
81
+ export declare class Dispatch {
82
+ name: string;
83
+ readonly stmts: StmtClass[];
84
+ readonly smap: Map<StmtClass, StmtPass[]>;
85
+ readonly values: ValueClass[];
86
+ readonly vmap: Map<ValueClass, ValuePass[]>;
87
+ constructor(stmts?: StmtInit[], values?: ValueInit[]);
88
+ }
89
+ /**
90
+ * the ArkIR dispatcher, to dispatch stmts and values actions
91
+ */
92
+ export declare class Dispatcher {
93
+ private readonly ctx;
94
+ protected fallAction: FallAction;
95
+ private readonly dispatch;
96
+ private cache;
97
+ constructor(ctx: MethodCtx, dispatch?: Dispatch);
98
+ dispatchStmt(mtd: ArkMethod, stmt: Stmt): void;
99
+ dispatchValue(mtd: ArkMethod, value: Value): void;
100
+ }
101
+ export {};
102
+ //# sourceMappingURL=Dispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dispatcher.d.ts","sourceRoot":"","sources":["../../src/pass/Dispatcher.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACH,sBAAsB,EAAE,aAAa,EACrC,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,IAAI,EACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,iBAAiB,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAChF,WAAW,EACX,gBAAgB,EAAE,aAAa,EAAE,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