arkanalyzer 1.0.16 → 1.0.18

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 (113) hide show
  1. package/lib/callgraph/pointerAnalysis/Pag.d.ts +1 -1
  2. package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
  3. package/lib/callgraph/pointerAnalysis/Pag.js +9 -0
  4. package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
  5. package/lib/callgraph/pointerAnalysis/PagBuilder.js +6 -2
  6. package/lib/core/base/Decorator.d.ts +1 -0
  7. package/lib/core/base/Decorator.d.ts.map +1 -1
  8. package/lib/core/base/Decorator.js +4 -1
  9. package/lib/core/base/Type.d.ts +45 -3
  10. package/lib/core/base/Type.d.ts.map +1 -1
  11. package/lib/core/base/Type.js +84 -4
  12. package/lib/core/common/ArkIRTransformer.d.ts +1 -0
  13. package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
  14. package/lib/core/common/ArkIRTransformer.js +42 -23
  15. package/lib/core/common/ArkValueTransformer.d.ts +1 -0
  16. package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
  17. package/lib/core/common/ArkValueTransformer.js +45 -10
  18. package/lib/core/common/IRInference.d.ts.map +1 -1
  19. package/lib/core/common/IRInference.js +6 -0
  20. package/lib/core/common/ModelUtils.d.ts.map +1 -1
  21. package/lib/core/common/ModelUtils.js +5 -1
  22. package/lib/core/common/TypeInference.d.ts +1 -0
  23. package/lib/core/common/TypeInference.d.ts.map +1 -1
  24. package/lib/core/common/TypeInference.js +27 -8
  25. package/lib/core/{common → graph/builder}/CfgBuilder.d.ts +34 -46
  26. package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -0
  27. package/lib/core/graph/builder/CfgBuilder.js +1139 -0
  28. package/lib/core/graph/builder/ConditionBuilder.d.ts +16 -0
  29. package/lib/core/graph/builder/ConditionBuilder.d.ts.map +1 -0
  30. package/lib/core/graph/builder/ConditionBuilder.js +252 -0
  31. package/lib/core/graph/builder/LoopBuilder.d.ts +21 -0
  32. package/lib/core/graph/builder/LoopBuilder.d.ts.map +1 -0
  33. package/lib/core/graph/builder/LoopBuilder.js +251 -0
  34. package/lib/core/graph/builder/SwitchBuilder.d.ts +12 -0
  35. package/lib/core/graph/builder/SwitchBuilder.d.ts.map +1 -0
  36. package/lib/core/graph/builder/SwitchBuilder.js +152 -0
  37. package/lib/core/graph/builder/TrapBuilder.d.ts +17 -0
  38. package/lib/core/graph/builder/TrapBuilder.d.ts.map +1 -0
  39. package/lib/core/graph/builder/TrapBuilder.js +272 -0
  40. package/lib/core/model/ArkMethod.d.ts +1 -1
  41. package/lib/core/model/ArkMethod.js +1 -1
  42. package/lib/core/model/ArkSignature.d.ts +9 -1
  43. package/lib/core/model/ArkSignature.d.ts.map +1 -1
  44. package/lib/core/model/ArkSignature.js +17 -1
  45. package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
  46. package/lib/core/model/builder/ArkClassBuilder.js +2 -1
  47. package/lib/core/model/builder/ArkMethodBuilder.js +1 -1
  48. package/lib/core/{common → model/builder}/BodyBuilder.d.ts +5 -5
  49. package/lib/core/model/builder/BodyBuilder.d.ts.map +1 -0
  50. package/lib/core/{common → model/builder}/BodyBuilder.js +12 -12
  51. package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
  52. package/lib/core/model/builder/builderUtils.js +31 -5
  53. package/lib/save/JsonPrinter.d.ts +1 -1
  54. package/lib/save/JsonPrinter.d.ts.map +1 -1
  55. package/lib/save/JsonPrinter.js +2 -2
  56. package/lib/save/PrinterBuilder.d.ts +22 -0
  57. package/lib/save/PrinterBuilder.d.ts.map +1 -1
  58. package/lib/save/PrinterBuilder.js +54 -1
  59. package/lib/save/arkir/ArkIRClassPrinter.d.ts +14 -0
  60. package/lib/save/arkir/ArkIRClassPrinter.d.ts.map +1 -0
  61. package/lib/save/arkir/ArkIRClassPrinter.js +92 -0
  62. package/lib/save/arkir/ArkIRFieldPrinter.d.ts +12 -0
  63. package/lib/save/arkir/ArkIRFieldPrinter.d.ts.map +1 -0
  64. package/lib/save/arkir/ArkIRFieldPrinter.js +64 -0
  65. package/lib/save/arkir/ArkIRFilePrinter.d.ts +13 -0
  66. package/lib/save/arkir/ArkIRFilePrinter.d.ts.map +1 -0
  67. package/lib/save/arkir/ArkIRFilePrinter.js +54 -0
  68. package/lib/save/arkir/ArkIRMethodPrinter.d.ts +17 -0
  69. package/lib/save/arkir/ArkIRMethodPrinter.d.ts.map +1 -0
  70. package/lib/save/arkir/ArkIRMethodPrinter.js +159 -0
  71. package/lib/save/arkir/ArkIRNamespacePrinter.d.ts +12 -0
  72. package/lib/save/arkir/ArkIRNamespacePrinter.d.ts.map +1 -0
  73. package/lib/save/arkir/ArkIRNamespacePrinter.js +66 -0
  74. package/lib/save/base/BasePrinter.d.ts +24 -0
  75. package/lib/save/base/BasePrinter.d.ts.map +1 -0
  76. package/lib/save/base/BasePrinter.js +70 -0
  77. package/lib/save/base/ExportPrinter.d.ts +9 -0
  78. package/lib/save/base/ExportPrinter.d.ts.map +1 -0
  79. package/lib/save/base/ExportPrinter.js +67 -0
  80. package/lib/save/base/ImportPrinter.d.ts +10 -0
  81. package/lib/save/base/ImportPrinter.d.ts.map +1 -0
  82. package/lib/save/base/ImportPrinter.js +92 -0
  83. package/lib/save/{source/SourceUtils.d.ts → base/PrinterUtils.d.ts} +2 -2
  84. package/lib/save/{source/SourceUtils.d.ts.map → base/PrinterUtils.d.ts.map} +1 -1
  85. package/lib/save/{source/SourceUtils.js → base/PrinterUtils.js} +10 -10
  86. package/lib/save/source/SourceBase.d.ts +2 -11
  87. package/lib/save/source/SourceBase.d.ts.map +1 -1
  88. package/lib/save/source/SourceBase.js +3 -25
  89. package/lib/save/source/SourceBody.js +3 -3
  90. package/lib/save/source/SourceClass.d.ts +2 -1
  91. package/lib/save/source/SourceClass.d.ts.map +1 -1
  92. package/lib/save/source/SourceClass.js +18 -17
  93. package/lib/save/source/SourceFilePrinter.d.ts +1 -1
  94. package/lib/save/source/SourceFilePrinter.d.ts.map +1 -1
  95. package/lib/save/source/SourceFilePrinter.js +9 -10
  96. package/lib/save/source/SourceMethod.d.ts +1 -1
  97. package/lib/save/source/SourceMethod.d.ts.map +1 -1
  98. package/lib/save/source/SourceMethod.js +37 -22
  99. package/lib/save/source/SourceNamespace.d.ts.map +1 -1
  100. package/lib/save/source/SourceNamespace.js +6 -6
  101. package/lib/save/source/SourceStmt.d.ts +1 -1
  102. package/lib/save/source/SourceStmt.d.ts.map +1 -1
  103. package/lib/save/source/SourceStmt.js +29 -42
  104. package/lib/save/source/SourceTransformer.d.ts +3 -1
  105. package/lib/save/source/SourceTransformer.d.ts.map +1 -1
  106. package/lib/save/source/SourceTransformer.js +65 -29
  107. package/package.json +1 -1
  108. package/lib/core/common/BodyBuilder.d.ts.map +0 -1
  109. package/lib/core/common/CfgBuilder.d.ts.map +0 -1
  110. package/lib/core/common/CfgBuilder.js +0 -1886
  111. package/lib/save/source/SourceModule.d.ts +0 -16
  112. package/lib/save/source/SourceModule.d.ts.map +0 -1
  113. package/lib/save/source/SourceModule.js +0 -125
