arkanalyzer 1.0.6 → 1.0.8

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 (224) hide show
  1. package/config/arkanalyzer.json +8 -0
  2. package/docs/IR2ts-stmt.md +81 -0
  3. package/docs/IR2ts.md +82 -0
  4. package/lib/Config.d.ts +29 -1
  5. package/lib/Config.d.ts.map +1 -1
  6. package/lib/Config.js +44 -11
  7. package/lib/Scene.d.ts +152 -9
  8. package/lib/Scene.d.ts.map +1 -1
  9. package/lib/Scene.js +233 -66
  10. package/lib/callgraph/algorithm/AbstractAnalysis.d.ts +2 -1
  11. package/lib/callgraph/algorithm/AbstractAnalysis.d.ts.map +1 -1
  12. package/lib/callgraph/algorithm/AbstractAnalysis.js +14 -7
  13. package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts.map +1 -1
  14. package/lib/callgraph/algorithm/ClassHierarchyAnalysis.js +2 -4
  15. package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
  16. package/lib/callgraph/algorithm/RapidTypeAnalysis.js +2 -3
  17. package/lib/callgraph/common/Statistics.js +1 -1
  18. package/lib/callgraph/model/BaseGraph.js +2 -2
  19. package/lib/callgraph/model/CallGraph.d.ts +3 -2
  20. package/lib/callgraph/model/CallGraph.d.ts.map +1 -1
  21. package/lib/callgraph/model/CallGraph.js +23 -14
  22. package/lib/callgraph/model/builder/CallGraphBuilder.d.ts +2 -2
  23. package/lib/callgraph/model/builder/CallGraphBuilder.js +3 -3
  24. package/lib/callgraph/pointerAnalysis/Context.d.ts.map +1 -1
  25. package/lib/callgraph/pointerAnalysis/Context.js +0 -1
  26. package/lib/callgraph/pointerAnalysis/Pag.d.ts +36 -9
  27. package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
  28. package/lib/callgraph/pointerAnalysis/Pag.js +130 -37
  29. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +34 -5
  30. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
  31. package/lib/callgraph/pointerAnalysis/PagBuilder.js +479 -126
  32. package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts +6 -0
  33. package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
  34. package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +107 -45
  35. package/lib/callgraph/pointerAnalysis/PtsDS.d.ts.map +1 -1
  36. package/lib/callgraph/pointerAnalysis/PtsDS.js +0 -2
  37. package/lib/core/base/Constant.d.ts +37 -5
  38. package/lib/core/base/Constant.d.ts.map +1 -1
  39. package/lib/core/base/Constant.js +58 -8
  40. package/lib/core/base/Expr.d.ts +98 -13
  41. package/lib/core/base/Expr.d.ts.map +1 -1
  42. package/lib/core/base/Expr.js +295 -127
  43. package/lib/core/base/Local.d.ts +70 -5
  44. package/lib/core/base/Local.d.ts.map +1 -1
  45. package/lib/core/base/Local.js +77 -4
  46. package/lib/core/base/Ref.d.ts +79 -5
  47. package/lib/core/base/Ref.d.ts.map +1 -1
  48. package/lib/core/base/Ref.js +143 -38
  49. package/lib/core/base/Stmt.d.ts +126 -12
  50. package/lib/core/base/Stmt.d.ts.map +1 -1
  51. package/lib/core/base/Stmt.js +135 -28
  52. package/lib/core/base/Type.d.ts +11 -2
  53. package/lib/core/base/Type.d.ts.map +1 -1
  54. package/lib/core/base/Type.js +47 -42
  55. package/lib/core/base/Value.d.ts +24 -2
  56. package/lib/core/base/Value.d.ts.map +1 -1
  57. package/lib/core/common/ArkError.d.ts +15 -0
  58. package/lib/core/common/ArkError.d.ts.map +1 -0
  59. package/lib/core/common/ArkError.js +28 -0
  60. package/lib/core/common/ArkIRTransformer.d.ts +12 -5
  61. package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
  62. package/lib/core/common/ArkIRTransformer.js +90 -45
  63. package/lib/core/common/BodyBuilder.d.ts +2 -0
  64. package/lib/core/common/BodyBuilder.d.ts.map +1 -1
  65. package/lib/core/common/BodyBuilder.js +5 -2
  66. package/lib/core/common/Builtin.js +1 -1
  67. package/lib/core/common/CfgBuilder.d.ts +12 -7
  68. package/lib/core/common/CfgBuilder.d.ts.map +1 -1
  69. package/lib/core/common/CfgBuilder.js +336 -140
  70. package/lib/core/common/Const.d.ts +15 -10
  71. package/lib/core/common/Const.d.ts.map +1 -1
  72. package/lib/core/common/Const.js +18 -11
  73. package/lib/core/common/DummyMainCreater.d.ts +5 -4
  74. package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
  75. package/lib/core/common/DummyMainCreater.js +43 -28
  76. package/lib/core/common/EtsConst.d.ts +1 -0
  77. package/lib/core/common/EtsConst.d.ts.map +1 -1
  78. package/lib/core/common/EtsConst.js +2 -1
  79. package/lib/core/common/ExprUseReplacer.js +8 -8
  80. package/lib/core/common/IRUtils.d.ts +7 -0
  81. package/lib/core/common/IRUtils.d.ts.map +1 -1
  82. package/lib/core/common/IRUtils.js +34 -2
  83. package/lib/core/common/ModelUtils.d.ts +1 -0
  84. package/lib/core/common/ModelUtils.d.ts.map +1 -1
  85. package/lib/core/common/ModelUtils.js +39 -36
  86. package/lib/core/common/RefUseReplacer.js +3 -3
  87. package/lib/core/common/StmtUseReplacer.js +4 -4
  88. package/lib/core/common/TSConst.d.ts +10 -3
  89. package/lib/core/common/TSConst.d.ts.map +1 -1
  90. package/lib/core/common/TSConst.js +11 -4
  91. package/lib/core/common/TypeInference.d.ts +8 -2
  92. package/lib/core/common/TypeInference.d.ts.map +1 -1
  93. package/lib/core/common/TypeInference.js +222 -90
  94. package/lib/core/common/ValueUtil.d.ts +0 -4
  95. package/lib/core/common/ValueUtil.d.ts.map +1 -1
  96. package/lib/core/common/ValueUtil.js +10 -27
  97. package/lib/core/common/VisibleValue.js +1 -1
  98. package/lib/core/dataflow/DataflowProblem.d.ts +1 -0
  99. package/lib/core/dataflow/DataflowProblem.d.ts.map +1 -1
  100. package/lib/core/dataflow/DataflowProblem.js +4 -4
  101. package/lib/core/dataflow/DataflowSolver.d.ts +20 -16
  102. package/lib/core/dataflow/DataflowSolver.d.ts.map +1 -1
  103. package/lib/core/dataflow/DataflowSolver.js +67 -78
  104. package/lib/core/dataflow/TiantAnalysis.d.ts +1 -0
  105. package/lib/core/dataflow/TiantAnalysis.d.ts.map +1 -1
  106. package/lib/core/dataflow/TiantAnalysis.js +42 -28
  107. package/lib/core/dataflow/UndefinedVariable.d.ts +15 -1
  108. package/lib/core/dataflow/UndefinedVariable.d.ts.map +1 -1
  109. package/lib/core/dataflow/UndefinedVariable.js +122 -76
  110. package/lib/core/dataflow/Util.d.ts +5 -1
  111. package/lib/core/dataflow/Util.d.ts.map +1 -1
  112. package/lib/core/dataflow/Util.js +43 -22
  113. package/lib/core/graph/BasicBlock.d.ts +72 -0
  114. package/lib/core/graph/BasicBlock.d.ts.map +1 -1
  115. package/lib/core/graph/BasicBlock.js +165 -3
  116. package/lib/core/graph/Cfg.d.ts +30 -1
  117. package/lib/core/graph/Cfg.d.ts.map +1 -1
  118. package/lib/core/graph/Cfg.js +131 -11
  119. package/lib/core/graph/DominanceFinder.js +7 -7
  120. package/lib/core/graph/DominanceTree.js +4 -4
  121. package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
  122. package/lib/core/graph/builder/ViewTreeBuilder.js +6 -5
  123. package/lib/core/model/ArkBaseModel.d.ts +59 -0
  124. package/lib/core/model/ArkBaseModel.d.ts.map +1 -0
  125. package/lib/core/model/ArkBaseModel.js +271 -0
  126. package/lib/core/model/ArkBody.d.ts +3 -9
  127. package/lib/core/model/ArkBody.d.ts.map +1 -1
  128. package/lib/core/model/ArkBody.js +3 -14
  129. package/lib/core/model/ArkClass.d.ts +107 -13
  130. package/lib/core/model/ArkClass.d.ts.map +1 -1
  131. package/lib/core/model/ArkClass.js +152 -54
  132. package/lib/core/model/ArkExport.d.ts +8 -7
  133. package/lib/core/model/ArkExport.d.ts.map +1 -1
  134. package/lib/core/model/ArkExport.js +16 -18
  135. package/lib/core/model/ArkField.d.ts +16 -13
  136. package/lib/core/model/ArkField.d.ts.map +1 -1
  137. package/lib/core/model/ArkField.js +18 -62
  138. package/lib/core/model/ArkFile.d.ts +42 -0
  139. package/lib/core/model/ArkFile.d.ts.map +1 -1
  140. package/lib/core/model/ArkFile.js +58 -0
  141. package/lib/core/model/ArkImport.d.ts +9 -7
  142. package/lib/core/model/ArkImport.d.ts.map +1 -1
  143. package/lib/core/model/ArkImport.js +11 -12
  144. package/lib/core/model/ArkMetadata.d.ts +20 -0
  145. package/lib/core/model/ArkMetadata.d.ts.map +1 -0
  146. package/lib/core/model/ArkMetadata.js +44 -0
  147. package/lib/core/model/ArkMethod.d.ts +195 -17
  148. package/lib/core/model/ArkMethod.d.ts.map +1 -1
  149. package/lib/core/model/ArkMethod.js +363 -46
  150. package/lib/core/model/ArkNamespace.d.ts +6 -8
  151. package/lib/core/model/ArkNamespace.d.ts.map +1 -1
  152. package/lib/core/model/ArkNamespace.js +16 -20
  153. package/lib/core/model/ArkSignature.d.ts +41 -0
  154. package/lib/core/model/ArkSignature.d.ts.map +1 -1
  155. package/lib/core/model/ArkSignature.js +76 -19
  156. package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
  157. package/lib/core/model/builder/ArkClassBuilder.js +60 -49
  158. package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -1
  159. package/lib/core/model/builder/ArkExportBuilder.js +12 -6
  160. package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -1
  161. package/lib/core/model/builder/ArkFieldBuilder.js +13 -9
  162. package/lib/core/model/builder/ArkFileBuilder.js +1 -3
  163. package/lib/core/model/builder/ArkImportBuilder.d.ts +2 -1
  164. package/lib/core/model/builder/ArkImportBuilder.d.ts.map +1 -1
  165. package/lib/core/model/builder/ArkImportBuilder.js +16 -13
  166. package/lib/core/model/builder/ArkMethodBuilder.d.ts +3 -1
  167. package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  168. package/lib/core/model/builder/ArkMethodBuilder.js +105 -45
  169. package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
  170. package/lib/core/model/builder/ArkNamespaceBuilder.js +4 -5
  171. package/lib/core/model/builder/builderUtils.d.ts +2 -1
  172. package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
  173. package/lib/core/model/builder/builderUtils.js +63 -43
  174. package/lib/index.d.ts +2 -1
  175. package/lib/index.d.ts.map +1 -1
  176. package/lib/index.js +4 -3
  177. package/lib/save/ArkStream.js +1 -1
  178. package/lib/save/DotPrinter.d.ts.map +1 -1
  179. package/lib/save/DotPrinter.js +1 -15
  180. package/lib/save/GraphPrinter.d.ts.map +1 -1
  181. package/lib/save/GraphPrinter.js +4 -2
  182. package/lib/save/JsonPrinter.js +5 -5
  183. package/lib/save/ViewTreePrinter.d.ts +16 -0
  184. package/lib/save/ViewTreePrinter.d.ts.map +1 -0
  185. package/lib/save/ViewTreePrinter.js +130 -0
  186. package/lib/save/source/SourceBase.d.ts +2 -2
  187. package/lib/save/source/SourceBase.d.ts.map +1 -1
  188. package/lib/save/source/SourceBase.js +6 -13
  189. package/lib/save/source/SourceBody.d.ts.map +1 -1
  190. package/lib/save/source/SourceBody.js +27 -14
  191. package/lib/save/source/SourceClass.d.ts.map +1 -1
  192. package/lib/save/source/SourceClass.js +12 -8
  193. package/lib/save/source/SourceField.d.ts.map +1 -1
  194. package/lib/save/source/SourceField.js +6 -2
  195. package/lib/save/source/SourceMethod.d.ts.map +1 -1
  196. package/lib/save/source/SourceMethod.js +10 -3
  197. package/lib/save/source/SourceModule.d.ts.map +1 -1
  198. package/lib/save/source/SourceModule.js +16 -10
  199. package/lib/save/source/SourceNamespace.d.ts.map +1 -1
  200. package/lib/save/source/SourceNamespace.js +4 -0
  201. package/lib/save/source/SourceStmt.d.ts +1 -1
  202. package/lib/save/source/SourceStmt.d.ts.map +1 -1
  203. package/lib/save/source/SourceStmt.js +37 -25
  204. package/lib/save/source/SourceTransformer.d.ts +6 -0
  205. package/lib/save/source/SourceTransformer.d.ts.map +1 -1
  206. package/lib/save/source/SourceTransformer.js +82 -51
  207. package/lib/save/source/SourceUtils.d.ts.map +1 -1
  208. package/lib/save/source/SourceUtils.js +12 -11
  209. package/lib/transformer/StaticSingleAssignmentFormer.js +3 -3
  210. package/lib/utils/CfgStructualAnalysis.d.ts +1 -0
  211. package/lib/utils/CfgStructualAnalysis.d.ts.map +1 -1
  212. package/lib/utils/CfgStructualAnalysis.js +103 -72
  213. package/lib/utils/callGraphUtils.d.ts.map +1 -1
  214. package/lib/utils/callGraphUtils.js +7 -10
  215. package/lib/utils/crypto_utils.d.ts +6 -0
  216. package/lib/utils/crypto_utils.d.ts.map +1 -0
  217. package/lib/utils/crypto_utils.js +57 -0
  218. package/lib/utils/entryMethodUtils.d.ts.map +1 -1
  219. package/lib/utils/entryMethodUtils.js +27 -26
  220. package/lib/utils/getAllFiles.d.ts +1 -1
  221. package/lib/utils/getAllFiles.d.ts.map +1 -1
  222. package/lib/utils/getAllFiles.js +4 -5
  223. package/lib/utils/logger.js +2 -2
  224. package/package.json +3 -2
