arkanalyzer 1.0.7 → 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.
- package/config/arkanalyzer.json +8 -0
- package/docs/IR2ts-stmt.md +81 -0
- package/docs/IR2ts.md +82 -0
- package/lib/Config.d.ts +9 -1
- package/lib/Config.d.ts.map +1 -1
- package/lib/Config.js +24 -11
- package/lib/Scene.d.ts +49 -42
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +124 -93
- package/lib/callgraph/algorithm/AbstractAnalysis.js +1 -1
- package/lib/callgraph/common/Statistics.js +1 -1
- package/lib/callgraph/model/CallGraph.d.ts +3 -2
- package/lib/callgraph/model/CallGraph.d.ts.map +1 -1
- package/lib/callgraph/model/CallGraph.js +16 -6
- package/lib/callgraph/model/builder/CallGraphBuilder.js +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.d.ts +35 -8
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.js +93 -12
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +32 -5
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +378 -83
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts +3 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +71 -18
- package/lib/core/base/Constant.d.ts +25 -5
- package/lib/core/base/Constant.d.ts.map +1 -1
- package/lib/core/base/Constant.js +46 -8
- package/lib/core/base/Expr.d.ts +45 -40
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +239 -153
- package/lib/core/base/Local.d.ts +2 -2
- package/lib/core/base/Local.d.ts.map +1 -1
- package/lib/core/base/Local.js +2 -2
- package/lib/core/base/Ref.d.ts +38 -37
- package/lib/core/base/Ref.d.ts.map +1 -1
- package/lib/core/base/Ref.js +102 -70
- package/lib/core/base/Stmt.d.ts +4 -0
- package/lib/core/base/Stmt.d.ts.map +1 -1
- package/lib/core/base/Stmt.js +12 -1
- package/lib/core/base/Type.d.ts +4 -0
- package/lib/core/base/Type.d.ts.map +1 -1
- package/lib/core/base/Type.js +41 -17
- package/lib/core/common/ArkError.d.ts +15 -0
- package/lib/core/common/ArkError.d.ts.map +1 -0
- package/lib/core/common/ArkError.js +28 -0
- package/lib/core/common/ArkIRTransformer.d.ts +7 -3
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +46 -20
- package/lib/core/common/Builtin.js +1 -1
- package/lib/core/common/CfgBuilder.d.ts +12 -0
- package/lib/core/common/CfgBuilder.d.ts.map +1 -1
- package/lib/core/common/CfgBuilder.js +289 -61
- package/lib/core/common/Const.d.ts +15 -10
- package/lib/core/common/Const.d.ts.map +1 -1
- package/lib/core/common/Const.js +18 -11
- package/lib/core/common/DummyMainCreater.d.ts +2 -1
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
- package/lib/core/common/DummyMainCreater.js +28 -15
- package/lib/core/common/EtsConst.d.ts +1 -0
- package/lib/core/common/EtsConst.d.ts.map +1 -1
- package/lib/core/common/EtsConst.js +2 -1
- package/lib/core/common/IRUtils.d.ts +7 -0
- package/lib/core/common/IRUtils.d.ts.map +1 -1
- package/lib/core/common/IRUtils.js +34 -2
- package/lib/core/common/ModelUtils.d.ts +1 -0
- package/lib/core/common/ModelUtils.d.ts.map +1 -1
- package/lib/core/common/ModelUtils.js +32 -32
- package/lib/core/common/TSConst.d.ts +10 -3
- package/lib/core/common/TSConst.d.ts.map +1 -1
- package/lib/core/common/TSConst.js +11 -4
- package/lib/core/common/TypeInference.d.ts +8 -2
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +218 -87
- package/lib/core/common/ValueUtil.d.ts +0 -4
- package/lib/core/common/ValueUtil.d.ts.map +1 -1
- package/lib/core/common/ValueUtil.js +8 -25
- package/lib/core/dataflow/DataflowSolver.d.ts.map +1 -1
- package/lib/core/dataflow/DataflowSolver.js +2 -4
- package/lib/core/dataflow/TiantAnalysis.js +2 -1
- package/lib/core/dataflow/Util.d.ts +1 -1
- package/lib/core/dataflow/Util.d.ts.map +1 -1
- package/lib/core/dataflow/Util.js +8 -7
- package/lib/core/graph/BasicBlock.d.ts +41 -0
- package/lib/core/graph/BasicBlock.d.ts.map +1 -1
- package/lib/core/graph/BasicBlock.js +132 -1
- package/lib/core/graph/Cfg.d.ts +30 -1
- package/lib/core/graph/Cfg.d.ts.map +1 -1
- package/lib/core/graph/Cfg.js +129 -6
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/ViewTreeBuilder.js +3 -2
- package/lib/core/model/ArkBaseModel.d.ts +8 -0
- package/lib/core/model/ArkBaseModel.d.ts.map +1 -1
- package/lib/core/model/ArkBaseModel.js +56 -4
- package/lib/core/model/ArkClass.d.ts +36 -30
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +79 -40
- package/lib/core/model/ArkExport.d.ts +3 -0
- package/lib/core/model/ArkExport.d.ts.map +1 -1
- package/lib/core/model/ArkExport.js +11 -1
- package/lib/core/model/ArkField.d.ts +2 -0
- package/lib/core/model/ArkField.d.ts.map +1 -1
- package/lib/core/model/ArkField.js +4 -1
- package/lib/core/model/ArkFile.d.ts +4 -0
- package/lib/core/model/ArkFile.d.ts.map +1 -1
- package/lib/core/model/ArkFile.js +20 -0
- package/lib/core/model/ArkImport.d.ts +2 -0
- package/lib/core/model/ArkImport.d.ts.map +1 -1
- package/lib/core/model/ArkImport.js +3 -0
- package/lib/core/model/ArkMetadata.d.ts +20 -0
- package/lib/core/model/ArkMetadata.d.ts.map +1 -0
- package/lib/core/model/ArkMetadata.js +44 -0
- package/lib/core/model/ArkMethod.d.ts +156 -53
- package/lib/core/model/ArkMethod.d.ts.map +1 -1
- package/lib/core/model/ArkMethod.js +309 -54
- package/lib/core/model/ArkNamespace.d.ts +4 -0
- package/lib/core/model/ArkNamespace.d.ts.map +1 -1
- package/lib/core/model/ArkNamespace.js +13 -0
- package/lib/core/model/ArkSignature.d.ts +11 -5
- package/lib/core/model/ArkSignature.d.ts.map +1 -1
- package/lib/core/model/ArkSignature.js +38 -18
- package/lib/core/model/builder/ArkClassBuilder.d.ts +0 -1
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +9 -34
- package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkExportBuilder.js +6 -1
- package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkFieldBuilder.js +3 -0
- package/lib/core/model/builder/ArkFileBuilder.js +1 -1
- package/lib/core/model/builder/ArkImportBuilder.d.ts +2 -1
- package/lib/core/model/builder/ArkImportBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkImportBuilder.js +12 -5
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +2 -1
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +87 -47
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkNamespaceBuilder.js +2 -0
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.js +25 -2
- package/lib/save/source/SourceClass.d.ts.map +1 -1
- package/lib/save/source/SourceClass.js +4 -0
- package/lib/save/source/SourceField.d.ts.map +1 -1
- package/lib/save/source/SourceField.js +4 -0
- package/lib/save/source/SourceMethod.d.ts.map +1 -1
- package/lib/save/source/SourceMethod.js +7 -0
- package/lib/save/source/SourceModule.d.ts.map +1 -1
- package/lib/save/source/SourceModule.js +14 -9
- package/lib/save/source/SourceNamespace.d.ts.map +1 -1
- package/lib/save/source/SourceNamespace.js +4 -0
- package/lib/save/source/SourceStmt.d.ts.map +1 -1
- package/lib/save/source/SourceStmt.js +15 -3
- package/lib/save/source/SourceTransformer.d.ts +6 -0
- package/lib/save/source/SourceTransformer.d.ts.map +1 -1
- package/lib/save/source/SourceTransformer.js +72 -41
- package/lib/save/source/SourceUtils.d.ts.map +1 -1
- package/lib/save/source/SourceUtils.js +3 -2
- package/lib/transformer/StaticSingleAssignmentFormer.js +1 -1
- package/lib/utils/CfgStructualAnalysis.d.ts +1 -0
- package/lib/utils/CfgStructualAnalysis.d.ts.map +1 -1
- package/lib/utils/CfgStructualAnalysis.js +42 -8
- package/lib/utils/callGraphUtils.d.ts.map +1 -1
- package/lib/utils/callGraphUtils.js +7 -10
- package/lib/utils/crypto_utils.d.ts +6 -0
- package/lib/utils/crypto_utils.d.ts.map +1 -0
- package/lib/utils/crypto_utils.js +57 -0
- package/lib/utils/entryMethodUtils.js +23 -23
- package/lib/utils/getAllFiles.d.ts +1 -1
- package/lib/utils/getAllFiles.d.ts.map +1 -1
- package/lib/utils/getAllFiles.js +4 -5
- package/lib/utils/logger.js +2 -2
- package/package.json +3 -2
|
@@ -13,18 +13,24 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
20
|
exports.genSignature4ImportClause = exports.fileSignatureCompare = exports.classSignatureCompare = exports.methodSubSignatureCompare = exports.methodSignatureCompare = exports.fieldSignatureCompare = exports.LocalSignature = exports.MethodSignature = exports.MethodSubSignature = exports.FieldSignature = exports.ClassSignature = exports.NamespaceSignature = exports.FileSignature = void 0;
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
18
22
|
const pathTransfer_1 = require("../../utils/pathTransfer");
|
|
19
23
|
const Type_1 = require("../base/Type");
|
|
20
24
|
const Const_1 = require("../common/Const");
|
|
25
|
+
const crypto_utils_1 = require("../../utils/crypto_utils");
|
|
21
26
|
/**
|
|
22
27
|
* @category core/model
|
|
23
28
|
*/
|
|
24
29
|
class FileSignature {
|
|
25
30
|
constructor(projectName, fileName) {
|
|
26
31
|
this.projectName = projectName;
|
|
27
|
-
this.fileName = fileName;
|
|
32
|
+
this.fileName = (0, pathTransfer_1.transfer2UnixPath)(fileName);
|
|
33
|
+
this.hashcode = crypto_utils_1.CryptoUtils.hashcode(this.toString());
|
|
28
34
|
}
|
|
29
35
|
getProjectName() {
|
|
30
36
|
return this.projectName;
|
|
@@ -33,9 +39,10 @@ class FileSignature {
|
|
|
33
39
|
return this.fileName;
|
|
34
40
|
}
|
|
35
41
|
toString() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
return `@${this.projectName}/${this.fileName}: `;
|
|
43
|
+
}
|
|
44
|
+
toMapKey() {
|
|
45
|
+
return `${this.hashcode}${path_1.default.basename(this.fileName)}`;
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
exports.FileSignature = FileSignature;
|
|
@@ -63,6 +70,14 @@ class NamespaceSignature {
|
|
|
63
70
|
return this.declaringFileSignature.toString() + this.namespaceName;
|
|
64
71
|
}
|
|
65
72
|
}
|
|
73
|
+
toMapKey() {
|
|
74
|
+
if (this.declaringNamespaceSignature) {
|
|
75
|
+
return this.declaringNamespaceSignature.toMapKey() + '.' + this.namespaceName;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return this.declaringFileSignature.toMapKey() + this.namespaceName;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
66
81
|
}
|
|
67
82
|
exports.NamespaceSignature = NamespaceSignature;
|
|
68
83
|
NamespaceSignature.DEFAULT = new NamespaceSignature(Const_1.UNKNOWN_NAMESPACE_NAME, FileSignature.DEFAULT, null);
|
|
@@ -107,6 +122,14 @@ class ClassSignature {
|
|
|
107
122
|
return this.declaringFileSignature.toString() + this.className;
|
|
108
123
|
}
|
|
109
124
|
}
|
|
125
|
+
toMapKey() {
|
|
126
|
+
if (this.declaringNamespaceSignature) {
|
|
127
|
+
return this.declaringNamespaceSignature.toMapKey() + '.' + this.className;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return this.declaringFileSignature.toMapKey() + this.className;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
110
133
|
}
|
|
111
134
|
exports.ClassSignature = ClassSignature;
|
|
112
135
|
ClassSignature.DEFAULT = new ClassSignature(Const_1.UNKNOWN_CLASS_NAME, FileSignature.DEFAULT, null);
|
|
@@ -173,18 +196,12 @@ class MethodSubSignature {
|
|
|
173
196
|
getReturnType() {
|
|
174
197
|
return this.returnType;
|
|
175
198
|
}
|
|
199
|
+
setReturnType(returnType) {
|
|
200
|
+
this.returnType = returnType;
|
|
201
|
+
}
|
|
176
202
|
isStatic() {
|
|
177
203
|
return this.staticFlag;
|
|
178
204
|
}
|
|
179
|
-
// // temp for being compatible with existing type inference
|
|
180
|
-
// public setReturnType(returnType: Type): void {
|
|
181
|
-
// this.returnType = returnType;
|
|
182
|
-
// }
|
|
183
|
-
//
|
|
184
|
-
// // temp for being compatible with existing type inference
|
|
185
|
-
// public setStaticFlag(flag: boolean): void {
|
|
186
|
-
// this.staticFlag = flag;
|
|
187
|
-
// }
|
|
188
205
|
toString() {
|
|
189
206
|
let paraStr = "";
|
|
190
207
|
this.getParameterTypes().forEach((parameterType) => {
|
|
@@ -210,17 +227,17 @@ class MethodSignature {
|
|
|
210
227
|
/**
|
|
211
228
|
* Return the declaring class signature.
|
|
212
229
|
* A {@link ClassSignature} includes:
|
|
213
|
-
* - File Signature: including the **string** names of the project and file, respectively. The default value of project's name is "
|
|
230
|
+
* - File Signature: including the **string** names of the project and file, respectively. The default value of project's name is "%unk" and the default value of file's name is "%unk".
|
|
214
231
|
* - Namespace Signature | **null**: it may be a namespace signature or **null**. A namespace signature can indicate its **string** name of namespace and its file signature.
|
|
215
232
|
* - Class Name: the **string** name of this class.
|
|
216
233
|
* @returns The declaring class signature.
|
|
217
234
|
* @example
|
|
218
235
|
* 1. get class signature from ArkMethod.
|
|
219
236
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
237
|
+
```typescript
|
|
238
|
+
let methodSignature = expr.getMethodSignature();
|
|
239
|
+
let name = methodSignature.getDeclaringClassSignature().getClassName();
|
|
240
|
+
```
|
|
224
241
|
*
|
|
225
242
|
*/
|
|
226
243
|
getDeclaringClassSignature() {
|
|
@@ -241,6 +258,9 @@ class MethodSignature {
|
|
|
241
258
|
toString() {
|
|
242
259
|
return this.declaringClassSignature.toString() + '.' + this.methodSubSignature.toString();
|
|
243
260
|
}
|
|
261
|
+
toMapKey() {
|
|
262
|
+
return this.declaringClassSignature.toMapKey() + '.' + this.methodSubSignature.toString();
|
|
263
|
+
}
|
|
244
264
|
isMatch(signature) {
|
|
245
265
|
return ((this.toString() === signature.toString()) && (this.getType().toString() === signature.getType().toString()));
|
|
246
266
|
}
|
|
@@ -10,5 +10,4 @@ export declare function buildNormalArkClassFromArkMethod(clsNode: ts.TypeLiteral
|
|
|
10
10
|
export declare function buildNormalArkClassFromArkFile(clsNode: ClassLikeNode, arkFile: ArkFile, cls: ArkClass, sourceFile: ts.SourceFile, declaringMethod?: ArkMethod): void;
|
|
11
11
|
export declare function buildNormalArkClassFromArkNamespace(clsNode: ClassLikeNode, arkNamespace: ArkNamespace, cls: ArkClass, sourceFile: ts.SourceFile, declaringMethod?: ArkMethod): void;
|
|
12
12
|
export declare function buildNormalArkClass(clsNode: ClassLikeNode, cls: ArkClass, sourceFile: ts.SourceFile, declaringMethod?: ArkMethod): void;
|
|
13
|
-
export declare function checkAndUpdateMethod(method: ArkMethod, cls: ArkClass): void;
|
|
14
13
|
//# sourceMappingURL=ArkClassBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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EAAE,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,SAAS,QAYpG;AAED,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,QAAQ,EACjE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,SAAS,QAazG;AAgBD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,SAAS,QA2BhI"}
|
|
@@ -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.
|
|
43
|
+
exports.buildNormalArkClass = exports.buildNormalArkClassFromArkNamespace = exports.buildNormalArkClassFromArkFile = exports.buildNormalArkClassFromArkMethod = exports.buildDefaultArkClassFromArkNamespace = exports.buildDefaultArkClassFromArkFile = void 0;
|
|
44
44
|
const ArkMethod_1 = require("../ArkMethod");
|
|
45
45
|
const logger_1 = __importStar(require("../../../utils/logger"));
|
|
46
46
|
const ohos_typescript_1 = __importDefault(require("ohos-typescript"));
|
|
@@ -136,6 +136,7 @@ function buildNormalArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
136
136
|
default:
|
|
137
137
|
;
|
|
138
138
|
}
|
|
139
|
+
IRUtils_1.IRUtils.setLeadingComments(cls, clsNode, sourceFile, cls.getDeclaringArkFile().getScene().getOptions());
|
|
139
140
|
}
|
|
140
141
|
exports.buildNormalArkClass = buildNormalArkClass;
|
|
141
142
|
function init4InstanceInitMethod(cls) {
|
|
@@ -144,8 +145,9 @@ function init4InstanceInitMethod(cls) {
|
|
|
144
145
|
instanceInit.setIsGeneratedFlag(true);
|
|
145
146
|
const methodSubSignature = ArkSignatureBuilder_1.ArkSignatureBuilder.buildMethodSubSignatureFromMethodName(Const_1.INSTANCE_INIT_METHOD_NAME);
|
|
146
147
|
const methodSignature = new ArkSignature_1.MethodSignature(instanceInit.getDeclaringArkClass().getSignature(), methodSubSignature);
|
|
147
|
-
instanceInit.
|
|
148
|
-
|
|
148
|
+
instanceInit.setImplementationSignature(methodSignature);
|
|
149
|
+
instanceInit.setLineCol(0);
|
|
150
|
+
(0, ArkMethodBuilder_1.checkAndUpdateMethod)(instanceInit, cls);
|
|
149
151
|
cls.addMethod(instanceInit);
|
|
150
152
|
cls.setInstanceInitMethod(instanceInit);
|
|
151
153
|
}
|
|
@@ -155,8 +157,9 @@ function init4StaticInitMethod(cls) {
|
|
|
155
157
|
staticInit.setIsGeneratedFlag(true);
|
|
156
158
|
const methodSubSignature = ArkSignatureBuilder_1.ArkSignatureBuilder.buildMethodSubSignatureFromMethodName(Const_1.STATIC_INIT_METHOD_NAME);
|
|
157
159
|
const methodSignature = new ArkSignature_1.MethodSignature(staticInit.getDeclaringArkClass().getSignature(), methodSubSignature);
|
|
158
|
-
staticInit.
|
|
159
|
-
|
|
160
|
+
staticInit.setImplementationSignature(methodSignature);
|
|
161
|
+
staticInit.setLineCol(0);
|
|
162
|
+
(0, ArkMethodBuilder_1.checkAndUpdateMethod)(staticInit, cls);
|
|
160
163
|
cls.addMethod(staticInit);
|
|
161
164
|
cls.setStaticInitMethod(staticInit);
|
|
162
165
|
}
|
|
@@ -313,7 +316,7 @@ function buildObjectLiteralExpression2ArkClass(clsNode, cls, sourceFile, declari
|
|
|
313
316
|
});
|
|
314
317
|
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(), instanceFieldInitializerStmts, instanceIRTransformer.getThisLocal());
|
|
315
318
|
arkMethods.forEach((mtd) => {
|
|
316
|
-
checkAndUpdateMethod(mtd, cls);
|
|
319
|
+
(0, ArkMethodBuilder_1.checkAndUpdateMethod)(mtd, cls);
|
|
317
320
|
cls.addMethod(mtd);
|
|
318
321
|
});
|
|
319
322
|
}
|
|
@@ -428,31 +431,3 @@ function getInitStmts(transformer, field, initNode) {
|
|
|
428
431
|
field.setInitializer(stmts);
|
|
429
432
|
}
|
|
430
433
|
}
|
|
431
|
-
function checkAndUpdateMethod(method, cls) {
|
|
432
|
-
let presentMethod;
|
|
433
|
-
if (method.isStatic()) {
|
|
434
|
-
presentMethod = cls.getStaticMethodWithName(method.getName());
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
presentMethod = cls.getMethodWithName(method.getName());
|
|
438
|
-
}
|
|
439
|
-
if (presentMethod !== null) {
|
|
440
|
-
method.setSignature(genMethodSignature(method, presentMethod));
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
exports.checkAndUpdateMethod = checkAndUpdateMethod;
|
|
444
|
-
function genMethodSignature(method, presentMethod) {
|
|
445
|
-
let astBody = (0, ArkMethodBuilder_1.getMethodAstBody)(method);
|
|
446
|
-
if (astBody === undefined) {
|
|
447
|
-
for (let signature of presentMethod.getAllSignature()) {
|
|
448
|
-
if (signature.isMatch(method.getSignature())) {
|
|
449
|
-
logger.warn(`Ignore duplicated signature of method: ${method.getSignature().toString()} with return type ${method.getReturnType()}`);
|
|
450
|
-
return presentMethod.getAllSignature();
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
return presentMethod.getAllSignature().concat(method.getSignature());
|
|
454
|
-
}
|
|
455
|
-
else {
|
|
456
|
-
return presentMethod.getAllSignature();
|
|
457
|
-
}
|
|
458
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkExportBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkExportBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAc,QAAQ,EAAE,MAAM,cAAc,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AO,EAAE,OAAO,GAAG,UAAU,EAAE,CAexI;AAED,wBAAgB,UAAU,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,SAAS,GAAG,OAAO,CAU5F"}
|
|
@@ -24,6 +24,7 @@ const ArkExport_1 = require("../ArkExport");
|
|
|
24
24
|
const builderUtils_1 = require("./builderUtils");
|
|
25
25
|
const TSConst_1 = require("../../common/TSConst");
|
|
26
26
|
const ArkBaseModel_1 = require("../ArkBaseModel");
|
|
27
|
+
const IRUtils_1 = require("../../common/IRUtils");
|
|
27
28
|
function buildExportInfo(arkInstance, arkFile, line) {
|
|
28
29
|
return new ArkExport_1.ExportInfo.Builder()
|
|
29
30
|
.exportClauseName(arkInstance.getName())
|
|
@@ -64,6 +65,7 @@ function buildExportDeclaration(node, sourceFile, arkFile) {
|
|
|
64
65
|
.exportFrom(exportFrom)
|
|
65
66
|
.originTsPosition(originTsPosition)
|
|
66
67
|
.declaringArkFile(arkFile)
|
|
68
|
+
.setLeadingComments(IRUtils_1.IRUtils.getLeadingComments(node, sourceFile, arkFile.getScene().getOptions()))
|
|
67
69
|
.modifiers(modifiers);
|
|
68
70
|
if (element.propertyName && ohos_typescript_1.default.isIdentifier(element.propertyName)) {
|
|
69
71
|
builder.nameBeforeAs(element.propertyName.text);
|
|
@@ -79,6 +81,7 @@ function buildExportDeclaration(node, sourceFile, arkFile) {
|
|
|
79
81
|
.tsSourceCode(tsSourceCode)
|
|
80
82
|
.exportFrom(exportFrom)
|
|
81
83
|
.declaringArkFile(arkFile)
|
|
84
|
+
.setLeadingComments(IRUtils_1.IRUtils.getLeadingComments(node, sourceFile, arkFile.getScene().getOptions()))
|
|
82
85
|
.originTsPosition(originTsPosition);
|
|
83
86
|
if (node.exportClause && ohos_typescript_1.default.isNamespaceExport(node.exportClause) && ohos_typescript_1.default.isIdentifier(node.exportClause.name)) { // just like: export * as xx from './yy'
|
|
84
87
|
exportInfos.push(builder1.exportClauseName(node.exportClause.name.text).build());
|
|
@@ -111,6 +114,7 @@ function buildExportAssignment(node, sourceFile, arkFile) {
|
|
|
111
114
|
.tsSourceCode(tsSourceCode)
|
|
112
115
|
.originTsPosition(originTsPosition)
|
|
113
116
|
.declaringArkFile(arkFile)
|
|
117
|
+
.setLeadingComments(IRUtils_1.IRUtils.getLeadingComments(node, sourceFile, arkFile.getScene().getOptions()))
|
|
114
118
|
.build();
|
|
115
119
|
exportInfos.push(exportInfo);
|
|
116
120
|
}
|
|
@@ -123,7 +127,8 @@ function buildExportAssignment(node, sourceFile, arkFile) {
|
|
|
123
127
|
.tsSourceCode(tsSourceCode)
|
|
124
128
|
.originTsPosition(originTsPosition)
|
|
125
129
|
.declaringArkFile(arkFile)
|
|
126
|
-
.exportClauseName(TSConst_1.DEFAULT)
|
|
130
|
+
.exportClauseName(TSConst_1.DEFAULT)
|
|
131
|
+
.setLeadingComments(IRUtils_1.IRUtils.getLeadingComments(node, sourceFile, arkFile.getScene().getOptions()));
|
|
127
132
|
if (ohos_typescript_1.default.isIdentifier(node.expression)) { // just like: export default xx
|
|
128
133
|
exportInfo.nameBeforeAs(node.expression.text);
|
|
129
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkFieldBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkFieldBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ArkFieldBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkFieldBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAUzC,MAAM,MAAM,YAAY,GAAG,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,kBAAkB,CAAC;AAE1E,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,kBAAkB,GAAG,EAAE,CAAC,2BAA2B,GACxH,EAAE,CAAC,gBAAgB,GAAG,EAAE,CAAC,iBAAiB,GAAG,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,GAAG,QAAQ,CAuDpH;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,EAAE,CAAC,yBAAyB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,QAmB1H;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,EAAE,CAAC,sBAAsB,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,QAiCtH"}
|
|
@@ -49,6 +49,7 @@ const ArkSignature_1 = require("../ArkSignature");
|
|
|
49
49
|
const Type_1 = require("../../base/Type");
|
|
50
50
|
const Position_1 = require("../../base/Position");
|
|
51
51
|
const ArkBaseModel_1 = require("../ArkBaseModel");
|
|
52
|
+
const IRUtils_1 = require("../../common/IRUtils");
|
|
52
53
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkFieldBuilder');
|
|
53
54
|
function buildProperty2ArkField(member, sourceFile, cls) {
|
|
54
55
|
let field = new ArkField_1.ArkField();
|
|
@@ -100,6 +101,7 @@ function buildProperty2ArkField(member, sourceFile, cls) {
|
|
|
100
101
|
if (ohos_typescript_1.default.isPropertyDeclaration(member) && member.exclamationToken) {
|
|
101
102
|
field.setExclamationToken(true);
|
|
102
103
|
}
|
|
104
|
+
IRUtils_1.IRUtils.setLeadingComments(field, member, sourceFile, cls.getDeclaringArkFile().getScene().getOptions());
|
|
103
105
|
cls.addField(field);
|
|
104
106
|
return field;
|
|
105
107
|
}
|
|
@@ -118,6 +120,7 @@ function buildIndexSignature2ArkField(member, sourceFile, cls) {
|
|
|
118
120
|
const fieldType = (0, builderUtils_1.buildGenericType)((0, builderUtils_1.tsNode2Type)(member.type, sourceFile, field), field);
|
|
119
121
|
const fieldSignature = new ArkSignature_1.FieldSignature(fieldName, cls.getSignature(), fieldType, true);
|
|
120
122
|
field.setSignature(fieldSignature);
|
|
123
|
+
IRUtils_1.IRUtils.setLeadingComments(field, member, sourceFile, cls.getDeclaringArkFile().getScene().getOptions());
|
|
121
124
|
cls.addField(field);
|
|
122
125
|
}
|
|
123
126
|
exports.buildIndexSignature2ArkField = buildIndexSignature2ArkField;
|
|
@@ -131,7 +131,7 @@ function buildArkFile(arkFile, astRoot) {
|
|
|
131
131
|
}
|
|
132
132
|
else if (ohos_typescript_1.default.isImportEqualsDeclaration(child) ||
|
|
133
133
|
ohos_typescript_1.default.isImportDeclaration(child)) {
|
|
134
|
-
let importInfos = (0, ArkImportBuilder_1.buildImportInfo)(child, astRoot);
|
|
134
|
+
let importInfos = (0, ArkImportBuilder_1.buildImportInfo)(child, astRoot, arkFile);
|
|
135
135
|
importInfos === null || importInfos === void 0 ? void 0 : importInfos.forEach((element) => {
|
|
136
136
|
element.setDeclaringArkFile(arkFile);
|
|
137
137
|
arkFile.addImportInfo(element);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ts from 'ohos-typescript';
|
|
2
2
|
import { ImportInfo } from '../ArkImport';
|
|
3
|
-
|
|
3
|
+
import { ArkFile } from '../ArkFile';
|
|
4
|
+
export declare function buildImportInfo(node: ts.ImportEqualsDeclaration | ts.ImportDeclaration, sourceFile: ts.SourceFile, arkFile: ArkFile): ImportInfo[];
|
|
4
5
|
//# sourceMappingURL=ArkImportBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkImportBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkImportBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ArkImportBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkImportBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAuB,GAAG,EAAE,CAAC,iBAAiB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,CAOlJ"}
|
|
@@ -22,17 +22,18 @@ const ohos_typescript_1 = __importDefault(require("ohos-typescript"));
|
|
|
22
22
|
const Position_1 = require("../../base/Position");
|
|
23
23
|
const ArkImport_1 = require("../ArkImport");
|
|
24
24
|
const builderUtils_1 = require("./builderUtils");
|
|
25
|
-
|
|
25
|
+
const IRUtils_1 = require("../../common/IRUtils");
|
|
26
|
+
function buildImportInfo(node, sourceFile, arkFile) {
|
|
26
27
|
if (ohos_typescript_1.default.isImportDeclaration(node)) {
|
|
27
|
-
return buildImportDeclarationNode(node, sourceFile);
|
|
28
|
+
return buildImportDeclarationNode(node, sourceFile, arkFile);
|
|
28
29
|
}
|
|
29
30
|
else if (ohos_typescript_1.default.isImportEqualsDeclaration(node)) {
|
|
30
|
-
return buildImportEqualsDeclarationNode(node, sourceFile);
|
|
31
|
+
return buildImportEqualsDeclarationNode(node, sourceFile, arkFile);
|
|
31
32
|
}
|
|
32
33
|
return [];
|
|
33
34
|
}
|
|
34
35
|
exports.buildImportInfo = buildImportInfo;
|
|
35
|
-
function buildImportDeclarationNode(node, sourceFile) {
|
|
36
|
+
function buildImportDeclarationNode(node, sourceFile, arkFile) {
|
|
36
37
|
const originTsPosition = Position_1.LineColPosition.buildFromNode(node, sourceFile);
|
|
37
38
|
const tsSourceCode = node.getText(sourceFile);
|
|
38
39
|
let importInfos = [];
|
|
@@ -51,6 +52,7 @@ function buildImportDeclarationNode(node, sourceFile) {
|
|
|
51
52
|
let importInfo = new ArkImport_1.ImportInfo();
|
|
52
53
|
importInfo.build(importClauseName, importType, importFrom, originTsPosition, modifiers);
|
|
53
54
|
importInfo.setTsSourceCode(tsSourceCode);
|
|
55
|
+
IRUtils_1.IRUtils.setLeadingComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
|
|
54
56
|
importInfos.push(importInfo);
|
|
55
57
|
}
|
|
56
58
|
//just like: import fs from 'fs'
|
|
@@ -60,6 +62,7 @@ function buildImportDeclarationNode(node, sourceFile) {
|
|
|
60
62
|
let importInfo = new ArkImport_1.ImportInfo();
|
|
61
63
|
importInfo.build(importClauseName, importType, importFrom, originTsPosition, modifiers);
|
|
62
64
|
importInfo.setTsSourceCode(tsSourceCode);
|
|
65
|
+
IRUtils_1.IRUtils.setLeadingComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
|
|
63
66
|
importInfos.push(importInfo);
|
|
64
67
|
}
|
|
65
68
|
// just like: import {xxx} from './yyy'
|
|
@@ -73,12 +76,14 @@ function buildImportDeclarationNode(node, sourceFile) {
|
|
|
73
76
|
let importInfo = new ArkImport_1.ImportInfo();
|
|
74
77
|
importInfo.build(importClauseName, importType, importFrom, originTsPosition, modifiers, element.propertyName.text);
|
|
75
78
|
importInfo.setTsSourceCode(tsSourceCode);
|
|
79
|
+
IRUtils_1.IRUtils.setLeadingComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
|
|
76
80
|
importInfos.push(importInfo);
|
|
77
81
|
}
|
|
78
82
|
else {
|
|
79
83
|
let importInfo = new ArkImport_1.ImportInfo();
|
|
80
84
|
importInfo.build(importClauseName, importType, importFrom, originTsPosition, modifiers);
|
|
81
85
|
importInfo.setTsSourceCode(tsSourceCode);
|
|
86
|
+
IRUtils_1.IRUtils.setLeadingComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
|
|
82
87
|
importInfos.push(importInfo);
|
|
83
88
|
}
|
|
84
89
|
}
|
|
@@ -94,12 +99,13 @@ function buildImportDeclarationNode(node, sourceFile) {
|
|
|
94
99
|
let nameBeforeAs = '*';
|
|
95
100
|
importInfo.build(importClauseName, importType, importFrom, originTsPosition, modifiers, nameBeforeAs);
|
|
96
101
|
importInfo.setTsSourceCode(tsSourceCode);
|
|
102
|
+
IRUtils_1.IRUtils.setLeadingComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
|
|
97
103
|
importInfos.push(importInfo);
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
106
|
return importInfos;
|
|
101
107
|
}
|
|
102
|
-
function buildImportEqualsDeclarationNode(node, sourceFile) {
|
|
108
|
+
function buildImportEqualsDeclarationNode(node, sourceFile, arkFile) {
|
|
103
109
|
const originTsPosition = Position_1.LineColPosition.buildFromNode(node, sourceFile);
|
|
104
110
|
const tsSourceCode = node.getText(sourceFile);
|
|
105
111
|
let importInfos = [];
|
|
@@ -115,6 +121,7 @@ function buildImportEqualsDeclarationNode(node, sourceFile) {
|
|
|
115
121
|
let importInfo = new ArkImport_1.ImportInfo();
|
|
116
122
|
importInfo.build(importClauseName, importType, importFrom, originTsPosition, modifiers);
|
|
117
123
|
importInfo.setTsSourceCode(tsSourceCode);
|
|
124
|
+
IRUtils_1.IRUtils.setLeadingComments(importInfo, node, sourceFile, arkFile.getScene().getOptions());
|
|
118
125
|
importInfos.push(importInfo);
|
|
119
126
|
}
|
|
120
127
|
return importInfos;
|
|
@@ -57,5 +57,6 @@ export declare class MethodParameter {
|
|
|
57
57
|
export declare function buildDefaultConstructor(arkClass: ArkClass): boolean;
|
|
58
58
|
export declare function buildInitMethod(initMethod: ArkMethod, fieldInitializerStmts: Stmt[], thisLocal: Local): void;
|
|
59
59
|
export declare function addInitInConstructor(arkClass: ArkClass): void;
|
|
60
|
-
export declare function
|
|
60
|
+
export declare function isMethodImplementation(node: MethodLikeNode): boolean;
|
|
61
|
+
export declare function checkAndUpdateMethod(method: ArkMethod, cls: ArkClass): void;
|
|
61
62
|
//# sourceMappingURL=ArkMethodBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkMethodBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkMethodBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,IAAI,EAAe,MAAM,iBAAiB,CAAC;AAG/D,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAgBjC,OAAO,EAAmD,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArkMethodBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkMethodBuilder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,IAAI,EAAe,MAAM,iBAAiB,CAAC;AAG/D,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAgBjC,OAAO,EAAmD,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAiBzC,MAAM,MAAM,cAAc,GACtB,EAAE,CAAC,mBAAmB,GACtB,EAAE,CAAC,iBAAiB,GACpB,EAAE,CAAC,sBAAsB,GACzB,EAA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