@@ -1,16 +0,0 @@
1
- import { ExportInfo } from '../../core/model/ArkExport';
2
- import { ImportInfo } from '../../core/model/ArkImport';
3
- import { SourceBase } from './SourceBase';
4
- export declare class SourceExportInfo extends SourceBase {
5
- info: ExportInfo;
6
- constructor(info: ExportInfo, indent?: string);
7
- getLine(): number;
8
- dump(): string;
9
- }
10
- export declare class SourceImportInfo extends SourceBase {
11
- info: ImportInfo;
12
- constructor(info: ImportInfo, indent?: string);
13
- getLine(): number;
14
- dump(): string;
15
- }
16
- //# sourceMappingURL=SourceModule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SourceModule.d.ts","sourceRoot":"","sources":["../../../src/save/source/SourceModule.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAc,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,gBAAiB,SAAQ,UAAU;IAC5C,IAAI,EAAE,UAAU,CAAC;gBAEE,IAAI,EAAE,UAAU,EAAE,MAAM,GAAE,MAAW;IAKjD,OAAO,IAAI,MAAM;IAIjB,IAAI,IAAI,MAAM;CAyCxB;AAED,qBAAa,gBAAiB,SAAQ,UAAU;IAC5C,IAAI,EAAE,UAAU,CAAC;gBAEE,IAAI,EAAE,UAAU,EAAE,MAAM,GAAE,MAAW;IAKjD,OAAO,IAAI,MAAM;IAIjB,IAAI,IAAI,MAAM;CA4CxB"}
@@ -1,125 +0,0 @@
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.SourceImportInfo = exports.SourceExportInfo = void 0;
18
- const ArkExport_1 = require("../../core/model/ArkExport");
19
- const ArkMetadata_1 = require("../../core/model/ArkMetadata");
20
- const SourceBase_1 = require("./SourceBase");
21
- class SourceExportInfo extends SourceBase_1.SourceBase {
22
- constructor(info, indent = '') {
23
- super(info.getDeclaringArkFile(), indent);
24
- this.info = info;
25
- }
26
- getLine() {
27
- return this.info.getOriginTsPosition().getLineNo();
28
- }
29
- dump() {
30
- this.printer.clear();
31
- const commentsMetadata = this.info.getMetadata(ArkMetadata_1.ArkMetadataKind.LEADING_COMMENTS);
32
- if (commentsMetadata instanceof ArkMetadata_1.CommentsMetadata) {
33
- const comments = commentsMetadata.getComments();
34
- comments.forEach((comment) => {
35
- this.printer.writeIndent().writeLine(comment.content);
36
- });
37
- }
38
- if (!this.info.getFrom() && (this.info.isExport() ||
39
- this.info.getExportClauseType() === ArkExport_1.ExportType.LOCAL ||
40
- this.info.getExportClauseType() === ArkExport_1.ExportType.TYPE)) {
41
- return this.printer.toString();
42
- }
43
- if (this.info.getExportClauseName() === '*') {
44
- // just like: export * as xx from './yy'
45
- if (this.info.getNameBeforeAs() && this.info.getNameBeforeAs() !== '*') {
46
- this.printer
47
- .writeIndent()
48
- .write(`export ${this.info.getNameBeforeAs()} as ${this.info.getExportClauseName()}`);
49
- }
50
- else {
51
- this.printer.writeIndent().write(`export ${this.info.getExportClauseName()}`);
52
- }
53
- }
54
- else {
55
- // just like: export {xxx as x} from './yy'
56
- if (this.info.getNameBeforeAs()) {
57
- this.printer.write(`export {${this.info.getNameBeforeAs()} as ${this.info.getExportClauseName()}}`);
58
- }
59
- else {
60
- this.printer.write(`export {${this.info.getExportClauseName()}}`);
61
- }
62
- }
63
- if (this.info.getFrom()) {
64
- this.printer.write(` from '${this.info.getFrom()}'`);
65
- }
66
- this.printer.writeLine(';');
67
- return this.printer.toString();
68
- }
69
- }
70
- exports.SourceExportInfo = SourceExportInfo;
71
- class SourceImportInfo extends SourceBase_1.SourceBase {
72
- constructor(info, indent = '') {
73
- super(info.getDeclaringArkFile(), indent);
74
- this.info = info;
75
- }
76
- getLine() {
77
- return this.info.getOriginTsPosition().getLineNo();
78
- }
79
- dump() {
80
- const commentsMetadata = this.info.getMetadata(ArkMetadata_1.ArkMetadataKind.LEADING_COMMENTS);
81
- if (commentsMetadata instanceof ArkMetadata_1.CommentsMetadata) {
82
- const comments = commentsMetadata.getComments();
83
- comments.forEach((comment) => {
84
- this.printer.writeIndent().writeLine(comment.content);
85
- });
86
- }
87
- if (this.info.getImportType() === 'Identifier') {
88
- // sample: import fs from 'fs'
89
- this.printer
90
- .writeIndent()
91
- .writeLine(`import ${this.info.getImportClauseName()} from '${this.info.getFrom()}';`);
92
- }
93
- else if (this.info.getImportType() === 'NamedImports') {
94
- // sample: import {xxx} from './yyy'
95
- if (this.info.getNameBeforeAs()) {
96
- this.printer
97
- .writeIndent()
98
- .writeLine(`import {${this.info.getNameBeforeAs()} as ${this.info.getImportClauseName()}} from '${this.info.getFrom()}';`);
99
- }
100
- else {
101
- this.printer
102
- .writeIndent()
103
- .writeLine(`import {${this.info.getImportClauseName()}} from '${this.info.getFrom()}';`);
104
- }
105
- }
106
- else if (this.info.getImportType() === 'NamespaceImport') {
107
- // sample: import * as ts from 'ohos-typescript'
108
- this.printer
109
- .writeIndent()
110
- .writeLine(`import * as ${this.info.getImportClauseName()} from '${this.info.getFrom()}';`);
111
- }
112
- else if (this.info.getImportType() === 'EqualsImport') {
113
- // sample: import mmmm = require('./xxx')
114
- this.printer
115
- .writeIndent()
116
- .writeLine(`import ${this.info.getImportClauseName()} = require('${this.info.getFrom()}');`);
117
- }
118
- else {
119
- // sample: import '../xxx'
120
- this.printer.writeIndent().writeLine(`import '${this.info.getFrom()}';`);
121
- }
122
- return this.printer.toString();
123
- }
124
- }
125
- exports.SourceImportInfo = SourceImportInfo;