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.
- package/config/arkanalyzer.json +8 -0
- package/docs/IR2ts-stmt.md +81 -0
- package/docs/IR2ts.md +82 -0
- package/lib/Config.d.ts +29 -1
- package/lib/Config.d.ts.map +1 -1
- package/lib/Config.js +44 -11
- package/lib/Scene.d.ts +152 -9
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +233 -66
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts +2 -1
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/AbstractAnalysis.js +14 -7
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.js +2 -4
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +2 -3
- package/lib/callgraph/common/Statistics.js +1 -1
- package/lib/callgraph/model/BaseGraph.js +2 -2
- 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 +23 -14
- package/lib/callgraph/model/builder/CallGraphBuilder.d.ts +2 -2
- package/lib/callgraph/model/builder/CallGraphBuilder.js +3 -3
- package/lib/callgraph/pointerAnalysis/Context.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Context.js +0 -1
- package/lib/callgraph/pointerAnalysis/Pag.d.ts +36 -9
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.js +130 -37
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +34 -5
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +479 -126
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts +6 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +107 -45
- package/lib/callgraph/pointerAnalysis/PtsDS.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PtsDS.js +0 -2
- package/lib/core/base/Constant.d.ts +37 -5
- package/lib/core/base/Constant.d.ts.map +1 -1
- package/lib/core/base/Constant.js +58 -8
- package/lib/core/base/Expr.d.ts +98 -13
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +295 -127
- package/lib/core/base/Local.d.ts +70 -5
- package/lib/core/base/Local.d.ts.map +1 -1
- package/lib/core/base/Local.js +77 -4
- package/lib/core/base/Ref.d.ts +79 -5
- package/lib/core/base/Ref.d.ts.map +1 -1
- package/lib/core/base/Ref.js +143 -38
- package/lib/core/base/Stmt.d.ts +126 -12
- package/lib/core/base/Stmt.d.ts.map +1 -1
- package/lib/core/base/Stmt.js +135 -28
- package/lib/core/base/Type.d.ts +11 -2
- package/lib/core/base/Type.d.ts.map +1 -1
- package/lib/core/base/Type.js +47 -42
- package/lib/core/base/Value.d.ts +24 -2
- package/lib/core/base/Value.d.ts.map +1 -1
- 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 +12 -5
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +90 -45
- package/lib/core/common/BodyBuilder.d.ts +2 -0
- package/lib/core/common/BodyBuilder.d.ts.map +1 -1
- package/lib/core/common/BodyBuilder.js +5 -2
- package/lib/core/common/Builtin.js +1 -1
- package/lib/core/common/CfgBuilder.d.ts +12 -7
- package/lib/core/common/CfgBuilder.d.ts.map +1 -1
- package/lib/core/common/CfgBuilder.js +336 -140
- 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 +5 -4
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
- package/lib/core/common/DummyMainCreater.js +43 -28
- 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/ExprUseReplacer.js +8 -8
- 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 +39 -36
- package/lib/core/common/RefUseReplacer.js +3 -3
- package/lib/core/common/StmtUseReplacer.js +4 -4
- 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 +222 -90
- 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 +10 -27
- package/lib/core/common/VisibleValue.js +1 -1
- package/lib/core/dataflow/DataflowProblem.d.ts +1 -0
- package/lib/core/dataflow/DataflowProblem.d.ts.map +1 -1
- package/lib/core/dataflow/DataflowProblem.js +4 -4
- package/lib/core/dataflow/DataflowSolver.d.ts +20 -16
- package/lib/core/dataflow/DataflowSolver.d.ts.map +1 -1
- package/lib/core/dataflow/DataflowSolver.js +67 -78
- package/lib/core/dataflow/TiantAnalysis.d.ts +1 -0
- package/lib/core/dataflow/TiantAnalysis.d.ts.map +1 -1
- package/lib/core/dataflow/TiantAnalysis.js +42 -28
- package/lib/core/dataflow/UndefinedVariable.d.ts +15 -1
- package/lib/core/dataflow/UndefinedVariable.d.ts.map +1 -1
- package/lib/core/dataflow/UndefinedVariable.js +122 -76
- package/lib/core/dataflow/Util.d.ts +5 -1
- package/lib/core/dataflow/Util.d.ts.map +1 -1
- package/lib/core/dataflow/Util.js +43 -22
- package/lib/core/graph/BasicBlock.d.ts +72 -0
- package/lib/core/graph/BasicBlock.d.ts.map +1 -1
- package/lib/core/graph/BasicBlock.js +165 -3
- 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 +131 -11
- package/lib/core/graph/DominanceFinder.js +7 -7
- package/lib/core/graph/DominanceTree.js +4 -4
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/ViewTreeBuilder.js +6 -5
- package/lib/core/model/ArkBaseModel.d.ts +59 -0
- package/lib/core/model/ArkBaseModel.d.ts.map +1 -0
- package/lib/core/model/ArkBaseModel.js +271 -0
- package/lib/core/model/ArkBody.d.ts +3 -9
- package/lib/core/model/ArkBody.d.ts.map +1 -1
- package/lib/core/model/ArkBody.js +3 -14
- package/lib/core/model/ArkClass.d.ts +107 -13
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +152 -54
- package/lib/core/model/ArkExport.d.ts +8 -7
- package/lib/core/model/ArkExport.d.ts.map +1 -1
- package/lib/core/model/ArkExport.js +16 -18
- package/lib/core/model/ArkField.d.ts +16 -13
- package/lib/core/model/ArkField.d.ts.map +1 -1
- package/lib/core/model/ArkField.js +18 -62
- package/lib/core/model/ArkFile.d.ts +42 -0
- package/lib/core/model/ArkFile.d.ts.map +1 -1
- package/lib/core/model/ArkFile.js +58 -0
- package/lib/core/model/ArkImport.d.ts +9 -7
- package/lib/core/model/ArkImport.d.ts.map +1 -1
- package/lib/core/model/ArkImport.js +11 -12
- 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 +195 -17
- package/lib/core/model/ArkMethod.d.ts.map +1 -1
- package/lib/core/model/ArkMethod.js +363 -46
- package/lib/core/model/ArkNamespace.d.ts +6 -8
- package/lib/core/model/ArkNamespace.d.ts.map +1 -1
- package/lib/core/model/ArkNamespace.js +16 -20
- package/lib/core/model/ArkSignature.d.ts +41 -0
- package/lib/core/model/ArkSignature.d.ts.map +1 -1
- package/lib/core/model/ArkSignature.js +76 -19
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +60 -49
- package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkExportBuilder.js +12 -6
- package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkFieldBuilder.js +13 -9
- package/lib/core/model/builder/ArkFileBuilder.js +1 -3
- 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 +16 -13
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +3 -1
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +105 -45
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkNamespaceBuilder.js +4 -5
- package/lib/core/model/builder/builderUtils.d.ts +2 -1
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.js +63 -43
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/save/ArkStream.js +1 -1
- package/lib/save/DotPrinter.d.ts.map +1 -1
- package/lib/save/DotPrinter.js +1 -15
- package/lib/save/GraphPrinter.d.ts.map +1 -1
- package/lib/save/GraphPrinter.js +4 -2
- package/lib/save/JsonPrinter.js +5 -5
- package/lib/save/ViewTreePrinter.d.ts +16 -0
- package/lib/save/ViewTreePrinter.d.ts.map +1 -0
- package/lib/save/ViewTreePrinter.js +130 -0
- package/lib/save/source/SourceBase.d.ts +2 -2
- package/lib/save/source/SourceBase.d.ts.map +1 -1
- package/lib/save/source/SourceBase.js +6 -13
- package/lib/save/source/SourceBody.d.ts.map +1 -1
- package/lib/save/source/SourceBody.js +27 -14
- package/lib/save/source/SourceClass.d.ts.map +1 -1
- package/lib/save/source/SourceClass.js +12 -8
- package/lib/save/source/SourceField.d.ts.map +1 -1
- package/lib/save/source/SourceField.js +6 -2
- package/lib/save/source/SourceMethod.d.ts.map +1 -1
- package/lib/save/source/SourceMethod.js +10 -3
- package/lib/save/source/SourceModule.d.ts.map +1 -1
- package/lib/save/source/SourceModule.js +16 -10
- 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 +1 -1
- package/lib/save/source/SourceStmt.d.ts.map +1 -1
- package/lib/save/source/SourceStmt.js +37 -25
- 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 +82 -51
- package/lib/save/source/SourceUtils.d.ts.map +1 -1
- package/lib/save/source/SourceUtils.js +12 -11
- package/lib/transformer/StaticSingleAssignmentFormer.js +3 -3
- package/lib/utils/CfgStructualAnalysis.d.ts +1 -0
- package/lib/utils/CfgStructualAnalysis.d.ts.map +1 -1
- package/lib/utils/CfgStructualAnalysis.js +103 -72
- 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.d.ts.map +1 -1
- package/lib/utils/entryMethodUtils.js +27 -26
- 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
|
@@ -10,11 +10,13 @@ export interface ArkSignature {
|
|
|
10
10
|
export declare class FileSignature {
|
|
11
11
|
private projectName;
|
|
12
12
|
private fileName;
|
|
13
|
+
private hashcode;
|
|
13
14
|
static readonly DEFAULT: FileSignature;
|
|
14
15
|
constructor(projectName: string, fileName: string);
|
|
15
16
|
getProjectName(): string;
|
|
16
17
|
getFileName(): string;
|
|
17
18
|
toString(): string;
|
|
19
|
+
toMapKey(): string;
|
|
18
20
|
}
|
|
19
21
|
export declare class NamespaceSignature {
|
|
20
22
|
private namespaceName;
|
|
@@ -26,6 +28,7 @@ export declare class NamespaceSignature {
|
|
|
26
28
|
getDeclaringFileSignature(): FileSignature;
|
|
27
29
|
getDeclaringNamespaceSignature(): NamespaceSignature | null;
|
|
28
30
|
toString(): string;
|
|
31
|
+
toMapKey(): string;
|
|
29
32
|
}
|
|
30
33
|
export declare class ClassSignature {
|
|
31
34
|
private declaringFileSignature;
|
|
@@ -33,12 +36,25 @@ export declare class ClassSignature {
|
|
|
33
36
|
private className;
|
|
34
37
|
static readonly DEFAULT: ClassSignature;
|
|
35
38
|
constructor(className: string, declaringFileSignature: FileSignature, declaringNamespaceSignature?: NamespaceSignature | null);
|
|
39
|
+
/**
|
|
40
|
+
* Returns the declaring file signature.
|
|
41
|
+
* @returns The declaring file signature.
|
|
42
|
+
*/
|
|
36
43
|
getDeclaringFileSignature(): FileSignature;
|
|
44
|
+
/**
|
|
45
|
+
* Get the declaring namespace's signature.
|
|
46
|
+
* @returns the declaring namespace's signature.
|
|
47
|
+
*/
|
|
37
48
|
getDeclaringNamespaceSignature(): NamespaceSignature | null;
|
|
49
|
+
/**
|
|
50
|
+
* Get the **string** name of class from the the class signature. The default value is `""`.
|
|
51
|
+
* @returns The name of this class.
|
|
52
|
+
*/
|
|
38
53
|
getClassName(): string;
|
|
39
54
|
setClassName(className: string): void;
|
|
40
55
|
getType(): ClassType;
|
|
41
56
|
toString(): string;
|
|
57
|
+
toMapKey(): string;
|
|
42
58
|
}
|
|
43
59
|
export type BaseSignature = ClassSignature | NamespaceSignature;
|
|
44
60
|
export declare class FieldSignature {
|
|
@@ -66,6 +82,7 @@ export declare class MethodSubSignature {
|
|
|
66
82
|
getParameters(): MethodParameter[];
|
|
67
83
|
getParameterTypes(): Type[];
|
|
68
84
|
getReturnType(): Type;
|
|
85
|
+
setReturnType(returnType: Type): void;
|
|
69
86
|
isStatic(): boolean;
|
|
70
87
|
toString(): string;
|
|
71
88
|
}
|
|
@@ -76,10 +93,34 @@ export declare class MethodSignature {
|
|
|
76
93
|
private declaringClassSignature;
|
|
77
94
|
private methodSubSignature;
|
|
78
95
|
constructor(declaringClassSignature: ClassSignature, methodSubSignature: MethodSubSignature);
|
|
96
|
+
/**
|
|
97
|
+
* Return the declaring class signature.
|
|
98
|
+
* A {@link ClassSignature} includes:
|
|
99
|
+
* - 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".
|
|
100
|
+
* - 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.
|
|
101
|
+
* - Class Name: the **string** name of this class.
|
|
102
|
+
* @returns The declaring class signature.
|
|
103
|
+
* @example
|
|
104
|
+
* 1. get class signature from ArkMethod.
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
let methodSignature = expr.getMethodSignature();
|
|
108
|
+
let name = methodSignature.getDeclaringClassSignature().getClassName();
|
|
109
|
+
```
|
|
110
|
+
*
|
|
111
|
+
*/
|
|
79
112
|
getDeclaringClassSignature(): ClassSignature;
|
|
113
|
+
/**
|
|
114
|
+
* Returns the sub-signature of this method signature.
|
|
115
|
+
* The sub-signature is part of the method signature, which is used to
|
|
116
|
+
* identify the name of the method, its parameters and the return value type.
|
|
117
|
+
* @returns The sub-signature of this method signature.
|
|
118
|
+
*/
|
|
80
119
|
getMethodSubSignature(): MethodSubSignature;
|
|
81
120
|
getType(): Type;
|
|
82
121
|
toString(): string;
|
|
122
|
+
toMapKey(): string;
|
|
123
|
+
isMatch(signature: MethodSignature): boolean;
|
|
83
124
|
}
|
|
84
125
|
export declare class LocalSignature {
|
|
85
126
|
private name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkSignature.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkSignature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArkSignature.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkSignature.ts"],"names":[],"mappings":"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"}
|
|
@@ -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);
|
|
@@ -72,12 +87,24 @@ class ClassSignature {
|
|
|
72
87
|
this.declaringFileSignature = declaringFileSignature;
|
|
73
88
|
this.declaringNamespaceSignature = declaringNamespaceSignature;
|
|
74
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns the declaring file signature.
|
|
92
|
+
* @returns The declaring file signature.
|
|
93
|
+
*/
|
|
75
94
|
getDeclaringFileSignature() {
|
|
76
95
|
return this.declaringFileSignature;
|
|
77
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Get the declaring namespace's signature.
|
|
99
|
+
* @returns the declaring namespace's signature.
|
|
100
|
+
*/
|
|
78
101
|
getDeclaringNamespaceSignature() {
|
|
79
102
|
return this.declaringNamespaceSignature;
|
|
80
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Get the **string** name of class from the the class signature. The default value is `""`.
|
|
106
|
+
* @returns The name of this class.
|
|
107
|
+
*/
|
|
81
108
|
getClassName() {
|
|
82
109
|
return this.className;
|
|
83
110
|
}
|
|
@@ -95,6 +122,14 @@ class ClassSignature {
|
|
|
95
122
|
return this.declaringFileSignature.toString() + this.className;
|
|
96
123
|
}
|
|
97
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
|
+
}
|
|
98
133
|
}
|
|
99
134
|
exports.ClassSignature = ClassSignature;
|
|
100
135
|
ClassSignature.DEFAULT = new ClassSignature(Const_1.UNKNOWN_CLASS_NAME, FileSignature.DEFAULT, null);
|
|
@@ -161,18 +196,12 @@ class MethodSubSignature {
|
|
|
161
196
|
getReturnType() {
|
|
162
197
|
return this.returnType;
|
|
163
198
|
}
|
|
199
|
+
setReturnType(returnType) {
|
|
200
|
+
this.returnType = returnType;
|
|
201
|
+
}
|
|
164
202
|
isStatic() {
|
|
165
203
|
return this.staticFlag;
|
|
166
204
|
}
|
|
167
|
-
// // temp for being compatible with existing type inference
|
|
168
|
-
// public setReturnType(returnType: Type): void {
|
|
169
|
-
// this.returnType = returnType;
|
|
170
|
-
// }
|
|
171
|
-
//
|
|
172
|
-
// // temp for being compatible with existing type inference
|
|
173
|
-
// public setStaticFlag(flag: boolean): void {
|
|
174
|
-
// this.staticFlag = flag;
|
|
175
|
-
// }
|
|
176
205
|
toString() {
|
|
177
206
|
let paraStr = "";
|
|
178
207
|
this.getParameterTypes().forEach((parameterType) => {
|
|
@@ -195,9 +224,31 @@ class MethodSignature {
|
|
|
195
224
|
this.declaringClassSignature = declaringClassSignature;
|
|
196
225
|
this.methodSubSignature = methodSubSignature;
|
|
197
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Return the declaring class signature.
|
|
229
|
+
* A {@link ClassSignature} includes:
|
|
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".
|
|
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.
|
|
232
|
+
* - Class Name: the **string** name of this class.
|
|
233
|
+
* @returns The declaring class signature.
|
|
234
|
+
* @example
|
|
235
|
+
* 1. get class signature from ArkMethod.
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
let methodSignature = expr.getMethodSignature();
|
|
239
|
+
let name = methodSignature.getDeclaringClassSignature().getClassName();
|
|
240
|
+
```
|
|
241
|
+
*
|
|
242
|
+
*/
|
|
198
243
|
getDeclaringClassSignature() {
|
|
199
244
|
return this.declaringClassSignature;
|
|
200
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Returns the sub-signature of this method signature.
|
|
248
|
+
* The sub-signature is part of the method signature, which is used to
|
|
249
|
+
* identify the name of the method, its parameters and the return value type.
|
|
250
|
+
* @returns The sub-signature of this method signature.
|
|
251
|
+
*/
|
|
201
252
|
getMethodSubSignature() {
|
|
202
253
|
return this.methodSubSignature;
|
|
203
254
|
}
|
|
@@ -207,6 +258,12 @@ class MethodSignature {
|
|
|
207
258
|
toString() {
|
|
208
259
|
return this.declaringClassSignature.toString() + '.' + this.methodSubSignature.toString();
|
|
209
260
|
}
|
|
261
|
+
toMapKey() {
|
|
262
|
+
return this.declaringClassSignature.toMapKey() + '.' + this.methodSubSignature.toString();
|
|
263
|
+
}
|
|
264
|
+
isMatch(signature) {
|
|
265
|
+
return ((this.toString() === signature.toString()) && (this.getType().toString() === signature.getType().toString()));
|
|
266
|
+
}
|
|
210
267
|
}
|
|
211
268
|
exports.MethodSignature = MethodSignature;
|
|
212
269
|
class LocalSignature {
|
|
@@ -228,7 +285,7 @@ exports.LocalSignature = LocalSignature;
|
|
|
228
285
|
//TODO, reconstruct
|
|
229
286
|
function fieldSignatureCompare(leftSig, rightSig) {
|
|
230
287
|
if (leftSig.getDeclaringSignature().toString() === rightSig.getDeclaringSignature().toString() &&
|
|
231
|
-
(leftSig.getFieldName()
|
|
288
|
+
(leftSig.getFieldName() === rightSig.getFieldName())) {
|
|
232
289
|
return true;
|
|
233
290
|
}
|
|
234
291
|
return false;
|
|
@@ -243,7 +300,7 @@ function methodSignatureCompare(leftSig, rightSig) {
|
|
|
243
300
|
}
|
|
244
301
|
exports.methodSignatureCompare = methodSignatureCompare;
|
|
245
302
|
function methodSubSignatureCompare(leftSig, rightSig) {
|
|
246
|
-
if ((leftSig.getMethodName()
|
|
303
|
+
if ((leftSig.getMethodName() === rightSig.getMethodName()) && arrayCompare(leftSig.getParameterTypes(), rightSig.getParameterTypes()) && leftSig.getReturnType() === rightSig.getReturnType()) {
|
|
247
304
|
return true;
|
|
248
305
|
}
|
|
249
306
|
return false;
|
|
@@ -251,25 +308,25 @@ function methodSubSignatureCompare(leftSig, rightSig) {
|
|
|
251
308
|
exports.methodSubSignatureCompare = methodSubSignatureCompare;
|
|
252
309
|
function classSignatureCompare(leftSig, rightSig) {
|
|
253
310
|
if ((fileSignatureCompare(leftSig.getDeclaringFileSignature(), rightSig.getDeclaringFileSignature())) &&
|
|
254
|
-
(leftSig.getClassName()
|
|
311
|
+
(leftSig.getClassName() === rightSig.getClassName())) {
|
|
255
312
|
return true;
|
|
256
313
|
}
|
|
257
314
|
return false;
|
|
258
315
|
}
|
|
259
316
|
exports.classSignatureCompare = classSignatureCompare;
|
|
260
317
|
function fileSignatureCompare(leftSig, rightSig) {
|
|
261
|
-
if ((leftSig.getFileName()
|
|
318
|
+
if ((leftSig.getFileName() === rightSig.getFileName()) && (leftSig.getProjectName() === rightSig.getProjectName())) {
|
|
262
319
|
return true;
|
|
263
320
|
}
|
|
264
321
|
return false;
|
|
265
322
|
}
|
|
266
323
|
exports.fileSignatureCompare = fileSignatureCompare;
|
|
267
324
|
function arrayCompare(leftArray, rightArray) {
|
|
268
|
-
if (leftArray.length
|
|
325
|
+
if (leftArray.length !== rightArray.length) {
|
|
269
326
|
return false;
|
|
270
327
|
}
|
|
271
328
|
for (let i = 0; i < leftArray.length; i++) {
|
|
272
|
-
if (leftArray[i]
|
|
329
|
+
if (leftArray[i] !== rightArray[i]) {
|
|
273
330
|
return false;
|
|
274
331
|
}
|
|
275
332
|
}
|
|
@@ -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;AAqBtD,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;
|
|
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;AAqBtD,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"}
|
|
@@ -133,7 +133,10 @@ function buildNormalArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
133
133
|
case ohos_typescript_1.default.SyntaxKind.ObjectLiteralExpression:
|
|
134
134
|
buildObjectLiteralExpression2ArkClass(clsNode, cls, sourceFile, declaringMethod);
|
|
135
135
|
break;
|
|
136
|
+
default:
|
|
137
|
+
;
|
|
136
138
|
}
|
|
139
|
+
IRUtils_1.IRUtils.setLeadingComments(cls, clsNode, sourceFile, cls.getDeclaringArkFile().getScene().getOptions());
|
|
137
140
|
}
|
|
138
141
|
exports.buildNormalArkClass = buildNormalArkClass;
|
|
139
142
|
function init4InstanceInitMethod(cls) {
|
|
@@ -142,7 +145,9 @@ function init4InstanceInitMethod(cls) {
|
|
|
142
145
|
instanceInit.setIsGeneratedFlag(true);
|
|
143
146
|
const methodSubSignature = ArkSignatureBuilder_1.ArkSignatureBuilder.buildMethodSubSignatureFromMethodName(Const_1.INSTANCE_INIT_METHOD_NAME);
|
|
144
147
|
const methodSignature = new ArkSignature_1.MethodSignature(instanceInit.getDeclaringArkClass().getSignature(), methodSubSignature);
|
|
145
|
-
instanceInit.
|
|
148
|
+
instanceInit.setImplementationSignature(methodSignature);
|
|
149
|
+
instanceInit.setLineCol(0);
|
|
150
|
+
(0, ArkMethodBuilder_1.checkAndUpdateMethod)(instanceInit, cls);
|
|
146
151
|
cls.addMethod(instanceInit);
|
|
147
152
|
cls.setInstanceInitMethod(instanceInit);
|
|
148
153
|
}
|
|
@@ -152,7 +157,9 @@ function init4StaticInitMethod(cls) {
|
|
|
152
157
|
staticInit.setIsGeneratedFlag(true);
|
|
153
158
|
const methodSubSignature = ArkSignatureBuilder_1.ArkSignatureBuilder.buildMethodSubSignatureFromMethodName(Const_1.STATIC_INIT_METHOD_NAME);
|
|
154
159
|
const methodSignature = new ArkSignature_1.MethodSignature(staticInit.getDeclaringArkClass().getSignature(), methodSubSignature);
|
|
155
|
-
staticInit.
|
|
160
|
+
staticInit.setImplementationSignature(methodSignature);
|
|
161
|
+
staticInit.setLineCol(0);
|
|
162
|
+
(0, ArkMethodBuilder_1.checkAndUpdateMethod)(staticInit, cls);
|
|
156
163
|
cls.addMethod(staticInit);
|
|
157
164
|
cls.setStaticInitMethod(staticInit);
|
|
158
165
|
}
|
|
@@ -174,7 +181,7 @@ function buildStruct2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
174
181
|
}
|
|
175
182
|
if (clsNode.heritageClauses) {
|
|
176
183
|
for (let [key, value] of (0, builderUtils_1.buildHeritageClauses)(clsNode.heritageClauses)) {
|
|
177
|
-
if (value
|
|
184
|
+
if (value === 'ExtendsKeyword') {
|
|
178
185
|
cls.setSuperClassName(key);
|
|
179
186
|
}
|
|
180
187
|
else {
|
|
@@ -182,9 +189,8 @@ function buildStruct2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
182
189
|
}
|
|
183
190
|
}
|
|
184
191
|
}
|
|
185
|
-
(0, builderUtils_1.buildModifiers)(clsNode
|
|
186
|
-
|
|
187
|
-
});
|
|
192
|
+
cls.setModifiers((0, builderUtils_1.buildModifiers)(clsNode));
|
|
193
|
+
cls.setDecorators((0, builderUtils_1.buildDecorators)(clsNode, sourceFile));
|
|
188
194
|
cls.setCategory(ArkClass_1.ClassCategory.STRUCT);
|
|
189
195
|
init4InstanceInitMethod(cls);
|
|
190
196
|
init4StaticInitMethod(cls);
|
|
@@ -208,7 +214,7 @@ function buildClass2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
208
214
|
}
|
|
209
215
|
if (clsNode.heritageClauses) {
|
|
210
216
|
for (let [key, value] of (0, builderUtils_1.buildHeritageClauses)(clsNode.heritageClauses)) {
|
|
211
|
-
if (value
|
|
217
|
+
if (value === 'ExtendsKeyword') {
|
|
212
218
|
cls.setSuperClassName(key);
|
|
213
219
|
}
|
|
214
220
|
else {
|
|
@@ -216,9 +222,8 @@ function buildClass2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
216
222
|
}
|
|
217
223
|
}
|
|
218
224
|
}
|
|
219
|
-
(0, builderUtils_1.buildModifiers)(clsNode
|
|
220
|
-
|
|
221
|
-
});
|
|
225
|
+
cls.setModifiers((0, builderUtils_1.buildModifiers)(clsNode));
|
|
226
|
+
cls.setDecorators((0, builderUtils_1.buildDecorators)(clsNode, sourceFile));
|
|
222
227
|
cls.setCategory(ArkClass_1.ClassCategory.CLASS);
|
|
223
228
|
init4InstanceInitMethod(cls);
|
|
224
229
|
init4StaticInitMethod(cls);
|
|
@@ -242,7 +247,7 @@ function buildInterface2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
242
247
|
}
|
|
243
248
|
if (clsNode.heritageClauses) {
|
|
244
249
|
for (let [key, value] of (0, builderUtils_1.buildHeritageClauses)(clsNode.heritageClauses)) {
|
|
245
|
-
if (value
|
|
250
|
+
if (value === 'ExtendsKeyword') {
|
|
246
251
|
cls.setSuperClassName(key);
|
|
247
252
|
}
|
|
248
253
|
else {
|
|
@@ -250,9 +255,8 @@ function buildInterface2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
250
255
|
}
|
|
251
256
|
}
|
|
252
257
|
}
|
|
253
|
-
(0, builderUtils_1.buildModifiers)(clsNode
|
|
254
|
-
|
|
255
|
-
});
|
|
258
|
+
cls.setModifiers((0, builderUtils_1.buildModifiers)(clsNode));
|
|
259
|
+
cls.setDecorators((0, builderUtils_1.buildDecorators)(clsNode, sourceFile));
|
|
256
260
|
cls.setCategory(ArkClass_1.ClassCategory.INTERFACE);
|
|
257
261
|
buildArkClassMembers(clsNode, cls, sourceFile);
|
|
258
262
|
}
|
|
@@ -267,9 +271,8 @@ function buildEnum2ArkClass(clsNode, cls, sourceFile, declaringMethod) {
|
|
|
267
271
|
}
|
|
268
272
|
const classSignature = new ArkSignature_1.ClassSignature(className, cls.getDeclaringArkFile().getFileSignature(), ((_a = cls.getDeclaringArkNamespace()) === null || _a === void 0 ? void 0 : _a.getSignature()) || null);
|
|
269
273
|
cls.setSignature(classSignature);
|
|
270
|
-
(0, builderUtils_1.buildModifiers)(clsNode
|
|
271
|
-
|
|
272
|
-
});
|
|
274
|
+
cls.setModifiers((0, builderUtils_1.buildModifiers)(clsNode));
|
|
275
|
+
cls.setDecorators((0, builderUtils_1.buildDecorators)(clsNode, sourceFile));
|
|
273
276
|
cls.setCategory(ArkClass_1.ClassCategory.ENUM);
|
|
274
277
|
init4StaticInitMethod(cls);
|
|
275
278
|
buildArkClassMembers(clsNode, cls, sourceFile);
|
|
@@ -295,13 +298,14 @@ function buildObjectLiteralExpression2ArkClass(clsNode, cls, sourceFile, declari
|
|
|
295
298
|
cls.setCategory(ArkClass_1.ClassCategory.OBJECT);
|
|
296
299
|
let arkMethods = [];
|
|
297
300
|
init4InstanceInitMethod(cls);
|
|
298
|
-
const instanceInitStmtMap = new Map();
|
|
299
301
|
const instanceIRTransformer = new ArkIRTransformer_1.ArkIRTransformer(sourceFile, cls.getInstanceInitMethod());
|
|
302
|
+
const instanceFieldInitializerStmts = [];
|
|
300
303
|
clsNode.properties.forEach((property) => {
|
|
301
304
|
if (ohos_typescript_1.default.isPropertyAssignment(property) || ohos_typescript_1.default.isShorthandPropertyAssignment(property) || ohos_typescript_1.default.isSpreadAssignment(property)) {
|
|
302
305
|
const arkField = (0, ArkFieldBuilder_1.buildProperty2ArkField)(property, sourceFile, cls);
|
|
303
306
|
if (ohos_typescript_1.default.isPropertyAssignment(property)) {
|
|
304
|
-
getInitStmts(instanceIRTransformer, arkField,
|
|
307
|
+
getInitStmts(instanceIRTransformer, arkField, property.initializer);
|
|
308
|
+
instanceFieldInitializerStmts.push(...arkField.getInitializer());
|
|
305
309
|
}
|
|
306
310
|
}
|
|
307
311
|
else {
|
|
@@ -310,8 +314,9 @@ function buildObjectLiteralExpression2ArkClass(clsNode, cls, sourceFile, declari
|
|
|
310
314
|
(0, ArkMethodBuilder_1.buildArkMethodFromArkClass)(property, cls, arkMethod, sourceFile);
|
|
311
315
|
}
|
|
312
316
|
});
|
|
313
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(),
|
|
317
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(), instanceFieldInitializerStmts, instanceIRTransformer.getThisLocal());
|
|
314
318
|
arkMethods.forEach((mtd) => {
|
|
319
|
+
(0, ArkMethodBuilder_1.checkAndUpdateMethod)(mtd, cls);
|
|
315
320
|
cls.addMethod(mtd);
|
|
316
321
|
});
|
|
317
322
|
}
|
|
@@ -335,6 +340,7 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
|
|
|
335
340
|
if (ohos_typescript_1.default.isObjectLiteralExpression(clsNode)) {
|
|
336
341
|
return;
|
|
337
342
|
}
|
|
343
|
+
buildMethodsForClass(clsNode, cls, sourceFile);
|
|
338
344
|
let instanceIRTransformer;
|
|
339
345
|
let staticIRTransformer;
|
|
340
346
|
if (ohos_typescript_1.default.isClassDeclaration(clsNode) || ohos_typescript_1.default.isClassExpression(clsNode) || ohos_typescript_1.default.isStructDeclaration(clsNode)) {
|
|
@@ -344,41 +350,28 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
|
|
|
344
350
|
if (ohos_typescript_1.default.isEnumDeclaration(clsNode)) {
|
|
345
351
|
staticIRTransformer = new ArkIRTransformer_1.ArkIRTransformer(sourceFile, cls.getStaticInitMethod());
|
|
346
352
|
}
|
|
347
|
-
const
|
|
348
|
-
const
|
|
349
|
-
// 先构建所有method,再构建field
|
|
350
|
-
clsNode.members.forEach((member) => {
|
|
351
|
-
if (ohos_typescript_1.default.isMethodDeclaration(member) ||
|
|
352
|
-
ohos_typescript_1.default.isConstructorDeclaration(member) ||
|
|
353
|
-
ohos_typescript_1.default.isMethodSignature(member) ||
|
|
354
|
-
ohos_typescript_1.default.isConstructSignatureDeclaration(member) ||
|
|
355
|
-
ohos_typescript_1.default.isAccessor(member) ||
|
|
356
|
-
ohos_typescript_1.default.isCallSignatureDeclaration(member)) {
|
|
357
|
-
let mthd = new ArkMethod_1.ArkMethod();
|
|
358
|
-
(0, ArkMethodBuilder_1.buildArkMethodFromArkClass)(member, cls, mthd, sourceFile);
|
|
359
|
-
cls.addMethod(mthd);
|
|
360
|
-
if (ohos_typescript_1.default.isGetAccessor(member)) {
|
|
361
|
-
(0, ArkFieldBuilder_1.buildGetAccessor2ArkField)(member, mthd, sourceFile);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
});
|
|
353
|
+
const staticFieldInitializerStmts = [];
|
|
354
|
+
const instanceFieldInitializerStmts = [];
|
|
365
355
|
clsNode.members.forEach((member) => {
|
|
366
356
|
if (ohos_typescript_1.default.isPropertyDeclaration(member) || ohos_typescript_1.default.isPropertySignature(member)) {
|
|
367
357
|
const arkField = (0, ArkFieldBuilder_1.buildProperty2ArkField)(member, sourceFile, cls);
|
|
368
358
|
if (ohos_typescript_1.default.isClassDeclaration(clsNode) || ohos_typescript_1.default.isClassExpression(clsNode) || ohos_typescript_1.default.isStructDeclaration(clsNode)) {
|
|
369
359
|
if (arkField.isStatic()) {
|
|
370
|
-
getInitStmts(staticIRTransformer, arkField,
|
|
360
|
+
getInitStmts(staticIRTransformer, arkField, member.initializer);
|
|
361
|
+
staticFieldInitializerStmts.push(...arkField.getInitializer());
|
|
371
362
|
}
|
|
372
363
|
else {
|
|
373
364
|
if (!instanceIRTransformer)
|
|
374
365
|
console.log(clsNode.getText(sourceFile));
|
|
375
|
-
getInitStmts(instanceIRTransformer, arkField,
|
|
366
|
+
getInitStmts(instanceIRTransformer, arkField, member.initializer);
|
|
367
|
+
instanceFieldInitializerStmts.push(...arkField.getInitializer());
|
|
376
368
|
}
|
|
377
369
|
}
|
|
378
370
|
}
|
|
379
371
|
else if (ohos_typescript_1.default.isEnumMember(member)) {
|
|
380
372
|
const arkField = (0, ArkFieldBuilder_1.buildProperty2ArkField)(member, sourceFile, cls);
|
|
381
|
-
getInitStmts(staticIRTransformer, arkField,
|
|
373
|
+
getInitStmts(staticIRTransformer, arkField, member.initializer);
|
|
374
|
+
staticFieldInitializerStmts.push(...arkField.getInitializer());
|
|
382
375
|
}
|
|
383
376
|
else if (ohos_typescript_1.default.isIndexSignatureDeclaration(member)) {
|
|
384
377
|
(0, ArkFieldBuilder_1.buildIndexSignature2ArkField)(member, sourceFile, cls);
|
|
@@ -391,14 +384,30 @@ function buildArkClassMembers(clsNode, cls, sourceFile) {
|
|
|
391
384
|
}
|
|
392
385
|
});
|
|
393
386
|
if (ohos_typescript_1.default.isClassDeclaration(clsNode) || ohos_typescript_1.default.isClassExpression(clsNode) || ohos_typescript_1.default.isStructDeclaration(clsNode)) {
|
|
394
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(),
|
|
395
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(),
|
|
387
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getInstanceInitMethod(), instanceFieldInitializerStmts, instanceIRTransformer.getThisLocal());
|
|
388
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticFieldInitializerStmts, staticIRTransformer.getThisLocal());
|
|
396
389
|
}
|
|
397
390
|
if (ohos_typescript_1.default.isEnumDeclaration(clsNode)) {
|
|
398
|
-
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(),
|
|
391
|
+
(0, ArkMethodBuilder_1.buildInitMethod)(cls.getStaticInitMethod(), staticFieldInitializerStmts, staticIRTransformer.getThisLocal());
|
|
399
392
|
}
|
|
400
393
|
}
|
|
401
|
-
function
|
|
394
|
+
function buildMethodsForClass(clsNode, cls, sourceFile) {
|
|
395
|
+
clsNode.members.forEach((member) => {
|
|
396
|
+
if (ohos_typescript_1.default.isMethodDeclaration(member) ||
|
|
397
|
+
ohos_typescript_1.default.isConstructorDeclaration(member) ||
|
|
398
|
+
ohos_typescript_1.default.isMethodSignature(member) ||
|
|
399
|
+
ohos_typescript_1.default.isConstructSignatureDeclaration(member) ||
|
|
400
|
+
ohos_typescript_1.default.isAccessor(member) ||
|
|
401
|
+
ohos_typescript_1.default.isCallSignatureDeclaration(member)) {
|
|
402
|
+
let mthd = new ArkMethod_1.ArkMethod();
|
|
403
|
+
(0, ArkMethodBuilder_1.buildArkMethodFromArkClass)(member, cls, mthd, sourceFile);
|
|
404
|
+
if (ohos_typescript_1.default.isGetAccessor(member)) {
|
|
405
|
+
(0, ArkFieldBuilder_1.buildGetAccessor2ArkField)(member, mthd, sourceFile);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
function getInitStmts(transformer, field, initNode) {
|
|
402
411
|
if (initNode) {
|
|
403
412
|
const stmts = [];
|
|
404
413
|
let { value: initValue, valueOriginalPositions: initPositions, stmts: initStmts, } = transformer.tsNodeToValueAndStmts(initNode);
|
|
@@ -409,13 +418,15 @@ function getInitStmts(transformer, field, initStmtMap, initNode) {
|
|
|
409
418
|
stmts.push(...initStmts);
|
|
410
419
|
}
|
|
411
420
|
const fieldRef = new Ref_1.ArkInstanceFieldRef(transformer.getThisLocal(), field.getSignature());
|
|
412
|
-
const
|
|
421
|
+
const fieldRefPositions = [Position_1.FullPosition.DEFAULT, Position_1.FullPosition.DEFAULT];
|
|
413
422
|
const assignStmt = new Stmt_1.ArkAssignStmt(fieldRef, initValue);
|
|
414
|
-
assignStmt.setOperandOriginalPositions([...
|
|
423
|
+
assignStmt.setOperandOriginalPositions([...fieldRefPositions, ...initPositions]);
|
|
415
424
|
stmts.push(assignStmt);
|
|
425
|
+
const fieldSourceCode = field.getCode();
|
|
426
|
+
const fieldOriginPosition = field.getOriginPosition();
|
|
416
427
|
for (const stmt of stmts) {
|
|
417
|
-
|
|
418
|
-
|
|
428
|
+
stmt.setOriginPositionInfo(fieldOriginPosition);
|
|
429
|
+
stmt.setOriginalText(fieldSourceCode);
|
|
419
430
|
}
|
|
420
431
|
field.setInitializer(stmts);
|
|
421
432
|
}
|
|
@@ -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,CAAC;
|
|
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,CAAC;AAE3E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAKrC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,CAAC;AAE1E,iBAAS,eAAe,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,GAAG,UAAU,CASpG;AAGD,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,cAOxF;AAED,iBAAS,sBAAsB,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,CA4CrH;AAED,iBAAS,qBAAqB,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,CA4CnH;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,CAiBlI;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,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"}
|
|
@@ -23,6 +23,8 @@ const Position_1 = require("../../base/Position");
|
|
|
23
23
|
const ArkExport_1 = require("../ArkExport");
|
|
24
24
|
const builderUtils_1 = require("./builderUtils");
|
|
25
25
|
const TSConst_1 = require("../../common/TSConst");
|
|
26
|
+
const ArkBaseModel_1 = require("../ArkBaseModel");
|
|
27
|
+
const IRUtils_1 = require("../../common/IRUtils");
|
|
26
28
|
function buildExportInfo(arkInstance, arkFile, line) {
|
|
27
29
|
return new ArkExport_1.ExportInfo.Builder()
|
|
28
30
|
.exportClauseName(arkInstance.getName())
|
|
@@ -47,7 +49,7 @@ exports.buildDefaultExportInfo = buildDefaultExportInfo;
|
|
|
47
49
|
function buildExportDeclaration(node, sourceFile, arkFile) {
|
|
48
50
|
const originTsPosition = Position_1.LineColPosition.buildFromNode(node, sourceFile);
|
|
49
51
|
const tsSourceCode = node.getText(sourceFile);
|
|
50
|
-
const modifiers = node.modifiers ? (0, builderUtils_1.buildModifiers)(node
|
|
52
|
+
const modifiers = node.modifiers ? (0, builderUtils_1.buildModifiers)(node) : 0;
|
|
51
53
|
let exportFrom = '';
|
|
52
54
|
if (node.moduleSpecifier && ohos_typescript_1.default.isStringLiteral(node.moduleSpecifier)) {
|
|
53
55
|
exportFrom = node.moduleSpecifier.text;
|
|
@@ -63,6 +65,7 @@ function buildExportDeclaration(node, sourceFile, arkFile) {
|
|
|
63
65
|
.exportFrom(exportFrom)
|
|
64
66
|
.originTsPosition(originTsPosition)
|
|
65
67
|
.declaringArkFile(arkFile)
|
|
68
|
+
.setLeadingComments(IRUtils_1.IRUtils.getLeadingComments(node, sourceFile, arkFile.getScene().getOptions()))
|
|
66
69
|
.modifiers(modifiers);
|
|
67
70
|
if (element.propertyName && ohos_typescript_1.default.isIdentifier(element.propertyName)) {
|
|
68
71
|
builder.nameBeforeAs(element.propertyName.text);
|
|
@@ -78,6 +81,7 @@ function buildExportDeclaration(node, sourceFile, arkFile) {
|
|
|
78
81
|
.tsSourceCode(tsSourceCode)
|
|
79
82
|
.exportFrom(exportFrom)
|
|
80
83
|
.declaringArkFile(arkFile)
|
|
84
|
+
.setLeadingComments(IRUtils_1.IRUtils.getLeadingComments(node, sourceFile, arkFile.getScene().getOptions()))
|
|
81
85
|
.originTsPosition(originTsPosition);
|
|
82
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'
|
|
83
87
|
exportInfos.push(builder1.exportClauseName(node.exportClause.name.text).build());
|
|
@@ -95,9 +99,9 @@ function buildExportAssignment(node, sourceFile, arkFile) {
|
|
|
95
99
|
}
|
|
96
100
|
const originTsPosition = Position_1.LineColPosition.buildFromNode(node, sourceFile);
|
|
97
101
|
const tsSourceCode = node.getText(sourceFile);
|
|
98
|
-
|
|
102
|
+
let modifiers = (0, builderUtils_1.buildModifiers)(node);
|
|
99
103
|
if (isKeyword(node.getChildren(sourceFile), ohos_typescript_1.default.SyntaxKind.DefaultKeyword)) {
|
|
100
|
-
modifiers.
|
|
104
|
+
modifiers |= ArkBaseModel_1.ModifierType.DEFAULT;
|
|
101
105
|
}
|
|
102
106
|
if (ohos_typescript_1.default.isObjectLiteralExpression(node.expression) && node.expression.properties) { // just like: export default {a,b,c}
|
|
103
107
|
node.expression.properties.forEach((property) => {
|
|
@@ -110,6 +114,7 @@ function buildExportAssignment(node, sourceFile, arkFile) {
|
|
|
110
114
|
.tsSourceCode(tsSourceCode)
|
|
111
115
|
.originTsPosition(originTsPosition)
|
|
112
116
|
.declaringArkFile(arkFile)
|
|
117
|
+
.setLeadingComments(IRUtils_1.IRUtils.getLeadingComments(node, sourceFile, arkFile.getScene().getOptions()))
|
|
113
118
|
.build();
|
|
114
119
|
exportInfos.push(exportInfo);
|
|
115
120
|
}
|
|
@@ -122,7 +127,8 @@ function buildExportAssignment(node, sourceFile, arkFile) {
|
|
|
122
127
|
.tsSourceCode(tsSourceCode)
|
|
123
128
|
.originTsPosition(originTsPosition)
|
|
124
129
|
.declaringArkFile(arkFile)
|
|
125
|
-
.exportClauseName(TSConst_1.DEFAULT)
|
|
130
|
+
.exportClauseName(TSConst_1.DEFAULT)
|
|
131
|
+
.setLeadingComments(IRUtils_1.IRUtils.getLeadingComments(node, sourceFile, arkFile.getScene().getOptions()));
|
|
126
132
|
if (ohos_typescript_1.default.isIdentifier(node.expression)) { // just like: export default xx
|
|
127
133
|
exportInfo.nameBeforeAs(node.expression.text);
|
|
128
134
|
}
|
|
@@ -143,7 +149,7 @@ exports.buildExportAssignment = buildExportAssignment;
|
|
|
143
149
|
function buildExportVariableStatement(node, sourceFile, arkFile) {
|
|
144
150
|
let exportInfos = [];
|
|
145
151
|
const originTsPosition = Position_1.LineColPosition.buildFromNode(node, sourceFile);
|
|
146
|
-
const modifiers = node.modifiers ? (0, builderUtils_1.buildModifiers)(node
|
|
152
|
+
const modifiers = node.modifiers ? (0, builderUtils_1.buildModifiers)(node) : 0;
|
|
147
153
|
const tsSourceCode = node.getText(sourceFile);
|
|
148
154
|
node.declarationList.declarations.forEach(dec => {
|
|
149
155
|
const exportInfo = new ArkExport_1.ExportInfo.Builder()
|
|
@@ -168,7 +174,7 @@ exports.buildExportVariableStatement = buildExportVariableStatement;
|
|
|
168
174
|
function buildExportTypeAliasDeclaration(node, sourceFile, arkFile) {
|
|
169
175
|
let exportInfos = [];
|
|
170
176
|
const originTsPosition = Position_1.LineColPosition.buildFromNode(node, sourceFile);
|
|
171
|
-
const modifiers = node.modifiers ? (0, builderUtils_1.buildModifiers)(node
|
|
177
|
+
const modifiers = node.modifiers ? (0, builderUtils_1.buildModifiers)(node) : 0;
|
|
172
178
|
const tsSourceCode = node.getText(sourceFile);
|
|
173
179
|
const exportInfo = new ArkExport_1.ExportInfo.Builder()
|
|
174
180
|
.exportClauseName(node.name.text)
|