arkanalyzer 1.0.14 → 1.0.16
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/README.md +10 -10
- package/config/arkanalyzer.json +5 -0
- package/lib/Config.d.ts +1 -0
- package/lib/Config.d.ts.map +1 -1
- package/lib/core/base/Expr.d.ts +3 -0
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +22 -5
- package/lib/core/base/Ref.d.ts +1 -0
- package/lib/core/base/Ref.d.ts.map +1 -1
- package/lib/core/base/Ref.js +5 -2
- package/lib/core/base/Stmt.js +1 -1
- package/lib/core/base/Type.d.ts +25 -1
- package/lib/core/base/Type.d.ts.map +1 -1
- package/lib/core/base/Type.js +39 -2
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +32 -1
- package/lib/core/common/ArkValueTransformer.js +2 -2
- package/lib/core/common/CfgBuilder.d.ts.map +1 -1
- package/lib/core/common/CfgBuilder.js +3 -2
- package/lib/core/common/Const.d.ts +1 -0
- package/lib/core/common/Const.d.ts.map +1 -1
- package/lib/core/common/Const.js +3 -2
- package/lib/core/common/DummyMainCreater.d.ts +0 -6
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
- package/lib/core/common/DummyMainCreater.js +12 -160
- package/lib/core/common/EtsConst.d.ts +0 -3
- package/lib/core/common/EtsConst.d.ts.map +1 -1
- package/lib/core/common/EtsConst.js +1 -8
- package/lib/core/common/IRInference.d.ts.map +1 -1
- package/lib/core/common/IRInference.js +8 -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 +14 -23
- package/lib/core/common/SdkUtils.d.ts.map +1 -1
- package/lib/core/common/SdkUtils.js +12 -5
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +21 -8
- package/lib/core/dataflow/DataflowProblem.d.ts +0 -1
- package/lib/core/dataflow/DataflowProblem.d.ts.map +1 -1
- package/lib/core/dataflow/DataflowProblem.js +0 -13
- package/lib/core/dataflow/Edge.d.ts +0 -4
- package/lib/core/dataflow/Edge.d.ts.map +1 -1
- package/lib/core/dataflow/Edge.js +1 -10
- package/lib/core/dataflow/UndefinedVariable.d.ts.map +1 -1
- package/lib/core/dataflow/UndefinedVariable.js +28 -21
- package/lib/core/dataflow/Util.d.ts +0 -2
- package/lib/core/dataflow/Util.d.ts.map +1 -1
- package/lib/core/dataflow/Util.js +1 -95
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/ViewTreeBuilder.js +2 -2
- package/lib/core/model/ArkClass.d.ts +5 -0
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +10 -2
- package/lib/core/model/ArkFile.d.ts +4 -4
- package/lib/core/model/ArkFile.d.ts.map +1 -1
- package/lib/core/model/ArkFile.js +7 -6
- package/lib/core/model/ArkNamespace.d.ts +8 -3
- package/lib/core/model/ArkNamespace.d.ts.map +1 -1
- package/lib/core/model/ArkNamespace.js +42 -11
- package/lib/core/model/ArkSignature.d.ts +10 -0
- package/lib/core/model/ArkSignature.d.ts.map +1 -1
- package/lib/core/model/ArkSignature.js +13 -1
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +43 -9
- package/lib/core/model/builder/ArkFileBuilder.js +14 -11
- package/lib/core/model/builder/ArkMethodBuilder.js +2 -2
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts +1 -0
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkNamespaceBuilder.js +49 -14
- package/lib/core/model/builder/builderUtils.d.ts +2 -2
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.js +19 -5
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -6
- package/lib/save/source/SourceStmt.d.ts +1 -0
- package/lib/save/source/SourceStmt.d.ts.map +1 -1
- package/lib/save/source/SourceStmt.js +32 -7
- package/lib/utils/entryMethodUtils.d.ts +0 -2
- package/lib/utils/entryMethodUtils.d.ts.map +1 -1
- package/lib/utils/entryMethodUtils.js +1 -31
- package/package.json +3 -3
- package/lib/core/dataflow/TiantAnalysis.d.ts +0 -38
- package/lib/core/dataflow/TiantAnalysis.d.ts.map +0 -1
- package/lib/core/dataflow/TiantAnalysis.js +0 -340
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Copyright (c) 2024-2025 Huawei Device Co., Ltd.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
6
6
|
* You may obtain a copy of the License at
|
|
@@ -133,14 +133,26 @@ class ClassSignature {
|
|
|
133
133
|
}
|
|
134
134
|
exports.ClassSignature = ClassSignature;
|
|
135
135
|
ClassSignature.DEFAULT = new ClassSignature(Const_1.UNKNOWN_CLASS_NAME, FileSignature.DEFAULT, null);
|
|
136
|
+
/**
|
|
137
|
+
* `AliasClassSignature` is used to extend `ClassSignature`, preserving the actual name used during invocation.
|
|
138
|
+
*/
|
|
136
139
|
class AliasClassSignature extends ClassSignature {
|
|
137
140
|
constructor(aliasName, signature) {
|
|
138
141
|
super(signature.getClassName(), signature.getDeclaringFileSignature(), signature.getDeclaringNamespaceSignature());
|
|
139
142
|
this.aliasName = aliasName;
|
|
140
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Returns the name used in the code.
|
|
146
|
+
*/
|
|
141
147
|
getClassName() {
|
|
142
148
|
return this.aliasName;
|
|
143
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Return the original name of declared class
|
|
152
|
+
*/
|
|
153
|
+
getOriginName() {
|
|
154
|
+
return super.getClassName();
|
|
155
|
+
}
|
|
144
156
|
}
|
|
145
157
|
exports.AliasClassSignature = AliasClassSignature;
|
|
146
158
|
class FieldSignature {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkClassBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkClassBuilder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ArkClassBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkClassBuilder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AA8BtD,MAAM,MAAM,aAAa,GACrB,EAAE,CAAC,gBAAgB,GACnB,EAAE,CAAC,oBAAoB,GACvB,EAAE,CAAC,eAAe,GAClB,EAAE,CAAC,eAAe,GAClB,EAAE,CAAC,eAAe,GAClB,EAAE,CAAC,iBAAiB,GACpB,EAAE,CAAC,uBAAuB,CAAC;AAU/B,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,UAAU,QAG/G;AAED,wBAAgB,oCAAoC,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAClD,MAAM,EAAE,EAAE,CAAC,iBAAiB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,QAI3G;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,EAAE,CAAC,eAAe,EAC3B,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,QAOxF;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EACvD,UAAU,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Copyright (c) 2024-2025 Huawei Device Co., Ltd.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
6
6
|
* You may obtain a copy of the License at
|
|
@@ -56,6 +56,9 @@ const IRUtils_1 = require("../../common/IRUtils");
|
|
|
56
56
|
const ArkSignature_1 = require("../ArkSignature");
|
|
57
57
|
const ArkSignatureBuilder_1 = require("./ArkSignatureBuilder");
|
|
58
58
|
const Position_1 = require("../../base/Position");
|
|
59
|
+
const Type_1 = require("../../base/Type");
|
|
60
|
+
const BodyBuilder_1 = require("../../common/BodyBuilder");
|
|
61
|
+
const Expr_1 = require("../../base/Expr");
|
|
59
62
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkClassBuilder');
|
|
60
63
|
function buildDefaultArkClassFromArkFile(arkFile, defaultClass, astRoot) {
|
|
61
64
|
defaultClass.setDeclaringArkFile(arkFile);
|
|
@@ -327,6 +330,7 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
|
|
|
327
330
|
return;
|
|
328
331
|
}
|
|
329
332
|
buildMethodsForClass(clsNode, cls, sourceFile);
|
|
333
|
+
const staticBlockMethodSignatures = buildStaticBlocksForClass(clsNode, cls, sourceFile);
|
|
330
334
|
let instanceIRTransformer;
|
|
331
335
|
let staticIRTransformer;
|
|
332
336
|
if (ohos_typescript_1.default.isClassDeclaration(clsNode) || ohos_typescript_1.default.isClassExpression(clsNode) || ohos_typescript_1.default.isStructDeclaration(clsNode)) {
|
|
@@ -336,32 +340,38 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
|
|
|
336
340
|
if (ohos_typescript_1.default.isEnumDeclaration(clsNode)) {
|
|
337
341
|
staticIRTransformer = new ArkIRTransformer_1.ArkIRTransformer(sourceFile, cls.getStaticInitMethod());
|
|
338
342
|
}
|
|
339
|
-
const
|
|
340
|
-
const
|
|
343
|
+
const staticInitStmts = [];
|
|
344
|
+
const instanceInitStmts = [];
|
|
345
|
+
let staticBlockId = 0;
|
|
341
346
|
clsNode.members.forEach((member) => {
|
|
342
347
|
if (ohos_typescript_1.default.isPropertyDeclaration(member) || ohos_typescript_1.default.isPropertySignature(member)) {
|
|
343
348
|
const arkField = (0, ArkFieldBuilder_1.buildProperty2ArkField)(member, sourceFile, cls);
|
|
344
349
|
if (ohos_typescript_1.default.isClassDeclaration(clsNode) || ohos_typescript_1.default.isClassExpression(clsNode) || ohos_typescript_1.default.isStructDeclaration(clsNode)) {
|
|
345
350
|
if (arkField.isStatic()) {
|
|
346
351
|
getInitStmts(staticIRTransformer, arkField, member.initializer);
|
|
347
|
-
arkField.getInitializer().forEach(stmt =>
|
|
352
|
+
arkField.getInitializer().forEach(stmt => staticInitStmts.push(stmt));
|
|
348
353
|
}
|
|
349
354
|
else {
|
|
350
355
|
if (!instanceIRTransformer)
|
|
351
356
|
console.log(clsNode.getText(sourceFile));
|
|
352
357
|
getInitStmts(instanceIRTransformer, arkField, member.initializer);
|
|
353
|
-
arkField.getInitializer().forEach(stmt =>
|
|
358
|
+
arkField.getInitializer().forEach(stmt => instanceInitStmts.push(stmt));
|
|
354
359
|
}
|
|
355
360
|
}
|
|
356
361
|
}
|
|
357
362
|
else if (ohos_typescript_1.default.isEnumMember(member)) {
|
|
358
363
|
const arkField = (0, ArkFieldBuilder_1.buildProperty2ArkField)(member, sourceFile, cls);
|
|
359
364
|
getInitStmts(staticIRTransformer, arkField, member.initializer);
|
|
360
|
-
arkField.getInitializer().forEach(stmt =>
|
|
365
|
+
arkField.getInitializer().forEach(stmt => staticInitStmts.push(stmt));
|
|
361
366
|
}
|
|
362
367
|
else if (ohos_typescript_1.default.isIndexSignatureDeclaration(member)) {
|
|
363
368
|
(0, ArkFieldBuilder_1.buildIndexSignature2ArkField)(member, sourceFile, cls);
|
|
364
369
|
}
|
|
370
|
+
else if (ohos_typescript_1.default.isClassStaticBlockDeclaration(member)) {
|
|
371
|
+
const currStaticBlockMethodSig = staticBlockMethodSignatures[staticBlockId++];
|
|
372
|
+
const staticBlockInvokeExpr = new Expr_1.ArkStaticInvokeExpr(currStaticBlockMethodSig, []);
|
|
373
|
+
staticInitStmts.push(new Stmt_1.ArkInvokeStmt(staticBlockInvokeExpr));
|
|
374
|
+
}
|
|
365
375
|
else if (ohos_typescript_1.default.isSemicolonClassElement(member)) {
|
|
366
376
|
logger.debug('Skip these members.');
|
|
367
377
|
}
|
|
@@ -370,11 +380,11 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
|
|
|
370
380
|
}
|
|
371
381
|
});
|
|
372
382
|
if (ohos_typescript_1.default.isClassDeclaration(clsNode) || ohos_typescript_1.default.isClassExpression(clsNode) || ohos_typescript_1.default.isStructDeclaration(clsNode)) {
|
|
373
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(),
|
|
374
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(),
|
|
383
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(), instanceInitStmts, instanceIRTransformer.getThisLocal());
|
|
384
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticInitStmts, staticIRTransformer.getThisLocal());
|
|
375
385
|
}
|
|
376
386
|
if (ohos_typescript_1.default.isEnumDeclaration(clsNode)) {
|
|
377
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(),
|
|
387
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticInitStmts, staticIRTransformer.getThisLocal());
|
|
378
388
|
}
|
|
379
389
|
}
|
|
380
390
|
function buildMethodsForClass(clsNode, cls, sourceFile) {
|
|
@@ -393,6 +403,30 @@ function buildMethodsForClass(clsNode, cls, sourceFile) {
|
|
|
393
403
|
}
|
|
394
404
|
});
|
|
395
405
|
}
|
|
406
|
+
function buildStaticBlocksForClass(clsNode, cls, sourceFile) {
|
|
407
|
+
let staticInitBlockId = 0;
|
|
408
|
+
const staticBlockMethodSignatures = [];
|
|
409
|
+
clsNode.members.forEach((member) => {
|
|
410
|
+
if (ohos_typescript_1.default.isClassStaticBlockDeclaration(member)) {
|
|
411
|
+
const staticBlockMethod = new ArkMethod_1.ArkMethod();
|
|
412
|
+
staticBlockMethod.setDeclaringArkClass(cls);
|
|
413
|
+
staticBlockMethod.setIsGeneratedFlag(true);
|
|
414
|
+
staticBlockMethod.setCode(member.getText(sourceFile));
|
|
415
|
+
const methodName = Const_1.STATIC_BLOCK_METHOD_NAME_PREFIX + staticInitBlockId++;
|
|
416
|
+
const methodSubSignature = new ArkSignature_1.MethodSubSignature(methodName, [], Type_1.VoidType.getInstance(), true);
|
|
417
|
+
const methodSignature = new ArkSignature_1.MethodSignature(cls.getSignature(), methodSubSignature);
|
|
418
|
+
staticBlockMethodSignatures.push(methodSignature);
|
|
419
|
+
staticBlockMethod.setImplementationSignature(methodSignature);
|
|
420
|
+
const { line, character } = ohos_typescript_1.default.getLineAndCharacterOfPosition(sourceFile, member.getStart(sourceFile));
|
|
421
|
+
staticBlockMethod.setLine(line + 1);
|
|
422
|
+
staticBlockMethod.setColumn(character + 1);
|
|
423
|
+
let bodyBuilder = new BodyBuilder_1.BodyBuilder(staticBlockMethod.getSignature(), member, staticBlockMethod, sourceFile);
|
|
424
|
+
staticBlockMethod.setBodyBuilder(bodyBuilder);
|
|
425
|
+
cls.addMethod(staticBlockMethod);
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
return staticBlockMethodSignatures;
|
|
429
|
+
}
|
|
396
430
|
function getInitStmts(transformer, field, initNode) {
|
|
397
431
|
if (initNode) {
|
|
398
432
|
const stmts = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Copyright (c) 2024-2025 Huawei Device Co., Ltd.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
6
6
|
* You may obtain a copy of the License at
|
|
@@ -86,14 +86,13 @@ exports.buildArkFileFromFile = buildArkFileFromFile;
|
|
|
86
86
|
*/
|
|
87
87
|
function buildArkFile(arkFile, astRoot) {
|
|
88
88
|
const statements = astRoot.statements;
|
|
89
|
+
const namespaces = [];
|
|
89
90
|
statements.forEach((child) => {
|
|
90
|
-
if (ohos_typescript_1.default.isModuleDeclaration(child)
|
|
91
|
-
//child.kind === ts.SyntaxKind.ModuleDeclaration
|
|
92
|
-
) {
|
|
91
|
+
if (ohos_typescript_1.default.isModuleDeclaration(child)) {
|
|
93
92
|
let ns = new ArkNamespace_1.ArkNamespace();
|
|
94
93
|
ns.setDeclaringArkFile(arkFile);
|
|
95
94
|
(0, ArkNamespaceBuilder_1.buildArkNamespace)(child, arkFile, ns, astRoot);
|
|
96
|
-
|
|
95
|
+
namespaces.push(ns);
|
|
97
96
|
if (ns.isExported()) {
|
|
98
97
|
arkFile.addExportInfo((0, ArkExportBuilder_1.buildExportInfo)(ns, arkFile, Position_1.LineColPosition.buildFromNode(child, astRoot)));
|
|
99
98
|
}
|
|
@@ -101,11 +100,7 @@ function buildArkFile(arkFile, astRoot) {
|
|
|
101
100
|
else if (ohos_typescript_1.default.isClassDeclaration(child) ||
|
|
102
101
|
ohos_typescript_1.default.isInterfaceDeclaration(child) ||
|
|
103
102
|
ohos_typescript_1.default.isEnumDeclaration(child) ||
|
|
104
|
-
ohos_typescript_1.default.isStructDeclaration(child)
|
|
105
|
-
//child.kind === ts.SyntaxKind.ClassDeclaration
|
|
106
|
-
//child.kind === ts.SyntaxKind.InterfaceDeclaration
|
|
107
|
-
//child.kind === ts.SyntaxKind.EnumDeclaration
|
|
108
|
-
) {
|
|
103
|
+
ohos_typescript_1.default.isStructDeclaration(child)) {
|
|
109
104
|
let cls = new ArkClass_1.ArkClass();
|
|
110
105
|
(0, ArkClassBuilder_1.buildNormalArkClassFromArkFile)(child, arkFile, cls, astRoot);
|
|
111
106
|
arkFile.addArkClass(cls);
|
|
@@ -115,7 +110,7 @@ function buildArkFile(arkFile, astRoot) {
|
|
|
115
110
|
}
|
|
116
111
|
// TODO: Check
|
|
117
112
|
else if (ohos_typescript_1.default.isMethodDeclaration(child)) {
|
|
118
|
-
logger.warn(
|
|
113
|
+
logger.warn('This is a MethodDeclaration in ArkFile.');
|
|
119
114
|
let mthd = new ArkMethod_1.ArkMethod();
|
|
120
115
|
(0, ArkMethodBuilder_1.buildArkMethodFromArkClass)(child, arkFile.getDefaultClass(), mthd, astRoot);
|
|
121
116
|
if (mthd.isExported()) {
|
|
@@ -153,6 +148,14 @@ function buildArkFile(arkFile, astRoot) {
|
|
|
153
148
|
logger.info('Child joined default method of arkFile: ', ohos_typescript_1.default.SyntaxKind[child.kind]);
|
|
154
149
|
}
|
|
155
150
|
});
|
|
151
|
+
const mergedNameSpaces = (0, ArkNamespaceBuilder_1.mergeNameSpaces)(namespaces);
|
|
152
|
+
mergedNameSpaces.forEach(mergedNameSpace => {
|
|
153
|
+
arkFile.addNamespace(mergedNameSpace);
|
|
154
|
+
if (mergedNameSpace.isExport()) {
|
|
155
|
+
const linCol = new Position_1.LineColPosition(mergedNameSpace.getLine(), mergedNameSpace.getColumn());
|
|
156
|
+
arkFile.addExportInfo((0, ArkExportBuilder_1.buildExportInfo)(mergedNameSpace, arkFile, linCol));
|
|
157
|
+
}
|
|
158
|
+
});
|
|
156
159
|
}
|
|
157
160
|
function genDefaultArkClass(arkFile, astRoot) {
|
|
158
161
|
let defaultClass = new ArkClass_1.ArkClass();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Copyright (c) 2024-2025 Huawei Device Co., Ltd.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
6
6
|
* You may obtain a copy of the License at
|
|
@@ -387,7 +387,7 @@ function buildInitMethod(initMethod, fieldInitializerStmts, thisLocal) {
|
|
|
387
387
|
const assignStmt = new Stmt_1.ArkAssignStmt(thisLocal, new Ref_1.ArkThisRef(classType));
|
|
388
388
|
const block = new BasicBlock_1.BasicBlock();
|
|
389
389
|
block.addStmt(assignStmt);
|
|
390
|
-
const locals = new Set();
|
|
390
|
+
const locals = new Set([thisLocal]);
|
|
391
391
|
for (const stmt of fieldInitializerStmts) {
|
|
392
392
|
block.addStmt(stmt);
|
|
393
393
|
if (stmt.getDef() && stmt.getDef() instanceof Local_1.Local) {
|
|
@@ -2,4 +2,5 @@ import { ArkFile } from '../ArkFile';
|
|
|
2
2
|
import ts from 'ohos-typescript';
|
|
3
3
|
import { ArkNamespace } from '../ArkNamespace';
|
|
4
4
|
export declare function buildArkNamespace(node: ts.ModuleDeclaration, declaringInstance: ArkFile | ArkNamespace, ns: ArkNamespace, sourceFile: ts.SourceFile): void;
|
|
5
|
+
export declare function mergeNameSpaces(arkNamespaces: ArkNamespace[]): ArkNamespace[];
|
|
5
6
|
//# sourceMappingURL=ArkNamespaceBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkNamespaceBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkNamespaceBuilder.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,GAAG,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"ArkNamespaceBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/ArkNamespaceBuilder.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,GAAG,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,QAoDnJ;AAmFD,wBAAgB,eAAe,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA4B7E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Copyright (c) 2024-2025 Huawei Device Co., Ltd.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
6
6
|
* You may obtain a copy of the License at
|
|
@@ -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.buildArkNamespace = void 0;
|
|
43
|
+
exports.mergeNameSpaces = exports.buildArkNamespace = void 0;
|
|
44
44
|
const Position_1 = require("../../base/Position");
|
|
45
45
|
const ArkClassBuilder_1 = require("./ArkClassBuilder");
|
|
46
46
|
const ArkFile_1 = require("../ArkFile");
|
|
@@ -88,19 +88,19 @@ function buildArkNamespace(node, declaringInstance, ns, sourceFile) {
|
|
|
88
88
|
// NamespaceDeclaration extends ModuleDeclaration
|
|
89
89
|
//TODO: Check
|
|
90
90
|
else if (ohos_typescript_1.default.isModuleDeclaration(node.body)) {
|
|
91
|
-
logger.warn(
|
|
91
|
+
logger.warn('This ModuleBody is an NamespaceDeclaration.');
|
|
92
92
|
let childNs = new ArkNamespace_1.ArkNamespace();
|
|
93
93
|
buildArkNamespace(node.body, ns, childNs, sourceFile);
|
|
94
94
|
}
|
|
95
95
|
else if (ohos_typescript_1.default.isIdentifier(node.body)) {
|
|
96
|
-
logger.warn(
|
|
96
|
+
logger.warn('ModuleBody is Identifier.');
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
logger.warn(
|
|
99
|
+
logger.warn('JSDocNamespaceDeclaration found.');
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
-
logger.warn(
|
|
103
|
+
logger.warn('JSDocNamespaceDeclaration found.');
|
|
104
104
|
}
|
|
105
105
|
IRUtils_1.IRUtils.setComments(ns, node, sourceFile, ns.getDeclaringArkFile().getScene().getOptions());
|
|
106
106
|
}
|
|
@@ -108,18 +108,14 @@ exports.buildArkNamespace = buildArkNamespace;
|
|
|
108
108
|
// TODO: check and update
|
|
109
109
|
function buildNamespaceMembers(node, namespace, sourceFile) {
|
|
110
110
|
const statements = node.statements;
|
|
111
|
+
const nestedNamespaces = [];
|
|
111
112
|
statements.forEach((child) => {
|
|
112
|
-
if (ohos_typescript_1.default.isModuleDeclaration(child)
|
|
113
|
-
//child.kind === ts.SyntaxKind.ModuleDeclaration
|
|
114
|
-
) {
|
|
113
|
+
if (ohos_typescript_1.default.isModuleDeclaration(child)) {
|
|
115
114
|
let childNs = new ArkNamespace_1.ArkNamespace();
|
|
116
115
|
childNs.setDeclaringArkNamespace(namespace);
|
|
117
116
|
childNs.setDeclaringArkFile(namespace.getDeclaringArkFile());
|
|
118
117
|
buildArkNamespace(child, namespace, childNs, sourceFile);
|
|
119
|
-
|
|
120
|
-
if (childNs.isExported()) {
|
|
121
|
-
namespace.addExportInfo((0, ArkExportBuilder_1.buildExportInfo)(childNs, namespace.getDeclaringArkFile(), Position_1.LineColPosition.buildFromNode(child, sourceFile)));
|
|
122
|
-
}
|
|
118
|
+
nestedNamespaces.push(childNs);
|
|
123
119
|
}
|
|
124
120
|
else if (ohos_typescript_1.default.isClassDeclaration(child) ||
|
|
125
121
|
ohos_typescript_1.default.isInterfaceDeclaration(child) ||
|
|
@@ -134,7 +130,7 @@ function buildNamespaceMembers(node, namespace, sourceFile) {
|
|
|
134
130
|
}
|
|
135
131
|
// TODO: Check
|
|
136
132
|
else if (ohos_typescript_1.default.isMethodDeclaration(child)) {
|
|
137
|
-
logger.warn(
|
|
133
|
+
logger.warn('This is a MethodDeclaration in ArkNamespace.');
|
|
138
134
|
let mthd = new ArkMethod_1.ArkMethod();
|
|
139
135
|
(0, ArkMethodBuilder_1.buildArkMethodFromArkClass)(child, namespace.getDefaultClass(), mthd, sourceFile);
|
|
140
136
|
if (mthd.isExported()) {
|
|
@@ -161,6 +157,14 @@ function buildNamespaceMembers(node, namespace, sourceFile) {
|
|
|
161
157
|
// join default method
|
|
162
158
|
}
|
|
163
159
|
});
|
|
160
|
+
const nestedMergedNameSpaces = mergeNameSpaces(nestedNamespaces);
|
|
161
|
+
nestedMergedNameSpaces.forEach(nestedNameSpace => {
|
|
162
|
+
namespace.addNamespace(nestedNameSpace);
|
|
163
|
+
if (nestedNameSpace.isExport()) {
|
|
164
|
+
const linCol = new Position_1.LineColPosition(nestedNameSpace.getLine(), nestedNameSpace.getColumn());
|
|
165
|
+
namespace.addExportInfo((0, ArkExportBuilder_1.buildExportInfo)(nestedNameSpace, namespace.getDeclaringArkFile(), linCol));
|
|
166
|
+
}
|
|
167
|
+
});
|
|
164
168
|
}
|
|
165
169
|
function genDefaultArkClass(ns, node, sourceFile) {
|
|
166
170
|
let defaultClass = new ArkClass_1.ArkClass();
|
|
@@ -168,3 +172,34 @@ function genDefaultArkClass(ns, node, sourceFile) {
|
|
|
168
172
|
ns.setDefaultClass(defaultClass);
|
|
169
173
|
ns.addArkClass(defaultClass);
|
|
170
174
|
}
|
|
175
|
+
function mergeNameSpaces(arkNamespaces) {
|
|
176
|
+
const namespaceMap = new Map();
|
|
177
|
+
for (let i = 0; i < arkNamespaces.length; i++) {
|
|
178
|
+
const currNamespace = arkNamespaces[i];
|
|
179
|
+
const currName = currNamespace.getName();
|
|
180
|
+
if (namespaceMap.has(currName)) {
|
|
181
|
+
const prevNamespace = namespaceMap.get(currName);
|
|
182
|
+
const nestedPrevNamespaces = prevNamespace.getNamespaces();
|
|
183
|
+
const nestedCurrNamespaces = currNamespace.getNamespaces();
|
|
184
|
+
const nestedMergedNameSpaces = mergeNameSpaces([...nestedPrevNamespaces, ...nestedCurrNamespaces]);
|
|
185
|
+
nestedMergedNameSpaces.forEach(nestedNameSpace => {
|
|
186
|
+
prevNamespace.addNamespace(nestedNameSpace);
|
|
187
|
+
});
|
|
188
|
+
const classes = currNamespace.getClasses();
|
|
189
|
+
classes.forEach(cls => {
|
|
190
|
+
prevNamespace.addArkClass(cls);
|
|
191
|
+
});
|
|
192
|
+
const preSourceCodes = prevNamespace.getCodes();
|
|
193
|
+
const currSourceCodes = currNamespace.getCodes();
|
|
194
|
+
prevNamespace.setCodes([...preSourceCodes, ...currSourceCodes]);
|
|
195
|
+
const prevLineColPairs = prevNamespace.getLineColPairs();
|
|
196
|
+
const currLineColPairs = currNamespace.getLineColPairs();
|
|
197
|
+
prevNamespace.setLineCols([...prevLineColPairs, ...currLineColPairs]);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
namespaceMap.set(currName, currNamespace);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return [...namespaceMap.values()];
|
|
204
|
+
}
|
|
205
|
+
exports.mergeNameSpaces = mergeNameSpaces;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts, { HeritageClause, ParameterDeclaration, TypeNode, TypeParameterDeclaration } from 'ohos-typescript';
|
|
2
|
-
import { GenericType, Type } from '../../base/Type';
|
|
2
|
+
import { AliasType, GenericType, Type } from '../../base/Type';
|
|
3
3
|
import { ArkField } from '../ArkField';
|
|
4
4
|
import { ArkClass } from '../ArkClass';
|
|
5
5
|
import { ArkMethod } from '../ArkMethod';
|
|
@@ -12,7 +12,7 @@ export declare function buildModifiers(node: ts.Node): number;
|
|
|
12
12
|
export declare function buildHeritageClauses(heritageClauses?: ts.NodeArray<HeritageClause>): Map<string, string>;
|
|
13
13
|
export declare function buildTypeParameters(typeParameters: ts.NodeArray<TypeParameterDeclaration>, sourceFile: ts.SourceFile, arkInstance: ArkMethod | ArkClass): GenericType[];
|
|
14
14
|
export declare function buildParameters(params: ts.NodeArray<ParameterDeclaration>, arkInstance: ArkMethod | ArkField, sourceFile: ts.SourceFile): MethodParameter[];
|
|
15
|
-
export declare function buildGenericType(type: Type, arkInstance: ArkMethod | ArkField): Type;
|
|
15
|
+
export declare function buildGenericType(type: Type, arkInstance: ArkMethod | ArkField | AliasType): Type;
|
|
16
16
|
export declare function buildReturnType(node: TypeNode, sourceFile: ts.SourceFile, method: ArkMethod): Type;
|
|
17
17
|
export declare function tsNode2Type(typeNode: ts.TypeNode | ts.TypeParameterDeclaration, sourceFile: ts.SourceFile, arkInstance: ArkMethod | ArkClass | ArkField): Type;
|
|
18
18
|
export declare function buildTypeFromPreStr(preStr: string): Type;
|
|
@@ -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,
|
|
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,EAEX,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,EAGH,eAAe,EAElB,MAAM,oBAAoB,CAAC;AAQ5B,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,GAAG,MAAM,CAUlE;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,EAAE,CAAC,wBAAwB,GAAG,MAAM,CAYxF;AAED,wB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|
278
278
|
function buildGenericType(type, arkInstance) {
|
|
279
279
|
function replace(urType) {
|
|
280
|
-
var _a, _b;
|
|
280
|
+
var _a, _b, _c;
|
|
281
281
|
const typeName = urType.getName();
|
|
282
282
|
let gType;
|
|
283
|
-
if (arkInstance instanceof
|
|
283
|
+
if (arkInstance instanceof Type_1.AliasType) {
|
|
284
284
|
gType = (_a = arkInstance.getGenericTypes()) === null || _a === void 0 ? void 0 : _a.find(f => f.getName() === typeName);
|
|
285
285
|
}
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
else {
|
|
287
|
+
if (arkInstance instanceof ArkMethod_1.ArkMethod) {
|
|
288
|
+
gType = (_b = arkInstance.getGenericTypes()) === null || _b === void 0 ? void 0 : _b.find(f => f.getName() === typeName);
|
|
289
|
+
}
|
|
290
|
+
if (!gType) {
|
|
291
|
+
gType = (_c = arkInstance.getDeclaringArkClass().getGenericsTypes()) === null || _c === void 0 ? void 0 : _c.find(f => f.getName() === typeName);
|
|
292
|
+
}
|
|
288
293
|
}
|
|
289
294
|
if (gType) {
|
|
290
295
|
return gType;
|
|
@@ -301,7 +306,10 @@ function buildGenericType(type, arkInstance) {
|
|
|
301
306
|
if (type instanceof Type_1.UnclearReferenceType) {
|
|
302
307
|
return replace(type);
|
|
303
308
|
}
|
|
304
|
-
else if (type instanceof Type_1.
|
|
309
|
+
else if (type instanceof Type_1.ClassType && arkInstance instanceof Type_1.AliasType) {
|
|
310
|
+
type.setRealGenericTypes(arkInstance.getGenericTypes());
|
|
311
|
+
}
|
|
312
|
+
else if (type instanceof Type_1.UnionType || type instanceof Type_1.TupleType) {
|
|
305
313
|
const types = type.getTypes();
|
|
306
314
|
for (let i = 0; i < types.length; i++) {
|
|
307
315
|
const mayType = types[i];
|
|
@@ -310,6 +318,12 @@ function buildGenericType(type, arkInstance) {
|
|
|
310
318
|
}
|
|
311
319
|
}
|
|
312
320
|
}
|
|
321
|
+
else if (type instanceof Type_1.ArrayType) {
|
|
322
|
+
const baseType = type.getBaseType();
|
|
323
|
+
if (baseType instanceof Type_1.UnclearReferenceType) {
|
|
324
|
+
type.setBaseType(replace(baseType));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
313
327
|
return type;
|
|
314
328
|
}
|
|
315
329
|
exports.buildGenericType = buildGenericType;
|
package/lib/index.d.ts
CHANGED
|
@@ -36,9 +36,8 @@ export { VisibleValue, Scope } from './core/common/VisibleValue';
|
|
|
36
36
|
export { DataflowProblem, FlowFunction } from './core/dataflow/DataflowProblem';
|
|
37
37
|
export { DataflowResult } from './core/dataflow/DataflowResult';
|
|
38
38
|
export { DataflowSolver } from './core/dataflow/DataflowSolver';
|
|
39
|
-
export {
|
|
39
|
+
export { PathEdgePoint, PathEdge } from './core/dataflow/Edge';
|
|
40
40
|
export { Fact } from './core/dataflow/Fact';
|
|
41
|
-
export { TiantAnalysisChecker, TiantAnalysisSolver } from './core/dataflow/TiantAnalysis';
|
|
42
41
|
export { UndefinedVariableChecker, UndefinedVariableSolver } from './core/dataflow/UndefinedVariable';
|
|
43
42
|
export { BasicBlock } from './core/graph/BasicBlock';
|
|
44
43
|
export { Cfg } from './core/graph/Cfg';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -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,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAA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AO,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;AACrC,cAAc,sBAAsB,CAAC;AAGrC,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.
|
|
35
|
-
exports.ts = 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 =
|
|
34
|
+
exports.ArkClass = 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.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.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 = 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; } });
|
|
@@ -112,14 +112,10 @@ Object.defineProperty(exports, "DataflowResult", { enumerable: true, get: functi
|
|
|
112
112
|
var DataflowSolver_1 = require("./core/dataflow/DataflowSolver");
|
|
113
113
|
Object.defineProperty(exports, "DataflowSolver", { enumerable: true, get: function () { return DataflowSolver_1.DataflowSolver; } });
|
|
114
114
|
var Edge_1 = require("./core/dataflow/Edge");
|
|
115
|
-
Object.defineProperty(exports, "Edge", { enumerable: true, get: function () { return Edge_1.Edge; } });
|
|
116
115
|
Object.defineProperty(exports, "PathEdgePoint", { enumerable: true, get: function () { return Edge_1.PathEdgePoint; } });
|
|
117
116
|
Object.defineProperty(exports, "PathEdge", { enumerable: true, get: function () { return Edge_1.PathEdge; } });
|
|
118
117
|
var Fact_1 = require("./core/dataflow/Fact");
|
|
119
118
|
Object.defineProperty(exports, "Fact", { enumerable: true, get: function () { return Fact_1.Fact; } });
|
|
120
|
-
var TiantAnalysis_1 = require("./core/dataflow/TiantAnalysis");
|
|
121
|
-
Object.defineProperty(exports, "TiantAnalysisChecker", { enumerable: true, get: function () { return TiantAnalysis_1.TiantAnalysisChecker; } });
|
|
122
|
-
Object.defineProperty(exports, "TiantAnalysisSolver", { enumerable: true, get: function () { return TiantAnalysis_1.TiantAnalysisSolver; } });
|
|
123
119
|
var UndefinedVariable_1 = require("./core/dataflow/UndefinedVariable");
|
|
124
120
|
Object.defineProperty(exports, "UndefinedVariableChecker", { enumerable: true, get: function () { return UndefinedVariable_1.UndefinedVariableChecker; } });
|
|
125
121
|
Object.defineProperty(exports, "UndefinedVariableSolver", { enumerable: true, get: function () { return UndefinedVariable_1.UndefinedVariableSolver; } });
|
|
@@ -148,6 +148,7 @@ export declare class SourceTypeAliasStmt extends SourceStmt {
|
|
|
148
148
|
aliasType: AliasType;
|
|
149
149
|
constructor(context: StmtPrinterContext, original: Stmt, aliasType: AliasType);
|
|
150
150
|
transfer2ts(): void;
|
|
151
|
+
private generateClassTS;
|
|
151
152
|
}
|
|
152
153
|
export declare class SourceTryStmt extends SourceStmt {
|
|
153
154
|
constructor(context: StmtPrinterContext, stmt: Stmt);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceStmt.d.ts","sourceRoot":"","sources":["../../../src/save/source/SourceStmt.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEH,eAAe,EAIlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAEH,aAAa,EACb,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,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G9B;AAED,qBAAa,eAAgB,SAAQ,UAAU;IAC3C,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;gBAClB,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,UAAU;IAKhE,WAAW,IAAI,IAAI;IAe1B,SAAS,CAAC,UAAU,IAAI,IAAI;IAI5B,SAAS,CAAC,SAAS,IAAI,IAAI;CAG9B;AAED,qBAAa,iBAAkB,SAAQ,UAAU;gBACjC,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI;IAI5C,WAAW,IAAI,IAAI;IAI1B,SAAS,CAAC,UAAU,IAAI,IAAI;IAI5B,SAAS,CAAC,SAAS,IAAI,IAAI;CAG9B;AAED,qBAAa,kBAAkB;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;gBAEL,IAAI,EAAE,eAAe;IAK1B,YAAY,CAAC,KAAK,EAAE,MAAM;IAI1B,QAAQ,IAAI,MAAM;CAG5B;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,GAAG,UAAU,CAqBnF"}
|
|
@@ -704,9 +704,23 @@ class SourceTypeAliasStmt extends SourceStmt {
|
|
|
704
704
|
if (expr.getTransferWithTypeOf()) {
|
|
705
705
|
typeOf = 'typeof ';
|
|
706
706
|
}
|
|
707
|
+
let realGenericTypes = '';
|
|
708
|
+
if (expr.getRealGenericTypes()) {
|
|
709
|
+
let types = expr.getRealGenericTypes().join(', ');
|
|
710
|
+
if (types) {
|
|
711
|
+
realGenericTypes = `<${types}>`;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
let genericTypes = '';
|
|
715
|
+
if (this.aliasType.getGenericTypes()) {
|
|
716
|
+
let types = this.aliasType.getGenericTypes().join(', ');
|
|
717
|
+
if (types) {
|
|
718
|
+
genericTypes = `<${types}>`;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
707
721
|
let typeObject = expr.getOriginalObject();
|
|
708
722
|
if (typeObject instanceof Type_1.Type) {
|
|
709
|
-
this.setText(`${modifier}type ${this.aliasType.getName()} = ${typeOf}${this.transformer.typeToString(typeObject)};`);
|
|
723
|
+
this.setText(`${modifier}type ${this.aliasType.getName()}${genericTypes} = ${typeOf}${this.transformer.typeToString(typeObject)}${realGenericTypes};`);
|
|
710
724
|
return;
|
|
711
725
|
}
|
|
712
726
|
if (typeObject instanceof ArkImport_1.ImportInfo) {
|
|
@@ -714,23 +728,34 @@ class SourceTypeAliasStmt extends SourceStmt {
|
|
|
714
728
|
if (typeObject.getImportClauseName() !== '') {
|
|
715
729
|
exprStr = `${exprStr}.${typeObject.getImportClauseName()}`;
|
|
716
730
|
}
|
|
717
|
-
this.setText(`${modifier}type ${this.aliasType.getName()} = ${typeOf}${exprStr};`);
|
|
731
|
+
this.setText(`${modifier}type ${this.aliasType.getName()}${genericTypes} = ${typeOf}${exprStr}${realGenericTypes};`);
|
|
718
732
|
return;
|
|
719
733
|
}
|
|
720
734
|
if (typeObject instanceof Local_1.Local) {
|
|
721
|
-
this.setText(`${modifier}type ${this.aliasType.getName()} = ${typeOf}${this.transformer.valueToString(typeObject)};`);
|
|
735
|
+
this.setText(`${modifier}type ${this.aliasType.getName()}${genericTypes} = ${typeOf}${this.transformer.valueToString(typeObject)}${realGenericTypes};`);
|
|
722
736
|
return;
|
|
723
737
|
}
|
|
724
738
|
if (typeObject instanceof ArkClass_1.ArkClass) {
|
|
725
|
-
let
|
|
726
|
-
this.setText(`${modifier}type ${this.aliasType.getName()} = ${typeOf}${
|
|
739
|
+
let classTS = this.generateClassTS(typeObject);
|
|
740
|
+
this.setText(`${modifier}type ${this.aliasType.getName()}${genericTypes} = ${typeOf}${classTS}${realGenericTypes};`);
|
|
727
741
|
return;
|
|
728
742
|
}
|
|
729
743
|
if (typeObject instanceof ArkMethod_1.ArkMethod) {
|
|
730
|
-
this.setText(`${modifier}type ${this.aliasType.getName()} = ${typeOf}${typeObject.getName()};`);
|
|
744
|
+
this.setText(`${modifier}type ${this.aliasType.getName()}${genericTypes} = ${typeOf}${typeObject.getName()}${realGenericTypes};`);
|
|
731
745
|
return;
|
|
732
746
|
}
|
|
733
|
-
this.setText(`${modifier}type ${this.aliasType.getName()} = ${typeOf}${typeObject.getName()};`);
|
|
747
|
+
this.setText(`${modifier}type ${this.aliasType.getName()}${genericTypes} = ${typeOf}${typeObject.getName()}${realGenericTypes};`);
|
|
748
|
+
}
|
|
749
|
+
generateClassTS(arkClass) {
|
|
750
|
+
let res = '';
|
|
751
|
+
let classType = new Type_1.ClassType(arkClass.getSignature());
|
|
752
|
+
if (arkClass.getCategory() === ArkClass_1.ClassCategory.TYPE_LITERAL || arkClass.getCategory() === ArkClass_1.ClassCategory.OBJECT) {
|
|
753
|
+
res = this.transformer.literalObjectToString(classType);
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
res = this.transformer.typeToString(classType);
|
|
757
|
+
}
|
|
758
|
+
return res;
|
|
734
759
|
}
|
|
735
760
|
}
|
|
736
761
|
exports.SourceTypeAliasStmt = SourceTypeAliasStmt;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Scene } from '../Scene';
|
|
2
|
-
import { ArkClass } from '../core/model/ArkClass';
|
|
3
2
|
import { ArkMethod } from '../core/model/ArkMethod';
|
|
4
3
|
import { Stmt } from '../core/base/Stmt';
|
|
5
4
|
export declare const LIFECYCLE_METHOD_NAME: string[];
|
|
@@ -10,7 +9,6 @@ export interface AbilityMessage {
|
|
|
10
9
|
name: string;
|
|
11
10
|
srcEntrance: string;
|
|
12
11
|
}
|
|
13
|
-
export declare function getAbilities(abilities: AbilityMessage[], modulePath: string, scene: Scene): ArkClass[];
|
|
14
12
|
export declare function getCallbackMethodFromStmt(stmt: Stmt, scene: Scene): ArkMethod | null;
|
|
15
13
|
export declare function addCfg2Stmt(method: ArkMethod): void;
|
|
16
14
|
//# sourceMappingURL=entryMethodUtils.d.ts.map
|