arkanalyzer 1.0.17 → 1.0.19
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/lib/callgraph/pointerAnalysis/Pag.d.ts +3 -2
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.js +5 -3
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +4 -4
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +5 -4
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts +2 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +11 -9
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.d.ts +8 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.js +27 -3
- package/lib/callgraph/pointerAnalysis/PtsDS.d.ts +30 -6
- package/lib/callgraph/pointerAnalysis/PtsDS.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PtsDS.js +86 -5
- package/lib/core/base/Decorator.d.ts +1 -0
- package/lib/core/base/Decorator.d.ts.map +1 -1
- package/lib/core/base/Decorator.js +4 -1
- package/lib/core/base/Stmt.d.ts +3 -0
- package/lib/core/base/Stmt.d.ts.map +1 -1
- package/lib/core/base/Stmt.js +34 -0
- package/lib/core/base/Type.d.ts +45 -3
- package/lib/core/base/Type.d.ts.map +1 -1
- package/lib/core/base/Type.js +84 -4
- package/lib/core/base/TypeExpr.d.ts +72 -0
- package/lib/core/base/TypeExpr.d.ts.map +1 -0
- package/lib/core/base/TypeExpr.js +155 -0
- package/lib/core/common/ArkIRTransformer.d.ts +1 -0
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +46 -23
- package/lib/core/common/ArkValueTransformer.d.ts +1 -0
- package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkValueTransformer.js +66 -16
- package/lib/core/common/IRInference.d.ts +5 -1
- package/lib/core/common/IRInference.d.ts.map +1 -1
- package/lib/core/common/IRInference.js +71 -0
- package/lib/core/common/ModelUtils.d.ts +3 -1
- package/lib/core/common/ModelUtils.d.ts.map +1 -1
- package/lib/core/common/ModelUtils.js +23 -1
- package/lib/core/common/TypeInference.d.ts +6 -0
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +82 -14
- package/lib/core/{common → graph/builder}/CfgBuilder.d.ts +34 -46
- package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -0
- package/lib/core/graph/builder/CfgBuilder.js +1139 -0
- package/lib/core/graph/builder/ConditionBuilder.d.ts +16 -0
- package/lib/core/graph/builder/ConditionBuilder.d.ts.map +1 -0
- package/lib/core/graph/builder/ConditionBuilder.js +252 -0
- package/lib/core/graph/builder/LoopBuilder.d.ts +21 -0
- package/lib/core/graph/builder/LoopBuilder.d.ts.map +1 -0
- package/lib/core/graph/builder/LoopBuilder.js +251 -0
- package/lib/core/graph/builder/SwitchBuilder.d.ts +12 -0
- package/lib/core/graph/builder/SwitchBuilder.d.ts.map +1 -0
- package/lib/core/graph/builder/SwitchBuilder.js +152 -0
- package/lib/core/graph/builder/TrapBuilder.d.ts +17 -0
- package/lib/core/graph/builder/TrapBuilder.d.ts.map +1 -0
- package/lib/core/graph/builder/TrapBuilder.js +272 -0
- package/lib/core/model/ArkMethod.d.ts +1 -1
- package/lib/core/model/ArkMethod.js +1 -1
- package/lib/core/model/ArkSignature.d.ts +9 -1
- package/lib/core/model/ArkSignature.d.ts.map +1 -1
- package/lib/core/model/ArkSignature.js +17 -1
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +2 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +1 -1
- package/lib/core/{common → model/builder}/BodyBuilder.d.ts +5 -5
- package/lib/core/model/builder/BodyBuilder.d.ts.map +1 -0
- package/lib/core/{common → model/builder}/BodyBuilder.js +12 -12
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.js +79 -5
- package/lib/save/JsonPrinter.d.ts +1 -1
- package/lib/save/JsonPrinter.d.ts.map +1 -1
- package/lib/save/JsonPrinter.js +2 -2
- package/lib/save/PrinterBuilder.d.ts +22 -0
- package/lib/save/PrinterBuilder.d.ts.map +1 -1
- package/lib/save/PrinterBuilder.js +54 -1
- package/lib/save/arkir/ArkIRClassPrinter.d.ts +14 -0
- package/lib/save/arkir/ArkIRClassPrinter.d.ts.map +1 -0
- package/lib/save/arkir/ArkIRClassPrinter.js +92 -0
- package/lib/save/arkir/ArkIRFieldPrinter.d.ts +12 -0
- package/lib/save/arkir/ArkIRFieldPrinter.d.ts.map +1 -0
- package/lib/save/arkir/ArkIRFieldPrinter.js +64 -0
- package/lib/save/arkir/ArkIRFilePrinter.d.ts +13 -0
- package/lib/save/arkir/ArkIRFilePrinter.d.ts.map +1 -0
- package/lib/save/arkir/ArkIRFilePrinter.js +54 -0
- package/lib/save/arkir/ArkIRMethodPrinter.d.ts +17 -0
- package/lib/save/arkir/ArkIRMethodPrinter.d.ts.map +1 -0
- package/lib/save/arkir/ArkIRMethodPrinter.js +159 -0
- package/lib/save/arkir/ArkIRNamespacePrinter.d.ts +12 -0
- package/lib/save/arkir/ArkIRNamespacePrinter.d.ts.map +1 -0
- package/lib/save/arkir/ArkIRNamespacePrinter.js +66 -0
- package/lib/save/base/BasePrinter.d.ts +24 -0
- package/lib/save/base/BasePrinter.d.ts.map +1 -0
- package/lib/save/base/BasePrinter.js +70 -0
- package/lib/save/base/ExportPrinter.d.ts +9 -0
- package/lib/save/base/ExportPrinter.d.ts.map +1 -0
- package/lib/save/base/ExportPrinter.js +67 -0
- package/lib/save/base/ImportPrinter.d.ts +10 -0
- package/lib/save/base/ImportPrinter.d.ts.map +1 -0
- package/lib/save/base/ImportPrinter.js +92 -0
- package/lib/save/{source/SourceUtils.d.ts → base/PrinterUtils.d.ts} +2 -2
- package/lib/save/{source/SourceUtils.d.ts.map → base/PrinterUtils.d.ts.map} +1 -1
- package/lib/save/{source/SourceUtils.js → base/PrinterUtils.js} +10 -10
- package/lib/save/source/SourceBase.d.ts +2 -11
- package/lib/save/source/SourceBase.d.ts.map +1 -1
- package/lib/save/source/SourceBase.js +3 -25
- package/lib/save/source/SourceBody.js +3 -3
- package/lib/save/source/SourceClass.d.ts +2 -1
- package/lib/save/source/SourceClass.d.ts.map +1 -1
- package/lib/save/source/SourceClass.js +18 -17
- package/lib/save/source/SourceFilePrinter.d.ts +1 -1
- package/lib/save/source/SourceFilePrinter.d.ts.map +1 -1
- package/lib/save/source/SourceFilePrinter.js +9 -10
- package/lib/save/source/SourceMethod.d.ts +1 -1
- package/lib/save/source/SourceMethod.d.ts.map +1 -1
- package/lib/save/source/SourceMethod.js +37 -22
- package/lib/save/source/SourceNamespace.d.ts.map +1 -1
- package/lib/save/source/SourceNamespace.js +6 -6
- 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 +29 -42
- package/lib/save/source/SourceTransformer.d.ts +5 -1
- package/lib/save/source/SourceTransformer.d.ts.map +1 -1
- package/lib/save/source/SourceTransformer.js +107 -33
- package/lib/utils/SparseBitVector.d.ts +11 -2
- package/lib/utils/SparseBitVector.d.ts.map +1 -1
- package/lib/utils/SparseBitVector.js +70 -3
- package/package.json +1 -1
- package/lib/core/common/BodyBuilder.d.ts.map +0 -1
- package/lib/core/common/CfgBuilder.d.ts.map +0 -1
- package/lib/core/common/CfgBuilder.js +0 -1886
- package/lib/save/source/SourceModule.d.ts +0 -16
- package/lib/save/source/SourceModule.d.ts.map +0 -1
- package/lib/save/source/SourceModule.js +0 -125
|
@@ -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
|
|
@@ -47,7 +47,7 @@ const Type_1 = require("../../core/base/Type");
|
|
|
47
47
|
const logger_1 = __importStar(require("../../utils/logger"));
|
|
48
48
|
const SourceBody_1 = require("./SourceBody");
|
|
49
49
|
const SourceTransformer_1 = require("./SourceTransformer");
|
|
50
|
-
const
|
|
50
|
+
const PrinterUtils_1 = require("../base/PrinterUtils");
|
|
51
51
|
const ValueUtil_1 = require("../../core/common/ValueUtil");
|
|
52
52
|
const ArkClass_1 = require("../../core/model/ArkClass");
|
|
53
53
|
const ArkBaseModel_1 = require("../../core/model/ArkBaseModel");
|
|
@@ -108,7 +108,7 @@ class SourceStmt {
|
|
|
108
108
|
if (!(value instanceof Local_1.Local)) {
|
|
109
109
|
return false;
|
|
110
110
|
}
|
|
111
|
-
return
|
|
111
|
+
return PrinterUtils_1.PrinterUtils.isTemp(value.getName());
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
exports.SourceStmt = SourceStmt;
|
|
@@ -144,11 +144,11 @@ class SourceAssignStmt extends SourceStmt {
|
|
|
144
144
|
else if (this.leftOp instanceof Local_1.Local && this.rightOp instanceof Expr_1.ArkNewArrayExpr) {
|
|
145
145
|
this.transferRightNewArrayExpr();
|
|
146
146
|
}
|
|
147
|
-
else if (this.rightOp instanceof Expr_1.ArkStaticInvokeExpr &&
|
|
147
|
+
else if (this.rightOp instanceof Expr_1.ArkStaticInvokeExpr && PrinterUtils_1.PrinterUtils.isComponentCreate(this.rightOp)) {
|
|
148
148
|
this.transferRightComponentCreate();
|
|
149
149
|
}
|
|
150
150
|
else if (this.rightOp instanceof Expr_1.ArkInstanceInvokeExpr &&
|
|
151
|
-
|
|
151
|
+
PrinterUtils_1.PrinterUtils.isComponentAttributeInvoke(this.rightOp)) {
|
|
152
152
|
this.transferRightComponentAttribute();
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
@@ -168,7 +168,7 @@ class SourceAssignStmt extends SourceStmt {
|
|
|
168
168
|
let leftOpType = this.leftOp.getType();
|
|
169
169
|
if (leftOpType instanceof Type_1.ClassType) {
|
|
170
170
|
let name = leftOpType.getClassSignature().getClassName();
|
|
171
|
-
if (
|
|
171
|
+
if (PrinterUtils_1.PrinterUtils.isAnonymousClass(name)) {
|
|
172
172
|
this.leftTypeCode = 'any';
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
@@ -189,7 +189,7 @@ class SourceAssignStmt extends SourceStmt {
|
|
|
189
189
|
if (this.context.hasTempVisit(this.leftCode)) {
|
|
190
190
|
this.setText('');
|
|
191
191
|
}
|
|
192
|
-
else if (
|
|
192
|
+
else if (PrinterUtils_1.PrinterUtils.isTemp(this.leftCode)) {
|
|
193
193
|
this.setText(`${this.rightCode};`);
|
|
194
194
|
}
|
|
195
195
|
else {
|
|
@@ -234,7 +234,7 @@ class SourceAssignStmt extends SourceStmt {
|
|
|
234
234
|
if (!cls) {
|
|
235
235
|
return undefined;
|
|
236
236
|
}
|
|
237
|
-
return
|
|
237
|
+
return PrinterUtils_1.PrinterUtils.getOriginType(cls);
|
|
238
238
|
}
|
|
239
239
|
/**
|
|
240
240
|
* temp1 = new Person
|
|
@@ -253,7 +253,7 @@ class SourceAssignStmt extends SourceStmt {
|
|
|
253
253
|
instanceInvokeExpr.getArgs().forEach((v) => {
|
|
254
254
|
args.push(this.transformer.valueToString(v));
|
|
255
255
|
});
|
|
256
|
-
if (originType ===
|
|
256
|
+
if (originType === PrinterUtils_1.CLASS_CATEGORY_COMPONENT) {
|
|
257
257
|
this.rightCode = `${this.transformer.typeToString(this.rightOp.getType())}(${args.join(', ')})`;
|
|
258
258
|
}
|
|
259
259
|
else if (originType === ArkClass_1.ClassCategory.TYPE_LITERAL || originType === ArkClass_1.ClassCategory.OBJECT) {
|
|
@@ -269,7 +269,7 @@ class SourceAssignStmt extends SourceStmt {
|
|
|
269
269
|
this.context.getStmtReader().rollback();
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
if (originType ===
|
|
272
|
+
if (originType === PrinterUtils_1.CLASS_CATEGORY_COMPONENT) {
|
|
273
273
|
this.rightCode = `${this.transformer.typeToString(this.rightOp.getType())}()`;
|
|
274
274
|
}
|
|
275
275
|
else if (originType === ArkClass_1.ClassCategory.TYPE_LITERAL || originType === ArkClass_1.ClassCategory.OBJECT) {
|
|
@@ -313,7 +313,7 @@ class SourceAssignStmt extends SourceStmt {
|
|
|
313
313
|
let stmt = this.context.getStmtReader().next();
|
|
314
314
|
if (stmt instanceof Stmt_1.ArkInvokeStmt) {
|
|
315
315
|
let expr = stmt.getInvokeExpr();
|
|
316
|
-
if (expr instanceof Expr_1.ArkStaticInvokeExpr &&
|
|
316
|
+
if (expr instanceof Expr_1.ArkStaticInvokeExpr && PrinterUtils_1.PrinterUtils.isComponentPop(expr)) {
|
|
317
317
|
this.setText(`${this.rightCode}`);
|
|
318
318
|
this.dumpType = AssignStmtDumpType.NORMAL;
|
|
319
319
|
return;
|
|
@@ -340,18 +340,18 @@ class SourceInvokeStmt extends SourceStmt {
|
|
|
340
340
|
let code = '';
|
|
341
341
|
let isAttr = false;
|
|
342
342
|
if (invokeExpr instanceof Expr_1.ArkStaticInvokeExpr) {
|
|
343
|
-
if (
|
|
343
|
+
if (PrinterUtils_1.PrinterUtils.isComponentPop(invokeExpr)) {
|
|
344
344
|
code = '}';
|
|
345
345
|
isAttr = true;
|
|
346
346
|
}
|
|
347
347
|
else {
|
|
348
348
|
code = this.transformer.staticInvokeExprToString(invokeExpr);
|
|
349
|
-
isAttr =
|
|
349
|
+
isAttr = PrinterUtils_1.PrinterUtils.isComponentIfElseInvoke(invokeExpr);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
else if (invokeExpr instanceof Expr_1.ArkInstanceInvokeExpr) {
|
|
353
353
|
code = this.transformer.instanceInvokeExprToString(invokeExpr);
|
|
354
|
-
isAttr =
|
|
354
|
+
isAttr = PrinterUtils_1.PrinterUtils.isComponentAttributeInvoke(invokeExpr);
|
|
355
355
|
}
|
|
356
356
|
if (code.length > 0 && !isAttr) {
|
|
357
357
|
this.setText(`${code};`);
|
|
@@ -362,15 +362,15 @@ class SourceInvokeStmt extends SourceStmt {
|
|
|
362
362
|
}
|
|
363
363
|
beforeDump() {
|
|
364
364
|
let invokeExpr = this.original.getInvokeExpr();
|
|
365
|
-
if ((invokeExpr instanceof Expr_1.ArkStaticInvokeExpr &&
|
|
366
|
-
(invokeExpr instanceof Expr_1.ArkStaticInvokeExpr &&
|
|
365
|
+
if ((invokeExpr instanceof Expr_1.ArkStaticInvokeExpr && PrinterUtils_1.PrinterUtils.isComponentPop(invokeExpr)) ||
|
|
366
|
+
(invokeExpr instanceof Expr_1.ArkStaticInvokeExpr && PrinterUtils_1.PrinterUtils.isComponentIfElseInvoke(invokeExpr))) {
|
|
367
367
|
this.printer.decIndent();
|
|
368
368
|
return;
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
afterDump() {
|
|
372
372
|
let invokeExpr = this.original.getInvokeExpr();
|
|
373
|
-
if (invokeExpr instanceof Expr_1.ArkStaticInvokeExpr &&
|
|
373
|
+
if (invokeExpr instanceof Expr_1.ArkStaticInvokeExpr && PrinterUtils_1.PrinterUtils.isComponentIfElseInvoke(invokeExpr)) {
|
|
374
374
|
this.printer.incIndent();
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
@@ -531,12 +531,12 @@ class SourceWhileStmt extends SourceStmt {
|
|
|
531
531
|
if (!(stmt instanceof Stmt_1.ArkAssignStmt)) {
|
|
532
532
|
continue;
|
|
533
533
|
}
|
|
534
|
-
if (
|
|
534
|
+
if (PrinterUtils_1.PrinterUtils.isDeIncrementStmt(stmt, Expr_1.NormalBinaryOperator.Addition) &&
|
|
535
535
|
stmt.getLeftOp().getName() === value.getName()) {
|
|
536
536
|
this.context.setSkipStmt(stmt);
|
|
537
537
|
return `${value.getName()}++`;
|
|
538
538
|
}
|
|
539
|
-
if (
|
|
539
|
+
if (PrinterUtils_1.PrinterUtils.isDeIncrementStmt(stmt, Expr_1.NormalBinaryOperator.Subtraction) &&
|
|
540
540
|
stmt.getLeftOp().getName() === value.getName()) {
|
|
541
541
|
this.context.setSkipStmt(stmt);
|
|
542
542
|
return `${value.getName()}--`;
|
|
@@ -694,33 +694,20 @@ class SourceTypeAliasStmt extends SourceStmt {
|
|
|
694
694
|
this.aliasType = aliasType;
|
|
695
695
|
}
|
|
696
696
|
transfer2ts() {
|
|
697
|
-
let modifier = '';
|
|
698
697
|
let modifiersArray = (0, ArkBaseModel_1.modifiers2stringArray)(this.aliasType.getModifiers());
|
|
699
|
-
|
|
700
|
-
modifier = `${modifiersArray.join(' ')} `;
|
|
701
|
-
}
|
|
698
|
+
let modifier = modifiersArray.length > 0 ? `${modifiersArray.join(' ')} ` : '';
|
|
702
699
|
const expr = this.original.getAliasTypeExpr();
|
|
703
|
-
let typeOf = '';
|
|
704
|
-
|
|
705
|
-
|
|
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
|
-
}
|
|
700
|
+
let typeOf = expr.getTransferWithTypeOf() ? 'typeof ' : '';
|
|
701
|
+
let realGenericTypes = expr.getRealGenericTypes() ? `<${expr.getRealGenericTypes().join(', ')}>` : '';
|
|
702
|
+
let genericTypes = this.aliasType.getGenericTypes() ? `<${this.transformer.typeArrayToString(this.aliasType.getGenericTypes())}>` : '';
|
|
721
703
|
let typeObject = expr.getOriginalObject();
|
|
722
704
|
if (typeObject instanceof Type_1.Type) {
|
|
723
|
-
|
|
705
|
+
if (typeObject instanceof Type_1.AliasType) {
|
|
706
|
+
this.setText(`${modifier}type ${this.aliasType.getName()}${genericTypes} = ${typeOf}${typeObject.getName()}${realGenericTypes};`);
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
this.setText(`${modifier}type ${this.aliasType.getName()}${genericTypes} = ${typeOf}${this.transformer.typeToString(typeObject)}${realGenericTypes};`);
|
|
710
|
+
}
|
|
724
711
|
return;
|
|
725
712
|
}
|
|
726
713
|
if (typeObject instanceof ArkImport_1.ImportInfo) {
|
|
@@ -35,8 +35,12 @@ export declare class SourceTransformer {
|
|
|
35
35
|
literalObjectToString(type: ClassType): string;
|
|
36
36
|
typeToString(type: Type): string;
|
|
37
37
|
private literalType2string;
|
|
38
|
-
private
|
|
38
|
+
private multipleType2string;
|
|
39
39
|
private arrayType2string;
|
|
40
|
+
private tupleType2string;
|
|
41
|
+
private aliasType2string;
|
|
42
|
+
private keyofTypeExpr2string;
|
|
43
|
+
private typeQueryExpr2string;
|
|
40
44
|
private unclearReferenceType2string;
|
|
41
45
|
private classType2string;
|
|
42
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceTransformer.d.ts","sourceRoot":"","sources":["../../../src/save/source/SourceTransformer.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAMH,qBAAqB,EAKrB,mBAAmB,EAKtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAiB,MAAM,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5
|
* you may not use this file except in compliance with the License.
|
|
6
6
|
* You may obtain a copy of the License at
|
|
@@ -42,8 +42,9 @@ const Constant_1 = require("../../core/base/Constant");
|
|
|
42
42
|
const Expr_1 = require("../../core/base/Expr");
|
|
43
43
|
const Local_1 = require("../../core/base/Local");
|
|
44
44
|
const ArkClass_1 = require("../../core/model/ArkClass");
|
|
45
|
+
const ArkMethod_1 = require("../../core/model/ArkMethod");
|
|
45
46
|
const logger_1 = __importStar(require("../../utils/logger"));
|
|
46
|
-
const
|
|
47
|
+
const PrinterUtils_1 = require("../base/PrinterUtils");
|
|
47
48
|
const SourceMethod_1 = require("./SourceMethod");
|
|
48
49
|
const Type_1 = require("../../core/base/Type");
|
|
49
50
|
const SourceClass_1 = require("./SourceClass");
|
|
@@ -51,6 +52,12 @@ const Ref_1 = require("../../core/base/Ref");
|
|
|
51
52
|
const EtsConst_1 = require("../../core/common/EtsConst");
|
|
52
53
|
const Const_1 = require("../../core/common/Const");
|
|
53
54
|
const Stmt_1 = require("../../core/base/Stmt");
|
|
55
|
+
const ArkNamespace_1 = require("../../core/model/ArkNamespace");
|
|
56
|
+
const TypeExpr_1 = require("../../core/base/TypeExpr");
|
|
57
|
+
const ArkBaseModel_1 = require("../../core/model/ArkBaseModel");
|
|
58
|
+
const ArkField_1 = require("../../core/model/ArkField");
|
|
59
|
+
const ArkExport_1 = require("../../core/model/ArkExport");
|
|
60
|
+
const ArkImport_1 = require("../../core/model/ArkImport");
|
|
54
61
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'SourceTransformer');
|
|
55
62
|
class SourceTransformer {
|
|
56
63
|
constructor(context) {
|
|
@@ -75,7 +82,7 @@ class SourceTransformer {
|
|
|
75
82
|
args.push(this.valueToString(v));
|
|
76
83
|
});
|
|
77
84
|
let genericCode = this.genericTypesToString(invokeExpr.getRealGenericTypes());
|
|
78
|
-
if (
|
|
85
|
+
if (PrinterUtils_1.PrinterUtils.isComponentAttributeInvoke(invokeExpr) && this.context.isInBuilderMethod()) {
|
|
79
86
|
return `.${methodName}${genericCode}(${args.join(', ')})`;
|
|
80
87
|
}
|
|
81
88
|
return `${this.valueToString(invokeExpr.getBase())}.${methodName}${genericCode}(${args.join(', ')})`;
|
|
@@ -83,11 +90,11 @@ class SourceTransformer {
|
|
|
83
90
|
staticInvokeExprToString(invokeExpr) {
|
|
84
91
|
let methodSignature = invokeExpr.getMethodSignature();
|
|
85
92
|
let method = this.context.getMethod(methodSignature);
|
|
86
|
-
if (method &&
|
|
93
|
+
if (method && PrinterUtils_1.PrinterUtils.isAnonymousMethod(method.getName())) {
|
|
87
94
|
return this.anonymousMethodToString(method, this.context.getPrinter().getIndent());
|
|
88
95
|
}
|
|
89
96
|
let classSignature = methodSignature.getDeclaringClassSignature();
|
|
90
|
-
let className =
|
|
97
|
+
let className = PrinterUtils_1.PrinterUtils.getStaticInvokeClassFullName(classSignature, this.context.getDeclaringArkNamespace());
|
|
91
98
|
let methodName = methodSignature.getMethodSubSignature().getMethodName();
|
|
92
99
|
let args = [];
|
|
93
100
|
invokeExpr.getArgs().forEach((v) => {
|
|
@@ -107,13 +114,13 @@ class SourceTransformer {
|
|
|
107
114
|
return '';
|
|
108
115
|
}
|
|
109
116
|
}
|
|
110
|
-
if (
|
|
117
|
+
if (PrinterUtils_1.PrinterUtils.isComponentCreate(invokeExpr)) {
|
|
111
118
|
if (className === EtsConst_1.COMPONENT_IF) {
|
|
112
119
|
return `if (${args.join(', ')})`;
|
|
113
120
|
}
|
|
114
121
|
return `${className}${genericCode}(${args.join(', ')})`;
|
|
115
122
|
}
|
|
116
|
-
if (
|
|
123
|
+
if (PrinterUtils_1.PrinterUtils.isComponentIfBranchInvoke(invokeExpr)) {
|
|
117
124
|
let arg0 = invokeExpr.getArg(0);
|
|
118
125
|
if (arg0.getValue() === '0') {
|
|
119
126
|
return ``;
|
|
@@ -122,7 +129,7 @@ class SourceTransformer {
|
|
|
122
129
|
return '} else {';
|
|
123
130
|
}
|
|
124
131
|
}
|
|
125
|
-
if (
|
|
132
|
+
if (PrinterUtils_1.PrinterUtils.isComponentPop(invokeExpr)) {
|
|
126
133
|
return '}';
|
|
127
134
|
}
|
|
128
135
|
}
|
|
@@ -150,7 +157,7 @@ class SourceTransformer {
|
|
|
150
157
|
}
|
|
151
158
|
static constToString(value) {
|
|
152
159
|
if (value.getType().toString() === 'string') {
|
|
153
|
-
return `'${
|
|
160
|
+
return `'${PrinterUtils_1.PrinterUtils.escape(value.getValue())}'`;
|
|
154
161
|
}
|
|
155
162
|
else {
|
|
156
163
|
return value.getValue();
|
|
@@ -212,7 +219,7 @@ class SourceTransformer {
|
|
|
212
219
|
let index = value.getIndex();
|
|
213
220
|
if (index instanceof Constant_1.Constant &&
|
|
214
221
|
index.getType() instanceof Type_1.StringType &&
|
|
215
|
-
|
|
222
|
+
PrinterUtils_1.PrinterUtils.isTemp(index.getValue())) {
|
|
216
223
|
return `${this.valueToString(value.getBase())}[${this.valueToString(new Local_1.Local(index.getValue()))}]`;
|
|
217
224
|
}
|
|
218
225
|
return `${this.valueToString(value.getBase())}[${this.valueToString(value.getIndex())}]`;
|
|
@@ -235,14 +242,14 @@ class SourceTransformer {
|
|
|
235
242
|
return SourceTransformer.constToString(value);
|
|
236
243
|
}
|
|
237
244
|
if (value instanceof Local_1.Local) {
|
|
238
|
-
if (
|
|
245
|
+
if (PrinterUtils_1.PrinterUtils.isAnonymousMethod(value.getName())) {
|
|
239
246
|
let methodSignature = value.getType().getMethodSignature();
|
|
240
247
|
let anonymousMethod = this.context.getMethod(methodSignature);
|
|
241
248
|
if (anonymousMethod) {
|
|
242
249
|
return this.anonymousMethodToString(anonymousMethod, this.context.getPrinter().getIndent());
|
|
243
250
|
}
|
|
244
251
|
}
|
|
245
|
-
if (
|
|
252
|
+
if (PrinterUtils_1.PrinterUtils.isAnonymousClass(value.getName())) {
|
|
246
253
|
let clsSignature = value.getType().getClassSignature();
|
|
247
254
|
let cls = this.context.getClass(clsSignature);
|
|
248
255
|
if (cls) {
|
|
@@ -252,7 +259,7 @@ class SourceTransformer {
|
|
|
252
259
|
if (operator === Expr_1.NormalBinaryOperator.Division ||
|
|
253
260
|
operator === Expr_1.NormalBinaryOperator.Multiplication ||
|
|
254
261
|
operator === Expr_1.NormalBinaryOperator.Remainder) {
|
|
255
|
-
if (
|
|
262
|
+
if (PrinterUtils_1.PrinterUtils.isTemp(value.getName())) {
|
|
256
263
|
let stmt = value.getDeclaringStmt();
|
|
257
264
|
if (stmt instanceof Stmt_1.ArkAssignStmt && stmt.getRightOp() instanceof Expr_1.ArkNormalBinopExpr) {
|
|
258
265
|
return `(${this.context.transTemp2Code(value)})`;
|
|
@@ -266,7 +273,7 @@ class SourceTransformer {
|
|
|
266
273
|
}
|
|
267
274
|
literalObjectToString(type) {
|
|
268
275
|
let name = type.getClassSignature().getClassName();
|
|
269
|
-
if (
|
|
276
|
+
if (PrinterUtils_1.PrinterUtils.isAnonymousClass(name)) {
|
|
270
277
|
let cls = this.context.getClass(type.getClassSignature());
|
|
271
278
|
if (cls) {
|
|
272
279
|
return this.anonymousClassToString(cls, this.context.getPrinter().getIndent());
|
|
@@ -278,11 +285,11 @@ class SourceTransformer {
|
|
|
278
285
|
if (type instanceof Type_1.LiteralType) {
|
|
279
286
|
return this.literalType2string(type);
|
|
280
287
|
}
|
|
281
|
-
if (type instanceof Type_1.PrimitiveType) {
|
|
288
|
+
if (type instanceof Type_1.PrimitiveType || type instanceof Type_1.GenericType) {
|
|
282
289
|
return type.getName();
|
|
283
290
|
}
|
|
284
|
-
if (type instanceof Type_1.UnionType) {
|
|
285
|
-
return this.
|
|
291
|
+
if (type instanceof Type_1.UnionType || type instanceof Type_1.IntersectionType) {
|
|
292
|
+
return this.multipleType2string(type);
|
|
286
293
|
}
|
|
287
294
|
if (type instanceof Type_1.UnknownType) {
|
|
288
295
|
return 'any';
|
|
@@ -296,21 +303,27 @@ class SourceTransformer {
|
|
|
296
303
|
if (type instanceof Type_1.ArrayType) {
|
|
297
304
|
return this.arrayType2string(type);
|
|
298
305
|
}
|
|
306
|
+
if (type instanceof Type_1.TupleType) {
|
|
307
|
+
return this.tupleType2string(type);
|
|
308
|
+
}
|
|
299
309
|
if (type instanceof Type_1.FunctionType) {
|
|
300
310
|
let methodSignature = type.getMethodSignature();
|
|
301
311
|
let method = this.context.getMethod(methodSignature);
|
|
302
|
-
if (method &&
|
|
312
|
+
if (method && PrinterUtils_1.PrinterUtils.isAnonymousMethod(method.getName())) {
|
|
303
313
|
return new SourceMethod_1.SourceMethod(method).toArrowFunctionTypeString();
|
|
304
314
|
}
|
|
305
315
|
}
|
|
306
316
|
if (type instanceof Type_1.UnclearReferenceType) {
|
|
307
317
|
return this.unclearReferenceType2string(type);
|
|
308
318
|
}
|
|
309
|
-
if (type instanceof Type_1.GenericType) {
|
|
310
|
-
return type.getName();
|
|
311
|
-
}
|
|
312
319
|
if (type instanceof Type_1.AliasType) {
|
|
313
|
-
return
|
|
320
|
+
return this.aliasType2string(type);
|
|
321
|
+
}
|
|
322
|
+
if (type instanceof TypeExpr_1.KeyofTypeExpr) {
|
|
323
|
+
return this.keyofTypeExpr2string(type);
|
|
324
|
+
}
|
|
325
|
+
if (type instanceof TypeExpr_1.TypeQueryExpr) {
|
|
326
|
+
return this.typeQueryExpr2string(type);
|
|
314
327
|
}
|
|
315
328
|
if (!type) {
|
|
316
329
|
return 'any';
|
|
@@ -325,37 +338,98 @@ class SourceTransformer {
|
|
|
325
338
|
}
|
|
326
339
|
return `${literalName}`;
|
|
327
340
|
}
|
|
328
|
-
|
|
341
|
+
multipleType2string(type) {
|
|
329
342
|
let typesStr = [];
|
|
330
343
|
for (const member of type.getTypes()) {
|
|
331
|
-
|
|
344
|
+
if (member instanceof Type_1.UnionType || member instanceof Type_1.IntersectionType) {
|
|
345
|
+
typesStr.push(`(${this.typeToString(member)})`);
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
typesStr.push(this.typeToString(member));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (type instanceof Type_1.UnionType) {
|
|
352
|
+
return typesStr.join(' | ');
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
return typesStr.join(' & ');
|
|
332
356
|
}
|
|
333
|
-
return typesStr.join(' | ');
|
|
334
357
|
}
|
|
335
358
|
arrayType2string(type) {
|
|
359
|
+
const readonly = type.getReadonlyFlag() ? 'readonly ' : '';
|
|
336
360
|
const dimensions = [];
|
|
337
361
|
for (let i = 0; i < type.getDimension(); i++) {
|
|
338
362
|
dimensions.push('[]');
|
|
339
363
|
}
|
|
340
364
|
let baseType = type.getBaseType();
|
|
341
|
-
if (baseType instanceof Type_1.UnionType) {
|
|
342
|
-
return
|
|
365
|
+
if (baseType instanceof Type_1.UnionType || baseType instanceof Type_1.IntersectionType || baseType instanceof TypeExpr_1.AbstractTypeExpr) {
|
|
366
|
+
return `${readonly}(${this.typeToString(baseType)})${dimensions.join('')}`;
|
|
367
|
+
}
|
|
368
|
+
return `${readonly}${this.typeToString(baseType)}${dimensions.join('')}`;
|
|
369
|
+
}
|
|
370
|
+
tupleType2string(type) {
|
|
371
|
+
const readonly = type.getReadonlyFlag() ? 'readonly ' : '';
|
|
372
|
+
let typesStr = [];
|
|
373
|
+
for (const member of type.getTypes()) {
|
|
374
|
+
typesStr.push(this.typeToString(member));
|
|
375
|
+
}
|
|
376
|
+
return `${readonly}[${typesStr.join(', ')}]`;
|
|
377
|
+
}
|
|
378
|
+
aliasType2string(type) {
|
|
379
|
+
var _a;
|
|
380
|
+
let typesStr = [];
|
|
381
|
+
let genericTypes = (_a = type.getRealGenericTypes()) !== null && _a !== void 0 ? _a : type.getGenericTypes();
|
|
382
|
+
if (genericTypes) {
|
|
383
|
+
for (const gType of genericTypes) {
|
|
384
|
+
typesStr.push(this.typeToString(gType));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (typesStr.length > 0) {
|
|
388
|
+
return `${type.getName()}<${typesStr.join(', ')}>`;
|
|
389
|
+
}
|
|
390
|
+
return type.getName();
|
|
391
|
+
}
|
|
392
|
+
keyofTypeExpr2string(type) {
|
|
393
|
+
if (type.getOpType() instanceof Type_1.UnionType || type.getOpType() instanceof Type_1.IntersectionType) {
|
|
394
|
+
return `keyof (${this.typeToString(type.getOpType())})`;
|
|
395
|
+
}
|
|
396
|
+
return `keyof ${this.typeToString(type.getOpType())}`;
|
|
397
|
+
}
|
|
398
|
+
typeQueryExpr2string(type) {
|
|
399
|
+
const gTypes = type.getGenerateTypes();
|
|
400
|
+
const genericStr = this.genericTypesToString(gTypes);
|
|
401
|
+
const opValue = type.getOpValue();
|
|
402
|
+
if (opValue instanceof ArkBaseModel_1.ArkBaseModel) {
|
|
403
|
+
if (opValue instanceof ArkClass_1.ArkClass || opValue instanceof ArkMethod_1.ArkMethod || opValue instanceof ArkNamespace_1.ArkNamespace || opValue instanceof ArkField_1.ArkField) {
|
|
404
|
+
return `typeof ${opValue.getName()}${genericStr}`;
|
|
405
|
+
}
|
|
406
|
+
else if (opValue instanceof ArkExport_1.ExportInfo) {
|
|
407
|
+
return `typeof ${opValue.getExportClauseName()}${genericStr}`;
|
|
408
|
+
}
|
|
409
|
+
else if (opValue instanceof ArkImport_1.ImportInfo) {
|
|
410
|
+
return `typeof ${opValue.getImportClauseName()}${genericStr}`;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
return `typeof *invalid*`;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
return `typeof ${this.valueToString(opValue)}${genericStr}`;
|
|
343
418
|
}
|
|
344
|
-
return `${this.typeToString(baseType)}${dimensions.join('')}`;
|
|
345
419
|
}
|
|
346
420
|
unclearReferenceType2string(type) {
|
|
347
421
|
let genericTypes = type.getGenericTypes();
|
|
348
422
|
if (genericTypes.length > 0) {
|
|
349
|
-
return `${type.getName()}<${genericTypes.join(', ')}>`;
|
|
423
|
+
return `${type.getName()}<${genericTypes.map((value) => this.typeToString(value)).join(', ')}>`;
|
|
350
424
|
}
|
|
351
425
|
return type.getName();
|
|
352
426
|
}
|
|
353
427
|
classType2string(type) {
|
|
354
|
-
const name =
|
|
355
|
-
if (
|
|
428
|
+
const name = PrinterUtils_1.PrinterUtils.getStaticInvokeClassFullName(type.getClassSignature());
|
|
429
|
+
if (PrinterUtils_1.PrinterUtils.isDefaultClass(name)) {
|
|
356
430
|
return 'any';
|
|
357
431
|
}
|
|
358
|
-
if (
|
|
432
|
+
if (PrinterUtils_1.PrinterUtils.isAnonymousClass(name)) {
|
|
359
433
|
let cls = this.context.getClass(type.getClassSignature());
|
|
360
434
|
if (cls && cls.getCategory() === ArkClass_1.ClassCategory.TYPE_LITERAL) {
|
|
361
435
|
return this.anonymousClassToString(cls, this.context.getPrinter().getIndent());
|
|
@@ -364,7 +438,7 @@ class SourceTransformer {
|
|
|
364
438
|
}
|
|
365
439
|
let genericTypes = type.getRealGenericTypes();
|
|
366
440
|
if (genericTypes && genericTypes.length > 0) {
|
|
367
|
-
return `${name}
|
|
441
|
+
return `${name}${this.genericTypesToString(genericTypes)}`;
|
|
368
442
|
}
|
|
369
443
|
return name;
|
|
370
444
|
}
|
|
@@ -38,9 +38,12 @@ declare class SparseBitVectorElement {
|
|
|
38
38
|
private bits;
|
|
39
39
|
constructor(elementSize?: number);
|
|
40
40
|
word(idx: number): number;
|
|
41
|
+
clone(): Word;
|
|
41
42
|
get elementSize(): number;
|
|
43
|
+
get bitWordNum(): number;
|
|
42
44
|
isEmpty(): boolean;
|
|
43
45
|
set(bitIdx: number): void;
|
|
46
|
+
setWord(word: Word): void;
|
|
44
47
|
reset(bitIdx: number): void;
|
|
45
48
|
test(bitIdx: number): boolean;
|
|
46
49
|
test_and_set(bitIdx: number): boolean;
|
|
@@ -50,6 +53,7 @@ declare class SparseBitVectorElement {
|
|
|
50
53
|
equals(rhs: SparseBitVectorElement): boolean;
|
|
51
54
|
unionWith(other: SparseBitVectorElement): boolean;
|
|
52
55
|
intersectWith(other: SparseBitVectorElement): boolean;
|
|
56
|
+
subtractWith(rhs: SparseBitVectorElement): boolean;
|
|
53
57
|
countBitsV2(word: number): number;
|
|
54
58
|
countBits(word: number): number;
|
|
55
59
|
isZero(): boolean;
|
|
@@ -65,10 +69,12 @@ export declare class SparseBitVector {
|
|
|
65
69
|
test(bitIdx: number): boolean;
|
|
66
70
|
testAndSet(bitIdx: number): boolean;
|
|
67
71
|
reset(bitIdx: number): void;
|
|
72
|
+
clear(): void;
|
|
73
|
+
clone(): SparseBitVector;
|
|
68
74
|
findFirst(): number;
|
|
69
75
|
count(): number;
|
|
70
76
|
isEmpty(): boolean;
|
|
71
|
-
[Symbol.iterator]():
|
|
77
|
+
[Symbol.iterator](): IterableIterator<number>;
|
|
72
78
|
/**
|
|
73
79
|
* Check if this SparseBitVector is equal to another SparseBitVector.
|
|
74
80
|
*/
|
|
@@ -84,8 +90,11 @@ export declare class SparseBitVector {
|
|
|
84
90
|
*/
|
|
85
91
|
intersectWith(rhs: SparseBitVector): boolean;
|
|
86
92
|
/**
|
|
87
|
-
*
|
|
93
|
+
* Subtract another SparseBitVector from this one.
|
|
94
|
+
* This operation modifies the current SparseBitVector in place.
|
|
95
|
+
* Return True if the current SparseBitVector was modified, false otherwise.
|
|
88
96
|
*/
|
|
97
|
+
subtractWith(rhs: SparseBitVector): boolean;
|
|
89
98
|
toString(): string;
|
|
90
99
|
}
|
|
91
100
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparseBitVector.d.ts","sourceRoot":"","sources":["../../src/utils/SparseBitVector.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,MAAM,IAAI,GAAG,WAAW,CAAC;AAE/B,cAAM,sBAAsB;IACxB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,IAAI,CAAO;gBAEP,WAAW,GAAE,MAAY;IAMrC,IAAI,CAAC,GA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