@@ -40,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  return (mod && mod.__esModule) ? mod : { "default": mod };
41
41
  };
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.buildTypeFromPreStr = exports.tsNode2Type = exports.buildReturnType = exports.buildGenericType = exports.buildParameters = exports.buildTypeParameters = exports.buildHeritageClauses = exports.buildModifiers = exports.handlePropertyAccessExpression = exports.handleQualifiedName = void 0;
43
+ exports.buildTypeFromPreStr = exports.tsNode2Type = exports.buildReturnType = exports.buildGenericType = exports.buildParameters = exports.buildTypeParameters = exports.buildHeritageClauses = exports.buildModifiers = exports.buildDecorators = exports.handlePropertyAccessExpression = exports.handleQualifiedName = void 0;
44
44
  const ohos_typescript_1 = __importDefault(require("ohos-typescript"));
45
45
  const Type_1 = require("../../base/Type");
46
46
  const TypeInference_1 = require("../../common/TypeInference");
@@ -52,6 +52,7 @@ const Decorator_1 = require("../../base/Decorator");
52
52
  const ArkMethodBuilder_1 = require("./ArkMethodBuilder");
53
53
  const ArkClassBuilder_1 = require("./ArkClassBuilder");
54
54
  const Builtin_1 = require("../../common/Builtin");
