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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArkBaseModel.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkBaseModel.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAgB,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAqB9E,oBAAY,YAAY;IACpB,OAAO,IAAI;IACX,SAAS,IAAS;IAClB,MAAM,IAAS;IACf,MAAM,IAAS;IACf,MAAM,KAAS;IACf,QAAQ,KAAS;IACjB,KAAK,KAAS;IACd,KAAK,MAAS;IACd,QAAQ,MAAS;IACjB,OAAO,MAAS;IAChB,EAAE,OAAU;IACZ,QAAQ,OAAU;IAClB,GAAG,OAAU;IACb,QAAQ,OAAU;IAClB,OAAO,QAAU;CACpB;AAED,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAsCzC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,GAAG,YAAY,CAEnE;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CASjE;AAED,8BAAsB,YAAY;IAC9B,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC;IAE1B,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS;IAI/D,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI;IAOhE,YAAY,IAAI,MAAM;IAOtB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAMrC,WAAW,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI;IAIlD,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAO5C,QAAQ,IAAI,OAAO;IAInB,WAAW,IAAI,OAAO;IAItB,SAAS,IAAI,OAAO;IAIpB,QAAQ,IAAI,OAAO;IAInB,UAAU,IAAI,OAAO;IAIrB,UAAU,IAAI,OAAO;IAIrB,QAAQ,IAAI,OAAO;IAI1B,gDAAgD;IACzC,UAAU,IAAI,OAAO;IAIrB,SAAS,IAAI,OAAO;IAIpB,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO;IAQrD,aAAa,IAAI,SAAS,EAAE;IAO5B,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI;IAM/C,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAOxC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQnC,mBAAmB,IAAI,OAAO;IAI9B,kBAAkB,IAAI,SAAS,EAAE;IASjC,wBAAwB,IAAI,OAAO;IAInC,iBAAiB,IAAI,OAAO;IAI5B,qBAAqB,IAAI,OAAO;IAIhC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO;IAYxD,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ;aAepC,QAAQ,IAAI,QAAQ;CACvC"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
40
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.ArkBaseModel = exports.modifiers2stringArray = exports.modifierKind2Enum = exports.MODIFIER_TYPE_MASK = exports.ModifierType = void 0;
|
|
44
|
+
const ohos_typescript_1 = __importDefault(require("ohos-typescript"));
|
|
45
|
+
const EtsConst_1 = require("../common/EtsConst");
|
|
46
|
+
const ArkError_1 = require("../common/ArkError");
|
|
47
|
+
const logger_1 = __importStar(require("../../utils/logger"));
|
|
48
|
+
const ArkMetadata_1 = require("./ArkMetadata");
|
|
49
|
+
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkBaseModel');
|
|
50
|
+
const COMPONENT_MEMBER_DECORATORS = new Set([
|
|
51
|
+
'State',
|
|
52
|
+
'Prop',
|
|
53
|
+
'Link',
|
|
54
|
+
'StorageProp',
|
|
55
|
+
'StorageLink',
|
|
56
|
+
'Provide',
|
|
57
|
+
'Consume',
|
|
58
|
+
'ObjectLink',
|
|
59
|
+
'LocalStorageLink',
|
|
60
|
+
'LocalStorageProp',
|
|
61
|
+
'Local',
|
|
62
|
+
'Param',
|
|
63
|
+
'Event',
|
|
64
|
+
'Provider',
|
|
65
|
+
'Consumer',
|
|
66
|
+
]);
|
|
67
|
+
var ModifierType;
|
|
68
|
+
(function (ModifierType) {
|
|
69
|
+
ModifierType[ModifierType["PRIVATE"] = 1] = "PRIVATE";
|
|
70
|
+
ModifierType[ModifierType["PROTECTED"] = 2] = "PROTECTED";
|
|
71
|
+
ModifierType[ModifierType["PUBLIC"] = 4] = "PUBLIC";
|
|
72
|
+
ModifierType[ModifierType["EXPORT"] = 8] = "EXPORT";
|
|
73
|
+
ModifierType[ModifierType["STATIC"] = 16] = "STATIC";
|
|
74
|
+
ModifierType[ModifierType["ABSTRACT"] = 32] = "ABSTRACT";
|
|
75
|
+
ModifierType[ModifierType["ASYNC"] = 64] = "ASYNC";
|
|
76
|
+
ModifierType[ModifierType["CONST"] = 128] = "CONST";
|
|
77
|
+
ModifierType[ModifierType["ACCESSOR"] = 256] = "ACCESSOR";
|
|
78
|
+
ModifierType[ModifierType["DEFAULT"] = 512] = "DEFAULT";
|
|
79
|
+
ModifierType[ModifierType["IN"] = 1024] = "IN";
|
|
80
|
+
ModifierType[ModifierType["READONLY"] = 2048] = "READONLY";
|
|
81
|
+
ModifierType[ModifierType["OUT"] = 4096] = "OUT";
|
|
82
|
+
ModifierType[ModifierType["OVERRIDE"] = 8192] = "OVERRIDE";
|
|
83
|
+
ModifierType[ModifierType["DECLARE"] = 16384] = "DECLARE";
|
|
84
|
+
})(ModifierType = exports.ModifierType || (exports.ModifierType = {}));
|
|
85
|
+
exports.MODIFIER_TYPE_MASK = 0xffff;
|
|
86
|
+
const MODIFIER_TYPE_STRINGS = [
|
|
87
|
+
'private',
|
|
88
|
+
'protected',
|
|
89
|
+
'public',
|
|
90
|
+
'export',
|
|
91
|
+
'static',
|
|
92
|
+
'abstract',
|
|
93
|
+
'async',
|
|
94
|
+
'const',
|
|
95
|
+
'accessor',
|
|
96
|
+
'default',
|
|
97
|
+
'in',
|
|
98
|
+
'readonly',
|
|
99
|
+
'out',
|
|
100
|
+
'override',
|
|
101
|
+
'declare',
|
|
102
|
+
];
|
|
103
|
+
const MODIFIER_KIND_2_ENUM = new Map([
|
|
104
|
+
[ohos_typescript_1.default.SyntaxKind.AbstractKeyword, ModifierType.ABSTRACT],
|
|
105
|
+
[ohos_typescript_1.default.SyntaxKind.AccessorKeyword, ModifierType.ACCESSOR],
|
|
106
|
+
[ohos_typescript_1.default.SyntaxKind.AsyncKeyword, ModifierType.ASYNC],
|
|
107
|
+
[ohos_typescript_1.default.SyntaxKind.ConstKeyword, ModifierType.CONST],
|
|
108
|
+
[ohos_typescript_1.default.SyntaxKind.DeclareKeyword, ModifierType.DECLARE],
|
|
109
|
+
[ohos_typescript_1.default.SyntaxKind.DefaultKeyword, ModifierType.DEFAULT],
|
|
110
|
+
[ohos_typescript_1.default.SyntaxKind.ExportKeyword, ModifierType.EXPORT],
|
|
111
|
+
[ohos_typescript_1.default.SyntaxKind.InKeyword, ModifierType.IN],
|
|
112
|
+
[ohos_typescript_1.default.SyntaxKind.PrivateKeyword, ModifierType.PRIVATE],
|
|
113
|
+
[ohos_typescript_1.default.SyntaxKind.ProtectedKeyword, ModifierType.PROTECTED],
|
|
114
|
+
[ohos_typescript_1.default.SyntaxKind.PublicKeyword, ModifierType.PUBLIC],
|
|
115
|
+
[ohos_typescript_1.default.SyntaxKind.ReadonlyKeyword, ModifierType.READONLY],
|
|
116
|
+
[ohos_typescript_1.default.SyntaxKind.OutKeyword, ModifierType.OUT],
|
|
117
|
+
[ohos_typescript_1.default.SyntaxKind.OverrideKeyword, ModifierType.OVERRIDE],
|
|
118
|
+
[ohos_typescript_1.default.SyntaxKind.StaticKeyword, ModifierType.STATIC],
|
|
119
|
+
]);
|
|
120
|
+
function modifierKind2Enum(kind) {
|
|
121
|
+
return MODIFIER_KIND_2_ENUM.get(kind);
|
|
122
|
+
}
|
|
123
|
+
exports.modifierKind2Enum = modifierKind2Enum;
|
|
124
|
+
function modifiers2stringArray(modifiers) {
|
|
125
|
+
let strs = [];
|
|
126
|
+
for (let idx = 0; idx < MODIFIER_TYPE_STRINGS.length; idx++) {
|
|
127
|
+
if (modifiers & 0x01) {
|
|
128
|
+
strs.push(MODIFIER_TYPE_STRINGS[idx]);
|
|
129
|
+
}
|
|
130
|
+
modifiers = modifiers >>> 1;
|
|
131
|
+
}
|
|
132
|
+
return strs;
|
|
133
|
+
}
|
|
134
|
+
exports.modifiers2stringArray = modifiers2stringArray;
|
|
135
|
+
class ArkBaseModel {
|
|
136
|
+
getMetadata(kind) {
|
|
137
|
+
var _a;
|
|
138
|
+
return (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.getMetadata(kind);
|
|
139
|
+
}
|
|
140
|
+
setMetadata(kind, value) {
|
|
141
|
+
var _a;
|
|
142
|
+
if (!this.metadata) {
|
|
143
|
+
this.metadata = new ArkMetadata_1.ArkMetadata();
|
|
144
|
+
}
|
|
145
|
+
return (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.setMetadata(kind, value);
|
|
146
|
+
}
|
|
147
|
+
getModifiers() {
|
|
148
|
+
if (!this.modifiers) {
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
return this.modifiers;
|
|
152
|
+
}
|
|
153
|
+
setModifiers(modifiers) {
|
|
154
|
+
if (modifiers !== 0) {
|
|
155
|
+
this.modifiers = modifiers;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
addModifier(modifier) {
|
|
159
|
+
this.modifiers = this.getModifiers() | modifier;
|
|
160
|
+
}
|
|
161
|
+
removeModifier(modifier) {
|
|
162
|
+
if (!this.modifiers) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
this.modifiers &= exports.MODIFIER_TYPE_MASK ^ modifier;
|
|
166
|
+
}
|
|
167
|
+
isStatic() {
|
|
168
|
+
return this.containsModifier(ModifierType.STATIC);
|
|
169
|
+
}
|
|
170
|
+
isProtected() {
|
|
171
|
+
return this.containsModifier(ModifierType.PROTECTED);
|
|
172
|
+
}
|
|
173
|
+
isPrivate() {
|
|
174
|
+
return this.containsModifier(ModifierType.PRIVATE);
|
|
175
|
+
}
|
|
176
|
+
isPublic() {
|
|
177
|
+
return this.containsModifier(ModifierType.PUBLIC);
|
|
178
|
+
}
|
|
179
|
+
isReadonly() {
|
|
180
|
+
return this.containsModifier(ModifierType.READONLY);
|
|
181
|
+
}
|
|
182
|
+
isAbstract() {
|
|
183
|
+
return this.containsModifier(ModifierType.ABSTRACT);
|
|
184
|
+
}
|
|
185
|
+
isExport() {
|
|
186
|
+
return this.containsModifier(ModifierType.EXPORT);
|
|
187
|
+
}
|
|
188
|
+
/** @deprecated Use {@link isExport} instead. */
|
|
189
|
+
isExported() {
|
|
190
|
+
return this.isExport();
|
|
191
|
+
}
|
|
192
|
+
isDeclare() {
|
|
193
|
+
return this.containsModifier(ModifierType.DECLARE);
|
|
194
|
+
}
|
|
195
|
+
containsModifier(modifierType) {
|
|
196
|
+
if (!this.modifiers) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
return (this.modifiers & modifierType) === modifierType;
|
|
200
|
+
}
|
|
201
|
+
getDecorators() {
|
|
202
|
+
if (this.decorators) {
|
|
203
|
+
return Array.from(this.decorators);
|
|
204
|
+
}
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
setDecorators(decorators) {
|
|
208
|
+
if (decorators.size > 0) {
|
|
209
|
+
this.decorators = decorators;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
addDecorator(decorator) {
|
|
213
|
+
if (!this.decorators) {
|
|
214
|
+
this.decorators = new Set();
|
|
215
|
+
}
|
|
216
|
+
this.decorators.add(decorator);
|
|
217
|
+
}
|
|
218
|
+
removeDecorator(kind) {
|
|
219
|
+
var _a;
|
|
220
|
+
(_a = this.decorators) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
221
|
+
var _a;
|
|
222
|
+
if (value.getKind() === kind) {
|
|
223
|
+
(_a = this.decorators) === null || _a === void 0 ? void 0 : _a.delete(value);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
hasBuilderDecorator() {
|
|
228
|
+
return this.hasDecorator(EtsConst_1.BUILDER_DECORATOR);
|
|
229
|
+
}
|
|
230
|
+
getStateDecorators() {
|
|
231
|
+
if (!this.decorators) {
|
|
232
|
+
return [];
|
|
233
|
+
}
|
|
234
|
+
return Array.from(this.decorators).filter((item) => {
|
|
235
|
+
return COMPONENT_MEMBER_DECORATORS.has(item.getKind());
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
hasBuilderParamDecorator() {
|
|
239
|
+
return this.hasDecorator(EtsConst_1.BUILDER_PARAM_DECORATOR);
|
|
240
|
+
}
|
|
241
|
+
hasEntryDecorator() {
|
|
242
|
+
return this.hasDecorator(EtsConst_1.ENTRY_DECORATOR);
|
|
243
|
+
}
|
|
244
|
+
hasComponentDecorator() {
|
|
245
|
+
return this.hasDecorator(EtsConst_1.COMPONENT_DECORATOR);
|
|
246
|
+
}
|
|
247
|
+
hasDecorator(kind) {
|
|
248
|
+
let decorators = this.getDecorators();
|
|
249
|
+
return (decorators.filter((value) => {
|
|
250
|
+
if (kind instanceof Set) {
|
|
251
|
+
return kind.has(value.getKind());
|
|
252
|
+
}
|
|
253
|
+
return value.getKind() === kind;
|
|
254
|
+
}).length !== 0);
|
|
255
|
+
}
|
|
256
|
+
validateFields(fields) {
|
|
257
|
+
let errs = [];
|
|
258
|
+
for (const field of fields) {
|
|
259
|
+
let value = Reflect.get(this, field);
|
|
260
|
+
if (!value) {
|
|
261
|
+
errs.push(field);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (errs.length === 0) {
|
|
265
|
+
return { errCode: ArkError_1.ArkErrorCode.OK };
|
|
266
|
+
}
|
|
267
|
+
logger.error(`class fields: ${errs.join(',')} is undefined.`);
|
|
268
|
+
return { errCode: ArkError_1.ArkErrorCode.CLASS_INSTANCE_FIELD_UNDEFINDED, errMsg: `${errs.join(',')} is undefined.` };
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
exports.ArkBaseModel = ArkBaseModel;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import { Local } from '../base/Local';
|
|
2
2
|
import { Cfg } from '../graph/Cfg';
|
|
3
|
-
import { Stmt } from '../base/Stmt';
|
|
4
3
|
import { AliasType, AliasTypeDeclaration } from '../base/Type';
|
|
5
4
|
export declare class ArkBody {
|
|
6
5
|
private locals;
|
|
7
|
-
private originalCfg;
|
|
8
6
|
private cfg;
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
constructor(locals: Set<Local>, originalCfg: Cfg, cfg: Cfg, stmtToOriginalStmt: Map<Stmt, Stmt>, aliasTypeMap: Map<string, [AliasType, AliasTypeDeclaration]>);
|
|
7
|
+
private aliasTypeMap?;
|
|
8
|
+
constructor(locals: Set<Local>, cfg: Cfg, aliasTypeMap?: Map<string, [AliasType, AliasTypeDeclaration]>);
|
|
12
9
|
getLocals(): Map<string, Local>;
|
|
13
10
|
setLocals(locals: Set<Local>): void;
|
|
14
11
|
getCfg(): Cfg;
|
|
15
12
|
setCfg(cfg: Cfg): void;
|
|
16
|
-
|
|
17
|
-
setOriginalCfg(originalCfg: Cfg): void;
|
|
18
|
-
getStmtToOriginalStmt(): Map<Stmt, Stmt>;
|
|
19
|
-
getAliasTypeMap(): Map<string, [AliasType, AliasTypeDeclaration]>;
|
|
13
|
+
getAliasTypeMap(): Map<string, [AliasType, AliasTypeDeclaration]> | undefined;
|
|
20
14
|
getAliasTypeByName(name: string): AliasType | null;
|
|
21
15
|
}
|
|
22
16
|
//# sourceMappingURL=ArkBody.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkBody.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkBody.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ArkBody.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkBody.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE/D,qBAAa,OAAO;IAChB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,YAAY,CAAC,CAAiD;gBAE1D,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAOhG,SAAS,IAAI,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC;IAI/B,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI;IAOnC,MAAM,IAAI,GAAG;IAIb,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;IAItB,eAAe,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC,GAAG,SAAS;IAI7E,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;CAO5D"}
|
|
@@ -16,11 +16,8 @@
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.ArkBody = void 0;
|
|
18
18
|
class ArkBody {
|
|
19
|
-
constructor(locals,
|
|
20
|
-
this.aliasTypeMap = new Map();
|
|
21
|
-
this.originalCfg = originalCfg;
|
|
19
|
+
constructor(locals, cfg, aliasTypeMap) {
|
|
22
20
|
this.cfg = cfg;
|
|
23
|
-
this.stmtToOriginalStmt = stmtToOriginalStmt;
|
|
24
21
|
this.aliasTypeMap = aliasTypeMap;
|
|
25
22
|
this.locals = new Map();
|
|
26
23
|
locals.forEach(local => this.locals.set(local.getName(), local));
|
|
@@ -40,20 +37,12 @@ class ArkBody {
|
|
|
40
37
|
setCfg(cfg) {
|
|
41
38
|
this.cfg = cfg;
|
|
42
39
|
}
|
|
43
|
-
getOriginalCfg() {
|
|
44
|
-
return this.originalCfg;
|
|
45
|
-
}
|
|
46
|
-
setOriginalCfg(originalCfg) {
|
|
47
|
-
this.originalCfg = originalCfg;
|
|
48
|
-
}
|
|
49
|
-
getStmtToOriginalStmt() {
|
|
50
|
-
return this.stmtToOriginalStmt;
|
|
51
|
-
}
|
|
52
40
|
getAliasTypeMap() {
|
|
53
41
|
return this.aliasTypeMap;
|
|
54
42
|
}
|
|
55
43
|
getAliasTypeByName(name) {
|
|
56
|
-
|
|
44
|
+
var _a;
|
|
45
|
+
const aliasTypeInfo = (_a = this.aliasTypeMap) === null || _a === void 0 ? void 0 : _a.get(name);
|
|
57
46
|
if (aliasTypeInfo) {
|
|
58
47
|
return aliasTypeInfo[0];
|
|
59
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GenericType } from '../base/Type';
|
|
1
|
+
import { GenericType, Type } from '../base/Type';
|
|
2
2
|
import { ViewTree } from '../graph/ViewTree';
|
|
3
3
|
import { ArkField } from './ArkField';
|
|
4
4
|
import { ArkFile } from './ArkFile';
|
|
@@ -6,8 +6,9 @@ import { ArkMethod } from './ArkMethod';
|
|
|
6
6
|
import { ArkNamespace } from './ArkNamespace';
|
|
7
7
|
import { ClassSignature, FieldSignature, FileSignature, MethodSignature, NamespaceSignature } from './ArkSignature';
|
|
8
8
|
import { Local } from '../base/Local';
|
|
9
|
-
import { Decorator } from '../base/Decorator';
|
|
10
9
|
import { ArkExport, ExportType } from './ArkExport';
|
|
10
|
+
import { ArkBaseModel } from './ArkBaseModel';
|
|
11
|
+
import { ArkError } from '../common/ArkError';
|
|
11
12
|
export declare enum ClassCategory {
|
|
12
13
|
CLASS = 0,
|
|
13
14
|
STRUCT = 1,
|
|
@@ -19,7 +20,7 @@ export declare enum ClassCategory {
|
|
|
19
20
|
/**
|
|
20
21
|
* @category core/model
|
|
21
22
|
*/
|
|
22
|
-
export declare class ArkClass implements ArkExport {
|
|
23
|
+
export declare class ArkClass extends ArkBaseModel implements ArkExport {
|
|
23
24
|
private category;
|
|
24
25
|
private code?;
|
|
25
26
|
private lineCol;
|
|
@@ -29,8 +30,8 @@ export declare class ArkClass implements ArkExport {
|
|
|
29
30
|
private superClassName;
|
|
30
31
|
private superClass?;
|
|
31
32
|
private implementedInterfaceNames;
|
|
32
|
-
private modifiers;
|
|
33
33
|
private genericsTypes?;
|
|
34
|
+
private realTypes?;
|
|
34
35
|
private defaultMethod;
|
|
35
36
|
private methods;
|
|
36
37
|
private fields;
|
|
@@ -43,26 +44,64 @@ export declare class ArkClass implements ArkExport {
|
|
|
43
44
|
private indexSignatureNumber;
|
|
44
45
|
private viewTree?;
|
|
45
46
|
constructor();
|
|
47
|
+
/**
|
|
48
|
+
* Returns the **string**name of this class.
|
|
49
|
+
* @returns The name of this class.
|
|
50
|
+
*/
|
|
46
51
|
getName(): string;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the codes of class as a **string.**
|
|
54
|
+
* @returns the codes of class.
|
|
55
|
+
*/
|
|
47
56
|
getCode(): string | undefined;
|
|
48
57
|
setCode(code: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the line position of this class.
|
|
60
|
+
* @returns The line position of this class.
|
|
61
|
+
*/
|
|
49
62
|
getLine(): number;
|
|
50
63
|
setLine(line: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the column position of this class.
|
|
66
|
+
* @returns The column position of this class.
|
|
67
|
+
*/
|
|
51
68
|
getColumn(): number;
|
|
52
69
|
setColumn(column: number): void;
|
|
53
70
|
getCategory(): ClassCategory;
|
|
54
71
|
setCategory(category: ClassCategory): void;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the declaring file.
|
|
74
|
+
* @returns A file defined by ArkAnalyzer.
|
|
75
|
+
* @example
|
|
76
|
+
* 1. Get the {@link ArkFile} which the ArkClass is in.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const arkFile = arkClass.getDeclaringArkFile();
|
|
80
|
+
```
|
|
81
|
+
*/
|
|
55
82
|
getDeclaringArkFile(): ArkFile;
|
|
56
83
|
setDeclaringArkFile(declaringArkFile: ArkFile): void;
|
|
84
|
+
/**
|
|
85
|
+
* Returns the declaring namespace of this class, which may also be an **undefined**.
|
|
86
|
+
* @returns The declaring namespace (may be **undefined**) of this class.
|
|
87
|
+
*/
|
|
57
88
|
getDeclaringArkNamespace(): ArkNamespace | undefined;
|
|
58
89
|
setDeclaringArkNamespace(declaringArkNamespace: ArkNamespace | undefined): void;
|
|
59
|
-
isExported(): boolean;
|
|
60
90
|
isDefaultArkClass(): boolean;
|
|
61
91
|
isAnonymousClass(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Returns the signature of current class (i.e., {@link ClassSignature}).
|
|
94
|
+
* The {@link ClassSignature} can uniquely identify a class, according to which we can find the class from the scene.
|
|
95
|
+
* @returns The class signature.
|
|
96
|
+
*/
|
|
62
97
|
getSignature(): ClassSignature;
|
|
63
98
|
setSignature(classSig: ClassSignature): void;
|
|
64
99
|
getSuperClassName(): string;
|
|
65
100
|
setSuperClassName(superClassName: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the superclass of this class.
|
|
103
|
+
* @returns The superclass of this class.
|
|
104
|
+
*/
|
|
66
105
|
getSuperClass(): ArkClass | null;
|
|
67
106
|
setSuperClass(superClass: ArkClass): void;
|
|
68
107
|
getExtendedClasses(): Map<string, ArkClass>;
|
|
@@ -70,18 +109,41 @@ export declare class ArkClass implements ArkExport {
|
|
|
70
109
|
getImplementedInterfaceNames(): string[];
|
|
71
110
|
addImplementedInterfaceName(interfaceName: string): void;
|
|
72
111
|
hasImplementedInterface(interfaceName: string): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Get the field according to its field signature.
|
|
114
|
+
* If no field cound be found, **null**will be returned.
|
|
115
|
+
* @param fieldSignature - the field's signature.
|
|
116
|
+
* @returns A field. If there is no field in this class, the return will be a **null**.
|
|
117
|
+
*/
|
|
73
118
|
getField(fieldSignature: FieldSignature): ArkField | null;
|
|
74
119
|
getFieldWithName(fieldName: string): ArkField | null;
|
|
75
120
|
getStaticFieldWithName(fieldName: string): ArkField | null;
|
|
121
|
+
/**
|
|
122
|
+
* Returns an **array** of fields in the class.
|
|
123
|
+
* @returns an **array** of fields in the class.
|
|
124
|
+
*/
|
|
76
125
|
getFields(): ArkField[];
|
|
77
126
|
addField(field: ArkField): void;
|
|
78
127
|
addFields(fields: ArkField[]): void;
|
|
79
|
-
|
|
80
|
-
addModifier(name: string | Decorator): void;
|
|
128
|
+
getRealTypes(): Type[] | undefined;
|
|
81
129
|
getGenericsTypes(): GenericType[] | undefined;
|
|
82
130
|
addGenericType(gType: GenericType): void;
|
|
83
|
-
|
|
84
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Returns all methods defined in the specific class in the form of an array.
|
|
133
|
+
* @param generated - indicating whether this API returns the methods that are dynamically
|
|
134
|
+
* generated at runtime. If it is not specified as true or false, the return will not include the generated method.
|
|
135
|
+
* @returns An array of all methods in this class.
|
|
136
|
+
* @example
|
|
137
|
+
* 1. Get methods defined in class `BookService`.
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
let classes: ArkClass[] = scene.getClasses();
|
|
141
|
+
let serviceClass : ArkClass = classes[1];
|
|
142
|
+
let methods: ArkMethod[] = serviceClass.getMethods();
|
|
143
|
+
let methodNames: string[] = methods.map(mthd => mthd.name);
|
|
144
|
+
console.log(methodNames);
|
|
145
|
+
```
|
|
146
|
+
*/
|
|
85
147
|
getMethods(generated?: boolean): ArkMethod[];
|
|
86
148
|
getMethod(methodSignature: MethodSignature): ArkMethod | null;
|
|
87
149
|
getMethodWithName(methodName: string): ArkMethod | null;
|
|
@@ -90,14 +152,43 @@ export declare class ArkClass implements ArkExport {
|
|
|
90
152
|
setDefaultArkMethod(defaultMethod: ArkMethod): void;
|
|
91
153
|
getDefaultArkMethod(): ArkMethod | null;
|
|
92
154
|
setViewTree(viewTree: ViewTree): void;
|
|
155
|
+
/**
|
|
156
|
+
* Returns the view tree of the ArkClass.
|
|
157
|
+
* @returns The view tree of the ArkClass.
|
|
158
|
+
* @example
|
|
159
|
+
* 1. get viewTree of ArkClass.
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
for (let arkFiles of scene.getFiles()) {
|
|
163
|
+
for (let arkClasss of arkFiles.getClasses()) {
|
|
164
|
+
if (arkClasss.hasViewTree()) {
|
|
165
|
+
arkClasss.getViewTree();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
*/
|
|
93
171
|
getViewTree(): ViewTree | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Check whether the view tree is defined.
|
|
174
|
+
* If it is defined, the return value is true, otherwise it is false.
|
|
175
|
+
* @returns True if the view tree is defined; false otherwise.
|
|
176
|
+
* @example
|
|
177
|
+
* 1. Judge viewTree of ArkClass.
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
for (let arkFiles of scene.getFiles()) {
|
|
181
|
+
for (let arkClasss of arkFiles.getClasses()) {
|
|
182
|
+
if (arkClasss.hasViewTree()) {
|
|
183
|
+
arkClasss.getViewTree();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
*/
|
|
94
189
|
hasViewTree(): boolean;
|
|
95
190
|
getStaticFields(classMap: Map<FileSignature | NamespaceSignature, ArkClass[]>): ArkField[];
|
|
96
191
|
getGlobalVariable(globalMap: Map<FileSignature | NamespaceSignature, Local[]>): Local[];
|
|
97
|
-
getDecorators(): Decorator[];
|
|
98
|
-
hasEntryDecorator(): boolean;
|
|
99
|
-
hasComponentDecorator(): boolean;
|
|
100
|
-
private hasDecorator;
|
|
101
192
|
getAnonymousMethodNumber(): number;
|
|
102
193
|
getIndexSignatureNumber(): number;
|
|
103
194
|
getExportType(): ExportType;
|
|
@@ -105,5 +196,8 @@ export declare class ArkClass implements ArkExport {
|
|
|
105
196
|
getStaticInitMethod(): ArkMethod;
|
|
106
197
|
setInstanceInitMethod(arkMethod: ArkMethod): void;
|
|
107
198
|
setStaticInitMethod(arkMethod: ArkMethod): void;
|
|
199
|
+
removeField(field: ArkField): boolean;
|
|
200
|
+
removeMethod(method: ArkMethod): boolean;
|
|
201
|
+
validate(): ArkError;
|
|
108
202
|
}
|
|
109
203
|
//# sourceMappingURL=ArkClass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkClass.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkClass.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,WAAW,EAAE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