55
+ const ArkBaseModel_1 = require("../ArkBaseModel");
55
56
  const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'builderUtils');
56
57
  function handleQualifiedName(node) {
57
58
  let right = node.right.text;
@@ -69,7 +70,7 @@ exports.handleQualifiedName = handleQualifiedName;
69
70
  function handlePropertyAccessExpression(node) {
70
71
  let right = node.name.text;
71
72
  let left = '';
72
- if (ohos_typescript_1.default.SyntaxKind[node.expression.kind] == 'Identifier') {
73
+ if (ohos_typescript_1.default.SyntaxKind[node.expression.kind] === 'Identifier') {
73
74
  left = node.expression.text;
74
75
  }
75
76
  else if (ohos_typescript_1.default.isStringLiteral(node.expression)) {
@@ -82,50 +83,46 @@ function handlePropertyAccessExpression(node) {
82
83
  return propertyAccessExpressionName;
83
84
  }
84
85
  exports.handlePropertyAccessExpression = handlePropertyAccessExpression;
85
- function buildModifiers(node, sourceFile) {
86
- var _a;
87
- let modifiers = new Set();
88
- function parseModifier(modifier) {
89
- if (ohos_typescript_1.default.SyntaxKind[modifier.kind] == 'FirstContextualKeyword') {
90
- modifiers.add('AbstractKeyword');
91
- }
92
- else if (ohos_typescript_1.default.isDecorator(modifier)) {
93
- if (modifier.expression) {
94
- let kind = '';
95
- let param = '';
96
- if (ohos_typescript_1.default.isIdentifier(modifier.expression)) {
97
- kind = modifier.expression.text;
98
- }
99
- else if (ohos_typescript_1.default.isCallExpression(modifier.expression)) {
100
- if (ohos_typescript_1.default.isIdentifier(modifier.expression.expression)) {
101
- kind = modifier.expression.expression.text;
102
- }
103
- if (modifier.expression.arguments.length > 0) {
104
- const arg = modifier.expression.arguments[0];
105
- if (ohos_typescript_1.default.isArrowFunction(arg)) {
106
- const body = arg.body;
107
- if (ohos_typescript_1.default.isIdentifier(body)) {
108
- param = body.text;
109
- }
110
- }
111
- }
112
- }
113
- const decorator = new Decorator_1.Decorator(kind);
114
- decorator.setContent(modifier.expression.getText(sourceFile));
115
- if (param != '') {
116
- decorator.setParam(param);
117
- }
118
- modifiers.add(decorator);
119
- }
86
+ function buildDecorators(node, sourceFile) {
87
+ let decorators = new Set();
88
+ ohos_typescript_1.default.getAllDecorators(node).forEach((decoratorNode) => {
89
+ let decorator = parseDecorator(decoratorNode);
90
+ if (decorator) {
91
+ decorator.setContent(decoratorNode.expression.getText(sourceFile));
92
+ decorators.add(decorator);
120
93
  }
121
- else {
122
- modifiers.add(ohos_typescript_1.default.SyntaxKind[modifier.kind]);
94
+ });
95
+ return decorators;
96
+ }
97
+ exports.buildDecorators = buildDecorators;
98
+ function parseDecorator(node) {
99
+ if (!node.expression) {
100
+ return undefined;
101
+ }
102
+ let expression = node.expression;
103
+ if (ohos_typescript_1.default.isIdentifier(expression)) {
104
+ return new Decorator_1.Decorator(expression.text);
105
+ }
106
+ if (!ohos_typescript_1.default.isCallExpression(expression) || !ohos_typescript_1.default.isIdentifier(expression.expression)) {
107
+ return undefined;
108
+ }
109
+ let decorator = new Decorator_1.Decorator(expression.expression.text);
110
+ if (expression.arguments.length > 0) {
111
+ const arg = expression.arguments[0];
112
+ if (ohos_typescript_1.default.isArrowFunction(arg) && ohos_typescript_1.default.isIdentifier(arg.body)) {
113
+ decorator.setParam(arg.body.text);
123
114
  }
124
115
  }
116
+ return decorator;
117
+ }
118
+ function buildModifiers(node) {
119
+ var _a;
120
+ let modifiers = 0;
125
121
  if (ohos_typescript_1.default.canHaveModifiers(node)) {
126
- (_a = ohos_typescript_1.default.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.forEach(parseModifier);
122
+ (_a = ohos_typescript_1.default.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.forEach((modifier) => {
123
+ modifiers |= (0, ArkBaseModel_1.modifierKind2Enum)(modifier.kind);
124
+ });
127
125
  }
128
- ohos_typescript_1.default.getAllDecorators(node).forEach(parseModifier);
129
126
  return modifiers;
130
127
  }
131
128
  exports.buildModifiers = buildModifiers;
@@ -133,7 +130,20 @@ function buildHeritageClauses(heritageClauses) {
133
130
  let heritageClausesMap = new Map();
134
131
  heritageClauses === null || heritageClauses === void 0 ? void 0 : heritageClauses.forEach((heritageClause) => {
135
132
  heritageClause.types.forEach((type) => {
136
- heritageClausesMap.set(type.getText(), ohos_typescript_1.default.SyntaxKind[heritageClause.token]);
133
+ let heritageClauseName = '';
134
+ if (type.typeArguments) {
135
+ heritageClauseName = type.getText();
136
+ }
137
+ else if (ohos_typescript_1.default.isIdentifier(type.expression)) {
138
+ heritageClauseName = type.expression.text;
139
+ }
140
+ else if (ohos_typescript_1.default.isPropertyAccessExpression(type.expression)) {
141
+ heritageClauseName = handlePropertyAccessExpression(type.expression);
142
+ }
143
+ else {
144
+ heritageClauseName = type.getText();
145
+ }
146
+ heritageClausesMap.set(heritageClauseName, ohos_typescript_1.default.SyntaxKind[heritageClause.token]);
137
147
  });
138
148
  });
139
149
  return heritageClausesMap;
@@ -275,7 +285,17 @@ function buildGenericType(type, arkInstance) {
275
285
  if (!gType) {
276
286
  gType = (_b = arkInstance.getDeclaringArkClass().getGenericsTypes()) === null || _b === void 0 ? void 0 : _b.find(f => f.getName() === typeName);
277
287
  }
278
- return gType !== null && gType !== void 0 ? gType : urType;
288
+ if (gType) {
289
+ return gType;
290
+ }
291
+ const types = urType.getGenericTypes();
292
+ for (let i = 0; i < types.length; i++) {
293
+ const mayType = types[i];
294
+ if (mayType instanceof Type_1.UnclearReferenceType) {
295
+ types[i] = replace(mayType);
296
+ }
297
+ }
298
+ return urType;
279
299
  }
280
300
  if (type instanceof Type_1.UnclearReferenceType) {
281
301
  return replace(type);
package/lib/index.d.ts CHANGED
@@ -36,7 +36,7 @@ export { ValueUtil } from './core/common/ValueUtil';
36
36
  export { VisibleValue, Scope } from './core/common/VisibleValue';
37
37
  export { DataflowProblem, FlowFunction } from './core/dataflow/DataflowProblem';
38
38
  export { DataflowResult } from './core/dataflow/DataflowResult';
39
- export { DataflowSolver, factEqual } from './core/dataflow/DataflowSolver';
39
+ export { DataflowSolver } from './core/dataflow/DataflowSolver';
40
40
  export { Edge, PathEdgePoint, PathEdge } from './core/dataflow/Edge';
41
41
  export { Fact } from './core/dataflow/Fact';
42
42
  export { TiantAnalysisChecker, TiantAnalysisSolver } from './core/dataflow/TiantAnalysis';
@@ -67,6 +67,7 @@ export { SourceNamespace as SourceNamespacePrinter } from './save/source/SourceN
67
67
  export { SourceFilePrinter } from './save/source/SourceFilePrinter';
68
68
  export { JsonPrinter } from './save/JsonPrinter';
69
69
  export { GraphPrinter } from './save/GraphPrinter';
70
+ export { ViewTreePrinter } from './save/ViewTreePrinter';
70
71
  export * from './transformer/StaticSingleAssignmentFormer';
71
72
  export * from './utils/callGraphUtils';
72
73
  export * from './utils/entryMethodUtils';
@@ -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,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACvG,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,cAAc,iCAAiC,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,UAAU,E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C1C,cAAc,0CAA0C,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,eAAe,IAAI,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,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"}
package/lib/index.js CHANGED
@@ -28,8 +28,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
28
28
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29
29
  };
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.DominanceTree = exports.DominanceFinder = exports.Cfg = exports.BasicBlock = exports.UndefinedVariableSolver = exports.UndefinedVariableChecker = exports.TiantAnalysisSolver = exports.TiantAnalysisChecker = exports.Fact = exports.PathEdge = exports.PathEdgePoint = exports.Edge = exports.factEqual = 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.DiffPTData = exports.PtsSet = exports.PointerAnalysisConfig = exports.PointerAnalysis = exports.PagBuilder = exports.CSFuncID = exports.DummyCallCreator = exports.KLimitedContextSensitive = exports.CallGraphBuilder = exports.BaseGraph = exports.BaseNode = exports.BaseEdge = exports.CGStat = exports.PAGStat = exports.PTAStat = exports.RapidTypeAnalysis = exports.ClassHierarchyAnalysis = exports.AbstractAnalysis = void 0;
32
- 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 = exports.ArkFile = void 0;
31
+ exports.ArkFile = exports.DominanceTree = exports.DominanceFinder = exports.Cfg = exports.BasicBlock = exports.UndefinedVariableSolver = exports.UndefinedVariableChecker = exports.TiantAnalysisSolver = exports.TiantAnalysisChecker = exports.Fact = exports.PathEdge = exports.PathEdgePoint = exports.Edge = 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.DiffPTData = exports.PtsSet = exports.PointerAnalysisConfig = exports.PointerAnalysis = exports.PagBuilder = exports.CSFuncID = exports.DummyCallCreator = exports.KLimitedContextSensitive = exports.CallGraphBuilder = exports.BaseGraph = exports.BaseNode = exports.BaseEdge = exports.CGStat = exports.PAGStat = exports.PTAStat = exports.RapidTypeAnalysis = exports.ClassHierarchyAnalysis = exports.AbstractAnalysis = void 0;
32
+ 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;
33
33
  // callgraph/algorithm
34
34
  var AbstractAnalysis_1 = require("./callgraph/algorithm/AbstractAnalysis");
35
35
  Object.defineProperty(exports, "AbstractAnalysis", { enumerable: true, get: function () { return AbstractAnalysis_1.AbstractAnalysis; } });
@@ -112,7 +112,6 @@ var DataflowResult_1 = require("./core/dataflow/DataflowResult");
112
112
  Object.defineProperty(exports, "DataflowResult", { enumerable: true, get: function () { return DataflowResult_1.DataflowResult; } });
113
113
  var DataflowSolver_1 = require("./core/dataflow/DataflowSolver");
114
114
  Object.defineProperty(exports, "DataflowSolver", { enumerable: true, get: function () { return DataflowSolver_1.DataflowSolver; } });
115
- Object.defineProperty(exports, "factEqual", { enumerable: true, get: function () { return DataflowSolver_1.factEqual; } });
116
115
  var Edge_1 = require("./core/dataflow/Edge");
117
116
  Object.defineProperty(exports, "Edge", { enumerable: true, get: function () { return Edge_1.Edge; } });
118
117
  Object.defineProperty(exports, "PathEdgePoint", { enumerable: true, get: function () { return Edge_1.PathEdgePoint; } });
@@ -179,6 +178,8 @@ var JsonPrinter_1 = require("./save/JsonPrinter");
179
178
  Object.defineProperty(exports, "JsonPrinter", { enumerable: true, get: function () { return JsonPrinter_1.JsonPrinter; } });
180
179
  var GraphPrinter_1 = require("./save/GraphPrinter");
181
180
  Object.defineProperty(exports, "GraphPrinter", { enumerable: true, get: function () { return GraphPrinter_1.GraphPrinter; } });
181
+ var ViewTreePrinter_1 = require("./save/ViewTreePrinter");
182
+ Object.defineProperty(exports, "ViewTreePrinter", { enumerable: true, get: function () { return ViewTreePrinter_1.ViewTreePrinter; } });
182
183
  // transformer
183
184
  __exportStar(require("./transformer/StaticSingleAssignmentFormer"), exports);
184
185
  // utils
@@ -31,7 +31,7 @@ class ArkCodeBuffer {
31
31
  return this;
32
32
  }
33
33
  writeSpace(s) {
34
- if (s.length == 0) {
34
+ if (s.length === 0) {
35
35
  return this;
36
36
  }
37
37
  this.write(s);
@@ -1 +1 @@
1
- {"version":3,"file":"DotPrinter.d.ts","sourceRoot":"","sources":["../../src/save/DotPrinter.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,OAAO;IACzC,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;gBAEL,MAAM,EAAE,SAAS,EAAE,OAAO,GAAE,OAAe;IAMhD,IAAI,IAAI,MAAM;IAmBd,YAAY,IAAI,MAAM;IAoB7B,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAQ9C,OAAO,CAAC,WAAW;IAuBnB,OAAO,CAAC,eAAe;CAO1B;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,OAAO;IACxC,GAAG,EA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,OAAO;IACxC,GAAG,EAAE,QAAQ,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;gBAEL,GAAG,EAAE,QAAQ,EAAE,OAAO,GAAE,OAAe;IAM5C,IAAI,IAAI,MAAM;IAoBd,YAAY,IAAI,MAAM;CAmBhC;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,OAAO;IAC5C,EAAE,EAAE,YAAY,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;gBAEL,EAAE,EAAE,YAAY,EAAE,OAAO,GAAE,OAAe;IAM/C,IAAI,IAAI,MAAM;IAoBd,YAAY,IAAI,MAAM;CAkBhC;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,OAAO;IACvC,OAAO,EAAE,OAAO,CAAC;gBAEL,OAAO,EAAE,OAAO;IAKrB,IAAI,IAAI,MAAM;IAqBd,YAAY,IAAI,MAAM;CAqBhC"}
@@ -44,21 +44,7 @@ class DotMethodPrinter extends Printer_1.Printer {
44
44
  return this.printer.toString();
45
45
  }
46
46
  dumpOriginal() {
47
- this.printer.clear();
48
- if (this.nesting) {
49
- this.printer.writeIndent().writeLine(`subgraph "cluster_Original_${this.method.getSignature()}" {`);
50
- }
51
- else {
52
- this.printer.writeIndent().writeLine(`digraph "${this.method.getSignature()}" {`);
53
- }
54
- this.printer.incIndent();
55
- this.printer.writeIndent().writeLine(`label="${this.method.getSignature()}_original";`);
56
- let blocks = this.method.getOriginalCfg().getBlocks();
57
- let prefix = `NodeOriginal${this.stringHashCode(this.method.getSignature().toString())}`;
58
- this.printBlocks(blocks, prefix);
59
- this.printer.decIndent();
60
- this.printer.writeIndent().writeLine('}');
61
- return this.printer.toString();
47
+ return '';
62
48
  }
63
49
  stringHashCode(name) {
64
50
  let hashCode = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphPrinter.d.ts","sourceRoot":"","sources":["../../src/save/GraphPrinter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAY,WAAW,EAAE,MAAM,E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54,8 @@ function escapeStr(input) {
54
54
  str = str.substring(0, i) + '\\' + str[i] + str.substring(i + 1);
55
55
  ++i;
56
56
  break;
57
+ default:
58
+ ;
57
59
  }
58
60
  }
59
61
  return str;
@@ -103,7 +105,7 @@ class GraphPrinter extends Printer_1.Printer {
103
105
  }
104
106
  for (let node of itor) {
105
107
  let nodeAttr = node.getDotAttr();
106
- if (nodeAttr == '') {
108
+ if (nodeAttr === '') {
107
109
  continue;
108
110
  }
109
111
  let nodeLabel = escapeStr(node.getDotLabel());
@@ -115,7 +117,7 @@ class GraphPrinter extends Printer_1.Printer {
115
117
  }
116
118
  writeEdge(edge) {
117
119
  let edgeAttr = edge.getDotAttr();
118
- if (edgeAttr == '') {
120
+ if (edgeAttr === '') {
119
121
  return;
120
122
  }
121
123
  this.printer.writeLine(`\tNode${edge.getSrcID()} -> Node${edge.getDstID()}[${edgeAttr}]`);
@@ -61,7 +61,7 @@ class JsonPrinter extends Printer_1.Printer {
61
61
  var _a;
62
62
  return {
63
63
  signature: this.serializeClassSignature(cls.getSignature()),
64
- modifiers: Array.from(cls.getModifiers()),
64
+ modifiers: cls.getModifiers(),
65
65
  typeParameters: (_a = cls.getGenericsTypes()) === null || _a === void 0 ? void 0 : _a.map((type) => this.serializeType(type)),
66
66
  superClassName: cls.getSuperClassName(),
67
67
  implementedInterfaceNames: cls.getImplementedInterfaceNames(),
@@ -72,7 +72,7 @@ class JsonPrinter extends Printer_1.Printer {
72
72
  serializeField(field) {
73
73
  return {
74
74
  signature: this.serializeFieldSignature(field.getSignature()),
75
- modifiers: Array.from(field.getModifiers()),
75
+ modifiers: field.getModifiers(),
76
76
  questionToken: field.getQuestionToken(),
77
77
  exclamationToken: field.getExclamationToken(),
78
78
  };
@@ -81,7 +81,7 @@ class JsonPrinter extends Printer_1.Printer {
81
81
  var _a;
82
82
  return {
83
83
  signature: this.serializeMethodSignature(method.getSignature()),
84
- modifiers: Array.from(method.getModifiers()),
84
+ modifiers: method.getModifiers(),
85
85
  typeParameters: ((_a = method.getGenericTypes()) === null || _a === void 0 ? void 0 : _a.map(type => this.serializeType(type))) || [],
86
86
  body: this.serializeMethodBody(method.getBody()),
87
87
  };
@@ -108,7 +108,7 @@ class JsonPrinter extends Printer_1.Printer {
108
108
  importType: importInfo.getImportType(),
109
109
  importFrom: importInfo.getFrom(),
110
110
  nameBeforeAs: importInfo.getNameBeforeAs(),
111
- modifiers: Array.from(importInfo.getModifiers()),
111
+ modifiers: importInfo.getModifiers(),
112
112
  originTsPosition: this.serializeLineColPosition(importInfo.getOriginTsPosition()),
113
113
  };
114
114
  }
@@ -119,7 +119,7 @@ class JsonPrinter extends Printer_1.Printer {
119
119
  exportFrom: exportInfo.getFrom(),
120
120
  nameBeforeAs: exportInfo.getNameBeforeAs(),
121
121
  isDefault: exportInfo.isDefault(),
122
- modifiers: Array.from(exportInfo.getModifiers()),
122
+ modifiers: exportInfo.getModifiers(),
123
123
  originTsPosition: this.serializeLineColPosition(exportInfo.getOriginTsPosition()),
124
124
  };
125
125
  }
@@ -0,0 +1,16 @@
1
+ import { ViewTree } from '../core/graph/ViewTree';
2
+ import { Printer } from './Printer';
3
+ export declare class ViewTreePrinter extends Printer {
4
+ private viewTree;
5
+ private dupCnt;
6
+ constructor(viewTree: ViewTree);
7
+ dump(): string;
8
+ dumpOriginal(): string;
9
+ private walk;
10
+ private escapeDotLabel;
11
+ private writeNode;
12
+ private writeNodeStateValues;
13
+ private writeNodeAttributes;
14
+ private writeNodeSignature;
15
+ }
16
+ //# sourceMappingURL=ViewTreePrinter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewTreePrinter.d.ts","sourceRoot":"","sources":["../../src/save/ViewTreePrinter.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAgB,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,qBAAa,eAAgB,SAAQ,OAAO;IACxC,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,MAAM,CAAS;gBAEX,QAAQ,EAAE,QAAQ;IAMvB,IAAI,IAAI,MAAM;IAcd,YAAY,IAAI,MAAM;IAI7B,OAAO,CAAC,IAAI;IAcZ,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,SAAS;IAwCjB,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,kBAAkB;CAY7B"}
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2024 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.ViewTreePrinter = void 0;
18
+ const EtsConst_1 = require("../core/common/EtsConst");
19
+ const Printer_1 = require("./Printer");
20
+ const DOT_FILE_HEADER = `digraph G {
21
+ graph [nodesep=0.1]
22
+ node [shape=box]
23
+ edge [arrowhead=vee]
24
+ `;
25
+ class ViewTreePrinter extends Printer_1.Printer {
26
+ constructor(viewTree) {
27
+ super();
28
+ this.viewTree = viewTree;
29
+ this.dupCnt = 0;
30
+ }
31
+ dump() {
32
+ this.printer.clear();
33
+ let root = this.viewTree.getRoot();
34
+ if (!root) {
35
+ return this.printer.toString();
36
+ }
37
+ this.printer.write(DOT_FILE_HEADER);
38
+ this.walk(root, root.parent);
39
+ this.printer.write('}');
40
+ return this.printer.toString();
41
+ }
42
+ dumpOriginal() {
43
+ return '';
44
+ }
45
+ walk(item, parent, map = new Map()) {
46
+ let skipChildren = this.writeNode(item, parent, map);
47
+ if (skipChildren) {
48
+ return;
49
+ }
50
+ for (const child of item.children) {
51
+ this.walk(child, item, map);
52
+ }
53
+ }
54
+ escapeDotLabel(content) {
55
+ const MAX_LABEL_LEN = 64;
56
+ const PRE_FIX_LEN = 5;
57
+ let label = content.join('|');
58
+ if (label.length > MAX_LABEL_LEN) {
59
+ return (label.substring(0, PRE_FIX_LEN) + '...' + label.substring(label.length - MAX_LABEL_LEN + PRE_FIX_LEN));
60
+ }
61
+ return label;
62
+ }
63
+ writeNode(item, parent, map) {
64
+ let id = `Node${map.size}`;
65
+ let hasSameNode = map.has(item) || map.has(item.signature);
66
+ if (hasSameNode) {
67
+ id = `${id}_${this.dupCnt++}`;
68
+ this.printer.write(` ${id} [label="${item.name}" style=filled color="green"]\n`);
69
+ }
70
+ else {
71
+ this.printer.write(` ${id} [label="${item.name}"]\n`);
72
+ }
73
+ if (parent) {
74
+ this.printer.write(` ${map.get(parent)} -> ${id}\n`);
75
+ }
76
+ this.writeNodeStateValues(item, id);
77
+ this.writeNodeAttributes(item, id);
78
+ this.writeNodeSignature(item, id);
79
+ if (map.get(item)) {
80
+ this.printer.write(` {rank="same"; ${id};${map.get(item)};}\n`);
81
+ this.printer.write(` ${id} -> ${map.get(item)}[style=dotted]\n`);
82
+ return true;
83
+ }
84
+ else if (map.get(item.signature)) {
85
+ this.printer.write(` {rank="same"; ${id};${map.get(item.signature)};}\n`);
86
+ this.printer.write(` ${id} -> ${map.get(item.signature)}[style=dotted]\n`);
87
+ return true;
88
+ }
89
+ map.set(item, id);
90
+ if (item.signature && !map.has(item.signature)) {
91
+ map.set(item.signature, id);
92
+ }
93
+ return false;
94
+ }
95
+ writeNodeStateValues(item, id) {
96
+ if (item.stateValues.size > 0) {
97
+ let stateValuesId = `${id}val`;
98
+ let content = [];
99
+ item.stateValues.forEach((value) => {
100
+ content.push(value.getName());
101
+ });
102
+ this.printer.write(` ${stateValuesId} [shape=ellipse label="StateValues\n ${this.escapeDotLabel(content)}" fontsize=10 height=.1 style=filled color=".7 .3 1.0" ]\n`);
103
+ this.printer.write(` ${id} -> ${stateValuesId}\n`);
104
+ }
105
+ }
106
+ writeNodeAttributes(item, id) {
107
+ if (item.attributes.size > 0) {
108
+ let attributesId = `${id}attributes`;
109
+ let content = [];
110
+ for (const [key, _] of item.attributes) {
111
+ if (key !== EtsConst_1.COMPONENT_POP_FUNCTION) {
112
+ content.push(key);
113
+ }
114
+ }
115
+ if (content.length > 0) {
116
+ this.printer.write(` ${attributesId} [shape=ellipse label="property|Event\n${this.escapeDotLabel(content)}" fontsize=10 height=.1 style=filled color=".7 .3 1.0" ]\n`);
117
+ this.printer.write(` ${id} -> ${attributesId}\n`);
118
+ }
119
+ }
120
+ }
121
+ writeNodeSignature(item, id) {
122
+ if (item.signature) {
123
+ let signatureId = `${id}signature`;
124
+ let content = [item.signature.toString()];
125
+ this.printer.write(` ${signatureId} [shape=ellipse label="signature\n${this.escapeDotLabel(content)}" fontsize=10 height=.1 style=filled color=".7 .3 1.0" ]\n`);
126
+ this.printer.write(` ${id} -> ${signatureId}\n`);
127
+ }
128
+ }
129
+ }
130
+ exports.ViewTreePrinter = ViewTreePrinter;
@@ -24,8 +24,8 @@ export declare abstract class SourceBase extends Printer implements Dump, Transf
24
24
  transTemp2Code(temp: Local): string;
25
25
  isInBuilderMethod(): boolean;
26
26
  abstract getLine(): number;
27
- protected printDecorator(modifiers: Set<string | Decorator>): void;
28
- protected modifiersToString(modifiers: Set<string | Decorator>): string;
27
+ protected printDecorator(docorator: Decorator[]): void;
28
+ protected modifiersToString(modifiers: number): string;
29
29
  protected resolveKeywordType(keywordStr: string): string;
30
30
  protected resolveMethodName(name: string): string;
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SourceBase.d.ts","sourceRoot":"","sources":["../../../src/save/source/SourceBase.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,M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I3B,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM;IAInC,iBAAiB,IAAI,OAAO;aAInB,OAAO,IAAI,MAAM;IAEjC,SAAS,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI;IAMtD,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAKtD,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAmBxD,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAYpD"}
@@ -15,8 +15,8 @@
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.SourceBase = void 0;
18
- const Decorator_1 = require("../../core/base/Decorator");
19
18
  const Printer_1 = require("../Printer");
19
+ const ArkBaseModel_1 = require("../../core/model/ArkBaseModel");
20
20
  class SourceBase extends Printer_1.Printer {
21
21
  constructor(arkFile, indent = '') {
22
22
  super(indent);
@@ -44,20 +44,13 @@ class SourceBase extends Printer_1.Printer {
44
44
  isInBuilderMethod() {
45
45
  return this.inBuilder;
46
46
  }
47
- printDecorator(modifiers) {
48
- modifiers.forEach((value) => {
49
- if (value instanceof Decorator_1.Decorator) {
50
- this.printer.writeIndent().writeLine(`@${value.getContent()}`);
51
- }
47
+ printDecorator(docorator) {
48
+ docorator.forEach((value) => {
49
+ this.printer.writeIndent().writeLine(`@${value.getContent()}`);
52
50
  });
53
51
  }
54
52
  modifiersToString(modifiers) {
55
- let modifiersStr = [];
56
- modifiers.forEach((value) => {
57
- if (!(value instanceof Decorator_1.Decorator)) {
58
- modifiersStr.push(this.resolveKeywordType(value));
59
- }
60
- });
53
+ let modifiersStr = (0, ArkBaseModel_1.modifiers2stringArray)(modifiers);
61
54
  return modifiersStr.join(' ');
62
55
  }
63
56
  resolveKeywordType(keywordStr) {
@@ -65,7 +58,7 @@ class SourceBase extends Printer_1.Printer {
65
58
  let types = [];
66
59
  for (let keyword of keywordStr.split('|')) {
67
60
  keyword = keyword.trim();
68
- if (keyword.length == 0) {
61
+ if (keyword.length === 0) {
69
62
  continue;
70
63
  }
71
64
  if (keyword.endsWith('Keyword')) {
@@ -1 +1 @@
1
- {"version":3,"file":"SourceBody.d.ts","sourceRoot":"","sources":["../../../src/save/source/SourceBody.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAyD,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGnG,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EASH,UAAU,EAIV,kBAAkB,EACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAI7D,qBAAa,UAAW,YAAW,kBAAkB;IACjD,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC;IACjC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAO;gBAEJ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO;IAcxE,WAAW,CAAC,IAAI,EAAE,IA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