arkanalyzer 1.0.5
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/LICENSE +201 -0
- package/README.en.md +88 -0
- package/README.md +98 -0
- package/docs/HowToCreatePR.md +55 -0
- package/docs/HowToHandleIssues.md +155 -0
- package/docs/quickstart.pdf +0 -0
- package/lib/Config.d.ts +26 -0
- package/lib/Config.d.ts.map +1 -0
- package/lib/Config.js +128 -0
- package/lib/Scene.d.ts +125 -0
- package/lib/Scene.d.ts.map +1 -0
- package/lib/Scene.js +762 -0
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts +28 -0
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts.map +1 -0
- package/lib/callgraph/algorithm/AbstractAnalysis.js +137 -0
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts +11 -0
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts.map +1 -0
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.js +71 -0
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts +16 -0
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -0
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +147 -0
- package/lib/callgraph/common/Statistics.d.ts +58 -0
- package/lib/callgraph/common/Statistics.d.ts.map +1 -0
- package/lib/callgraph/common/Statistics.js +203 -0
- package/lib/callgraph/model/BaseGraph.d.ts +62 -0
- package/lib/callgraph/model/BaseGraph.d.ts.map +1 -0
- package/lib/callgraph/model/BaseGraph.js +158 -0
- package/lib/callgraph/model/CallGraph.d.ts +94 -0
- package/lib/callgraph/model/CallGraph.d.ts.map +1 -0
- package/lib/callgraph/model/CallGraph.js +339 -0
- package/lib/callgraph/model/builder/CallGraphBuilder.d.ts +16 -0
- package/lib/callgraph/model/builder/CallGraphBuilder.d.ts.map +1 -0
- package/lib/callgraph/model/builder/CallGraphBuilder.js +106 -0
- package/lib/callgraph/pointerAnalysis/Context.d.ts +38 -0
- package/lib/callgraph/pointerAnalysis/Context.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/Context.js +156 -0
- package/lib/callgraph/pointerAnalysis/DummyCallCreator.d.ts +23 -0
- package/lib/callgraph/pointerAnalysis/DummyCallCreator.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/DummyCallCreator.js +104 -0
- package/lib/callgraph/pointerAnalysis/Pag.d.ts +209 -0
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/Pag.js +774 -0
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +88 -0
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +821 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts +64 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +502 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.d.ts +9 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.js +57 -0
- package/lib/callgraph/pointerAnalysis/PtsDS.d.ts +58 -0
- package/lib/callgraph/pointerAnalysis/PtsDS.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/PtsDS.js +234 -0
- package/lib/core/base/Constant.d.ts +17 -0
- package/lib/core/base/Constant.d.ts.map +1 -0
- package/lib/core/base/Constant.js +53 -0
- package/lib/core/base/Decorator.d.ts +15 -0
- package/lib/core/base/Decorator.d.ts.map +1 -0
- package/lib/core/base/Decorator.js +43 -0
- package/lib/core/base/DefUseChain.d.ts +9 -0
- package/lib/core/base/DefUseChain.d.ts.map +1 -0
- package/lib/core/base/DefUseChain.js +25 -0
- package/lib/core/base/Expr.d.ts +219 -0
- package/lib/core/base/Expr.d.ts.map +1 -0
- package/lib/core/base/Expr.js +896 -0
- package/lib/core/base/Local.d.ts +40 -0
- package/lib/core/base/Local.d.ts.map +1 -0
- package/lib/core/base/Local.js +101 -0
- package/lib/core/base/Position.d.ts +39 -0
- package/lib/core/base/Position.d.ts.map +1 -0
- package/lib/core/base/Position.js +86 -0
- package/lib/core/base/Ref.d.ts +75 -0
- package/lib/core/base/Ref.d.ts.map +1 -0
- package/lib/core/base/Ref.js +286 -0
- package/lib/core/base/Stmt.d.ts +109 -0
- package/lib/core/base/Stmt.d.ts.map +1 -0
- package/lib/core/base/Stmt.js +374 -0
- package/lib/core/base/Type.d.ts +220 -0
- package/lib/core/base/Type.d.ts.map +1 -0
- package/lib/core/base/Type.js +477 -0
- package/lib/core/base/Value.d.ts +11 -0
- package/lib/core/base/Value.d.ts.map +1 -0
- package/lib/core/base/Value.js +16 -0
- package/lib/core/common/ArkIRTransformer.d.ts +101 -0
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -0
- package/lib/core/common/ArkIRTransformer.js +1674 -0
- package/lib/core/common/BodyBuilder.d.ts +10 -0
- package/lib/core/common/BodyBuilder.d.ts.map +1 -0
- package/lib/core/common/BodyBuilder.js +34 -0
- package/lib/core/common/Builtin.d.ts +35 -0
- package/lib/core/common/Builtin.d.ts.map +1 -0
- package/lib/core/common/Builtin.js +78 -0
- package/lib/core/common/CfgBuilder.d.ts +136 -0
- package/lib/core/common/CfgBuilder.d.ts.map +1 -0
- package/lib/core/common/CfgBuilder.js +1241 -0
- package/lib/core/common/Const.d.ts +15 -0
- package/lib/core/common/Const.d.ts.map +1 -0
- package/lib/core/common/Const.js +34 -0
- package/lib/core/common/DummyMainCreater.d.ts +48 -0
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -0
- package/lib/core/common/DummyMainCreater.js +433 -0
- package/lib/core/common/EtsConst.d.ts +65 -0
- package/lib/core/common/EtsConst.d.ts.map +1 -0
- package/lib/core/common/EtsConst.js +918 -0
- package/lib/core/common/ExprUseReplacer.d.ts +18 -0
- package/lib/core/common/ExprUseReplacer.d.ts.map +1 -0
- package/lib/core/common/ExprUseReplacer.js +88 -0
- package/lib/core/common/IRUtils.d.ts +7 -0
- package/lib/core/common/IRUtils.d.ts.map +1 -0
- package/lib/core/common/IRUtils.js +39 -0
- package/lib/core/common/ModelUtils.d.ts +61 -0
- package/lib/core/common/ModelUtils.d.ts.map +1 -0
- package/lib/core/common/ModelUtils.js +628 -0
- package/lib/core/common/RefUseReplacer.d.ts +14 -0
- package/lib/core/common/RefUseReplacer.d.ts.map +1 -0
- package/lib/core/common/RefUseReplacer.js +50 -0
- package/lib/core/common/StmtUseReplacer.d.ts +16 -0
- package/lib/core/common/StmtUseReplacer.d.ts.map +1 -0
- package/lib/core/common/StmtUseReplacer.js +88 -0
- package/lib/core/common/TSConst.d.ts +11 -0
- package/lib/core/common/TSConst.d.ts.map +1 -0
- package/lib/core/common/TSConst.js +28 -0
- package/lib/core/common/TypeInference.d.ts +44 -0
- package/lib/core/common/TypeInference.d.ts.map +1 -0
- package/lib/core/common/TypeInference.js +519 -0
- package/lib/core/common/ValueUtil.d.ts +17 -0
- package/lib/core/common/ValueUtil.d.ts.map +1 -0
- package/lib/core/common/ValueUtil.js +71 -0
- package/lib/core/common/VisibleValue.d.ts +37 -0
- package/lib/core/common/VisibleValue.d.ts.map +1 -0
- package/lib/core/common/VisibleValue.js +212 -0
- package/lib/core/dataflow/DataflowProblem.d.ts +21 -0
- package/lib/core/dataflow/DataflowProblem.d.ts.map +1 -0
- package/lib/core/dataflow/DataflowProblem.js +33 -0
- package/lib/core/dataflow/DataflowResult.d.ts +8 -0
- package/lib/core/dataflow/DataflowResult.d.ts.map +1 -0
- package/lib/core/dataflow/DataflowResult.js +26 -0
- package/lib/core/dataflow/DataflowSolver.d.ts +40 -0
- package/lib/core/dataflow/DataflowSolver.d.ts.map +1 -0
- package/lib/core/dataflow/DataflowSolver.js +318 -0
- package/lib/core/dataflow/Edge.d.ts +16 -0
- package/lib/core/dataflow/Edge.d.ts.map +1 -0
- package/lib/core/dataflow/Edge.js +40 -0
- package/lib/core/dataflow/Fact.d.ts +7 -0
- package/lib/core/dataflow/Fact.d.ts.map +1 -0
- package/lib/core/dataflow/Fact.js +24 -0
- package/lib/core/dataflow/TiantAnalysis.d.ts +37 -0
- package/lib/core/dataflow/TiantAnalysis.d.ts.map +1 -0
- package/lib/core/dataflow/TiantAnalysis.js +326 -0
- package/lib/core/dataflow/UndefinedVariable.d.ts +32 -0
- package/lib/core/dataflow/UndefinedVariable.d.ts.map +1 -0
- package/lib/core/dataflow/UndefinedVariable.js +235 -0
- package/lib/core/dataflow/Util.d.ts +8 -0
- package/lib/core/dataflow/Util.d.ts.map +1 -0
- package/lib/core/dataflow/Util.js +137 -0
- package/lib/core/graph/BasicBlock.d.ts +26 -0
- package/lib/core/graph/BasicBlock.d.ts.map +1 -0
- package/lib/core/graph/BasicBlock.js +92 -0
- package/lib/core/graph/Cfg.d.ts +29 -0
- package/lib/core/graph/Cfg.d.ts.map +1 -0
- package/lib/core/graph/Cfg.js +154 -0
- package/lib/core/graph/DominanceFinder.d.ts +16 -0
- package/lib/core/graph/DominanceFinder.d.ts.map +1 -0
- package/lib/core/graph/DominanceFinder.js +121 -0
- package/lib/core/graph/DominanceTree.d.ts +13 -0
- package/lib/core/graph/DominanceTree.d.ts.map +1 -0
- package/lib/core/graph/DominanceTree.js +70 -0
- package/lib/core/graph/ViewTree.d.ts +115 -0
- package/lib/core/graph/ViewTree.d.ts.map +1 -0
- package/lib/core/graph/ViewTree.js +16 -0
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts +204 -0
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -0
- package/lib/core/graph/builder/ViewTreeBuilder.js +1046 -0
- package/lib/core/model/ArkBody.d.ts +22 -0
- package/lib/core/model/ArkBody.d.ts.map +1 -0
- package/lib/core/model/ArkBody.js +63 -0
- package/lib/core/model/ArkClass.d.ts +110 -0
- package/lib/core/model/ArkClass.d.ts.map +1 -0
- package/lib/core/model/ArkClass.js +315 -0
- package/lib/core/model/ArkExport.d.ts +70 -0
- package/lib/core/model/ArkExport.d.ts.map +1 -0
- package/lib/core/model/ArkExport.js +143 -0
- package/lib/core/model/ArkField.d.ts +60 -0
- package/lib/core/model/ArkField.d.ts.map +1 -0
- package/lib/core/model/ArkField.js +157 -0
- package/lib/core/model/ArkFile.d.ts +62 -0
- package/lib/core/model/ArkFile.d.ts.map +1 -0
- package/lib/core/model/ArkFile.js +160 -0
- package/lib/core/model/ArkImport.d.ts +43 -0
- package/lib/core/model/ArkImport.d.ts.map +1 -0
- package/lib/core/model/ArkImport.js +109 -0
- package/lib/core/model/ArkMethod.d.ts +76 -0
- package/lib/core/model/ArkMethod.d.ts.map +1 -0
- package/lib/core/model/ArkMethod.js +235 -0
- package/lib/core/model/ArkNamespace.d.ts +65 -0
- package/lib/core/model/ArkNamespace.d.ts.map +1 -0
- package/lib/core/model/ArkNamespace.js +182 -0
- package/lib/core/model/ArkSignature.d.ts +98 -0
- package/lib/core/model/ArkSignature.d.ts.map +1 -0
- package/lib/core/model/ArkSignature.js +281 -0
- package/lib/core/model/builder/ArkClassBuilder.d.ts +13 -0
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkClassBuilder.js +422 -0
- package/lib/core/model/builder/ArkExportBuilder.d.ts +25 -0
- package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkExportBuilder.js +207 -0
- package/lib/core/model/builder/ArkFieldBuilder.d.ts +9 -0
- package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkFieldBuilder.js +189 -0
- package/lib/core/model/builder/ArkFileBuilder.d.ts +10 -0
- package/lib/core/model/builder/ArkFileBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkFileBuilder.js +164 -0
- package/lib/core/model/builder/ArkImportBuilder.d.ts +4 -0
- package/lib/core/model/builder/ArkImportBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkImportBuilder.js +125 -0
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +60 -0
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkMethodBuilder.js +419 -0
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts +5 -0
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkNamespaceBuilder.js +171 -0
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts +9 -0
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkSignatureBuilder.js +40 -0
- package/lib/core/model/builder/builderUtils.d.ts +18 -0
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -0
- package/lib/core/model/builder/builderUtils.js +449 -0
- package/lib/index.d.ts +77 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +190 -0
- package/lib/save/ArkStream.d.ts +24 -0
- package/lib/save/ArkStream.d.ts.map +1 -0
- package/lib/save/ArkStream.js +83 -0
- package/lib/save/DotPrinter.d.ts +48 -0
- package/lib/save/DotPrinter.d.ts.map +1 -0
- package/lib/save/DotPrinter.js +229 -0
- package/lib/save/GraphPrinter.d.ts +17 -0
- package/lib/save/GraphPrinter.d.ts.map +1 -0
- package/lib/save/GraphPrinter.js +135 -0
- package/lib/save/JsonPrinter.d.ts +28 -0
- package/lib/save/JsonPrinter.d.ts.map +1 -0
- package/lib/save/JsonPrinter.js +511 -0
- package/lib/save/Printer.d.ts +17 -0
- package/lib/save/Printer.d.ts.map +1 -0
- package/lib/save/Printer.js +27 -0
- package/lib/save/PrinterBuilder.d.ts +38 -0
- package/lib/save/PrinterBuilder.d.ts.map +1 -0
- package/lib/save/PrinterBuilder.js +102 -0
- package/lib/save/serializeArkIR.d.ts +3 -0
- package/lib/save/serializeArkIR.d.ts.map +1 -0
- package/lib/save/serializeArkIR.js +166 -0
- package/lib/save/source/SourceBase.d.ts +32 -0
- package/lib/save/source/SourceBase.d.ts.map +1 -0
- package/lib/save/source/SourceBase.js +93 -0
- package/lib/save/source/SourceBody.d.ts +60 -0
- package/lib/save/source/SourceBody.d.ts.map +1 -0
- package/lib/save/source/SourceBody.js +292 -0
- package/lib/save/source/SourceClass.d.ts +27 -0
- package/lib/save/source/SourceClass.d.ts.map +1 -0
- package/lib/save/source/SourceClass.js +202 -0
- package/lib/save/source/SourceField.d.ts +15 -0
- package/lib/save/source/SourceField.d.ts.map +1 -0
- package/lib/save/source/SourceField.js +68 -0
- package/lib/save/source/SourceFilePrinter.d.ts +14 -0
- package/lib/save/source/SourceFilePrinter.d.ts.map +1 -0
- package/lib/save/source/SourceFilePrinter.js +73 -0
- package/lib/save/source/SourceMethod.d.ts +24 -0
- package/lib/save/source/SourceMethod.d.ts.map +1 -0
- package/lib/save/source/SourceMethod.js +170 -0
- package/lib/save/source/SourceModule.d.ts +18 -0
- package/lib/save/source/SourceModule.d.ts.map +1 -0
- package/lib/save/source/SourceModule.js +120 -0
- package/lib/save/source/SourceNamespace.d.ts +13 -0
- package/lib/save/source/SourceNamespace.d.ts.map +1 -0
- package/lib/save/source/SourceNamespace.js +80 -0
- package/lib/save/source/SourceStmt.d.ts +172 -0
- package/lib/save/source/SourceStmt.d.ts.map +1 -0
- package/lib/save/source/SourceStmt.js +757 -0
- package/lib/save/source/SourceTransformer.d.ts +37 -0
- package/lib/save/source/SourceTransformer.d.ts.map +1 -0
- package/lib/save/source/SourceTransformer.js +338 -0
- package/lib/save/source/SourceUtils.d.ts +25 -0
- package/lib/save/source/SourceUtils.d.ts.map +1 -0
- package/lib/save/source/SourceUtils.js +201 -0
- package/lib/transformer/FunctionTransformer.d.ts +3 -0
- package/lib/transformer/FunctionTransformer.d.ts.map +1 -0
- package/lib/transformer/FunctionTransformer.js +17 -0
- package/lib/transformer/SceneTransformer.d.ts +3 -0
- package/lib/transformer/SceneTransformer.d.ts.map +1 -0
- package/lib/transformer/SceneTransformer.js +17 -0
- package/lib/transformer/StaticSingleAssignmentFormer.d.ts +13 -0
- package/lib/transformer/StaticSingleAssignmentFormer.d.ts.map +1 -0
- package/lib/transformer/StaticSingleAssignmentFormer.js +259 -0
- package/lib/transformer/Transformer.d.ts +7 -0
- package/lib/transformer/Transformer.d.ts.map +1 -0
- package/lib/transformer/Transformer.js +22 -0
- package/lib/utils/CfgStructualAnalysis.d.ts +93 -0
- package/lib/utils/CfgStructualAnalysis.d.ts.map +1 -0
- package/lib/utils/CfgStructualAnalysis.js +955 -0
- package/lib/utils/FileUtils.d.ts +18 -0
- package/lib/utils/FileUtils.d.ts.map +1 -0
- package/lib/utils/FileUtils.js +131 -0
- package/lib/utils/callGraphUtils.d.ts +31 -0
- package/lib/utils/callGraphUtils.d.ts.map +1 -0
- package/lib/utils/callGraphUtils.js +208 -0
- package/lib/utils/entryMethodUtils.d.ts +16 -0
- package/lib/utils/entryMethodUtils.d.ts.map +1 -0
- package/lib/utils/entryMethodUtils.js +139 -0
- package/lib/utils/getAllFiles.d.ts +10 -0
- package/lib/utils/getAllFiles.d.ts.map +1 -0
- package/lib/utils/getAllFiles.js +91 -0
- package/lib/utils/json5parser.d.ts +7 -0
- package/lib/utils/json5parser.d.ts.map +1 -0
- package/lib/utils/json5parser.js +146 -0
- package/lib/utils/logger.d.ts +19 -0
- package/lib/utils/logger.d.ts.map +1 -0
- package/lib/utils/logger.js +90 -0
- package/lib/utils/pathTransfer.d.ts +2 -0
- package/lib/utils/pathTransfer.d.ts.map +1 -0
- package/lib/utils/pathTransfer.js +25 -0
- package/package.json +29 -0
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ExportInfo = exports.ExportType = void 0;
|
|
18
|
+
const Position_1 = require("../base/Position");
|
|
19
|
+
const TSConst_1 = require("../common/TSConst");
|
|
20
|
+
var ExportType;
|
|
21
|
+
(function (ExportType) {
|
|
22
|
+
ExportType[ExportType["NAME_SPACE"] = 0] = "NAME_SPACE";
|
|
23
|
+
ExportType[ExportType["CLASS"] = 1] = "CLASS";
|
|
24
|
+
ExportType[ExportType["METHOD"] = 2] = "METHOD";
|
|
25
|
+
ExportType[ExportType["LOCAL"] = 3] = "LOCAL";
|
|
26
|
+
ExportType[ExportType["TYPE"] = 4] = "TYPE";
|
|
27
|
+
ExportType[ExportType["UNKNOWN"] = 9] = "UNKNOWN";
|
|
28
|
+
})(ExportType = exports.ExportType || (exports.ExportType = {}));
|
|
29
|
+
/**
|
|
30
|
+
* @category core/model
|
|
31
|
+
*/
|
|
32
|
+
class ExportInfo {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.modifiers = new Set();
|
|
35
|
+
this.exportClauseName = '';
|
|
36
|
+
this.exportClauseType = ExportType.UNKNOWN;
|
|
37
|
+
}
|
|
38
|
+
getFrom() {
|
|
39
|
+
return this.exportFrom;
|
|
40
|
+
}
|
|
41
|
+
getOriginName() {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = this.nameBeforeAs) !== null && _a !== void 0 ? _a : this.exportClauseName;
|
|
44
|
+
}
|
|
45
|
+
getExportClauseName() {
|
|
46
|
+
return this.exportClauseName;
|
|
47
|
+
}
|
|
48
|
+
setExportClauseType(exportClauseType) {
|
|
49
|
+
this.exportClauseType = exportClauseType;
|
|
50
|
+
}
|
|
51
|
+
getExportClauseType() {
|
|
52
|
+
return this.exportClauseType;
|
|
53
|
+
}
|
|
54
|
+
getNameBeforeAs() {
|
|
55
|
+
return this.nameBeforeAs;
|
|
56
|
+
}
|
|
57
|
+
setArkExport(value) {
|
|
58
|
+
this.arkExport = value;
|
|
59
|
+
}
|
|
60
|
+
getArkExport() {
|
|
61
|
+
return this.arkExport;
|
|
62
|
+
}
|
|
63
|
+
isDefault() {
|
|
64
|
+
var _a;
|
|
65
|
+
if (this.exportFrom) {
|
|
66
|
+
return this.nameBeforeAs === TSConst_1.DEFAULT;
|
|
67
|
+
}
|
|
68
|
+
if (this._default === undefined) {
|
|
69
|
+
this._default = (_a = this.modifiers) === null || _a === void 0 ? void 0 : _a.has('DefaultKeyword');
|
|
70
|
+
}
|
|
71
|
+
return this._default;
|
|
72
|
+
}
|
|
73
|
+
getModifiers() {
|
|
74
|
+
return this.modifiers;
|
|
75
|
+
}
|
|
76
|
+
getOriginTsPosition() {
|
|
77
|
+
var _a;
|
|
78
|
+
return (_a = this.originTsPosition) !== null && _a !== void 0 ? _a : Position_1.LineColPosition.DEFAULT;
|
|
79
|
+
}
|
|
80
|
+
getTsSourceCode() {
|
|
81
|
+
var _a;
|
|
82
|
+
return (_a = this.tsSourceCode) !== null && _a !== void 0 ? _a : '';
|
|
83
|
+
}
|
|
84
|
+
getDeclaringArkFile() {
|
|
85
|
+
return this.declaringArkFile;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.ExportInfo = ExportInfo;
|
|
89
|
+
ExportInfo.Builder = class ArkExportBuilder {
|
|
90
|
+
constructor() {
|
|
91
|
+
this.exportInfo = new ExportInfo();
|
|
92
|
+
}
|
|
93
|
+
exportClauseName(exportClauseName) {
|
|
94
|
+
this.exportInfo.exportClauseName = exportClauseName;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
exportClauseType(exportClauseType) {
|
|
98
|
+
this.exportInfo.setExportClauseType(exportClauseType);
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
nameBeforeAs(nameBeforeAs) {
|
|
102
|
+
this.exportInfo.nameBeforeAs = nameBeforeAs;
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
addModifier(name) {
|
|
106
|
+
if (!this.exportInfo.modifiers) {
|
|
107
|
+
this.exportInfo.modifiers = new Set();
|
|
108
|
+
}
|
|
109
|
+
this.exportInfo.modifiers.add(name);
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
modifiers(modifiers) {
|
|
113
|
+
if (modifiers) {
|
|
114
|
+
modifiers.forEach(m => this.addModifier(m));
|
|
115
|
+
}
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
originTsPosition(originTsPosition) {
|
|
119
|
+
this.exportInfo.originTsPosition = originTsPosition;
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
tsSourceCode(tsSourceCode) {
|
|
123
|
+
this.exportInfo.tsSourceCode = tsSourceCode;
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
declaringArkFile(value) {
|
|
127
|
+
this.exportInfo.declaringArkFile = value;
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
arkExport(value) {
|
|
131
|
+
this.exportInfo.arkExport = value;
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
exportFrom(exportFrom) {
|
|
135
|
+
if (exportFrom !== '') {
|
|
136
|
+
this.exportInfo.exportFrom = exportFrom;
|
|
137
|
+
}
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
build() {
|
|
141
|
+
return this.exportInfo;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Decorator } from '../base/Decorator';
|
|
2
|
+
import { LineColPosition } from '../base/Position';
|
|
3
|
+
import { Stmt } from '../base/Stmt';
|
|
4
|
+
import { ArkClass } from './ArkClass';
|
|
5
|
+
import { FieldSignature } from './ArkSignature';
|
|
6
|
+
import { Type } from '../base/Type';
|
|
7
|
+
export declare enum FieldCategory {
|
|
8
|
+
PROPERTY_DECLARATION = 0,
|
|
9
|
+
PROPERTY_ASSIGNMENT = 1,
|
|
10
|
+
SHORT_HAND_PROPERTY_ASSIGNMENT = 2,
|
|
11
|
+
SPREAD_ASSIGNMENT = 3,
|
|
12
|
+
PROPERTY_SIGNATURE = 4,
|
|
13
|
+
ENUM_MEMBER = 5,
|
|
14
|
+
INDEX_SIGNATURE = 6,
|
|
15
|
+
GET_ACCESSOR = 7
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @category core/model
|
|
19
|
+
*/
|
|
20
|
+
export declare class ArkField {
|
|
21
|
+
private code;
|
|
22
|
+
private category;
|
|
23
|
+
private declaringClass;
|
|
24
|
+
private modifiers;
|
|
25
|
+
private questionToken;
|
|
26
|
+
private exclamationToken;
|
|
27
|
+
private fieldSignature;
|
|
28
|
+
private originPosition?;
|
|
29
|
+
private initializer;
|
|
30
|
+
constructor();
|
|
31
|
+
getDeclaringArkClass(): ArkClass;
|
|
32
|
+
setDeclaringArkClass(declaringClass: ArkClass): void;
|
|
33
|
+
getCode(): string;
|
|
34
|
+
setCode(code: string): void;
|
|
35
|
+
getCategory(): FieldCategory;
|
|
36
|
+
setCategory(category: FieldCategory): void;
|
|
37
|
+
getName(): string;
|
|
38
|
+
getType(): Type;
|
|
39
|
+
getModifiers(): Set<string | Decorator>;
|
|
40
|
+
addModifier(modifier: string | Decorator): void;
|
|
41
|
+
getSignature(): FieldSignature;
|
|
42
|
+
setSignature(fieldSig: FieldSignature): void;
|
|
43
|
+
getInitializer(): Stmt[];
|
|
44
|
+
setInitializer(initializer: Stmt[]): void;
|
|
45
|
+
isStatic(): boolean;
|
|
46
|
+
isProtected(): boolean;
|
|
47
|
+
isPrivate(): boolean;
|
|
48
|
+
isPublic(): boolean;
|
|
49
|
+
isReadonly(): boolean;
|
|
50
|
+
setQuestionToken(questionToken: boolean): void;
|
|
51
|
+
setExclamationToken(exclamationToken: boolean): void;
|
|
52
|
+
getQuestionToken(): boolean;
|
|
53
|
+
getExclamationToken(): boolean;
|
|
54
|
+
setOriginPosition(position: LineColPosition): void;
|
|
55
|
+
getOriginPosition(): LineColPosition;
|
|
56
|
+
getDecorators(): Decorator[];
|
|
57
|
+
getStateDecorators(): Decorator[];
|
|
58
|
+
hasBuilderParamDecorator(): boolean;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ArkField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArkField.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkField.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AASpC,oBAAY,aAAa;IACrB,oBAAoB,IAAI;IACxB,mBAAmB,IAAI;IACvB,8BAA8B,IAAI;IAClC,iBAAiB,IAAI;IACrB,kBAAkB,IAAI;IACtB,WAAW,IAAI;IACf,eAAe,IAAI;IACnB,YAAY,IAAI;CACnB;AAED;;GAEG;AACH,qBAAa,QAAQ;IACjB,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,QAAQ,CAAiB;IAEjC,OAAO,CAAC,cAAc,CAAY;IAElC,OAAO,CAAC,SAAS,CAA0D;IAC3E,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,gBAAgB,CAAkB;IAE1C,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,cAAc,CAAC,CAAkB;IAEzC,OAAO,CAAC,WAAW,CAAc;;IAK1B,oBAAoB;IAIpB,oBAAoB,CAAC,cAAc,EAAE,QAAQ;IAI7C,OAAO;IAIP,OAAO,CAAC,IAAI,EAAE,MAAM;IAIpB,WAAW,IAAI,aAAa;IAI5B,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAI1C,OAAO;IAIP,OAAO,IAAG,IAAI;IAId,YAAY;IAIZ,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAIxC,YAAY,IAAI,cAAc;IAI9B,YAAY,CAAC,QAAQ,EAAE,cAAc;IAIrC,cAAc,IAAI,IAAI,EAAE;IAIxB,cAAc,CAAC,WAAW,EAAE,IAAI,EAAE;IAIlC,QAAQ,IAAI,OAAO;IAOnB,WAAW,IAAI,OAAO;IAOtB,SAAS,IAAI,OAAO;IAOpB,QAAQ,IAAI,OAAO;IAOnB,UAAU,IAAI,OAAO;IAOrB,gBAAgB,CAAC,aAAa,EAAE,OAAO;IAIvC,mBAAmB,CAAC,gBAAgB,EAAE,OAAO;IAI7C,gBAAgB;IAIhB,mBAAmB;IAInB,iBAAiB,CAAC,QAAQ,EAAE,eAAe;IAI3C,iBAAiB,IAAI,eAAe;IAIpC,aAAa,IAAI,SAAS,EAAE;IAM5B,kBAAkB,IAAI,SAAS,EAAE;IAMjC,wBAAwB,IAAI,OAAO;CAM7C"}
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ArkField = exports.FieldCategory = void 0;
|
|
18
|
+
const Decorator_1 = require("../base/Decorator");
|
|
19
|
+
const Position_1 = require("../base/Position");
|
|
20
|
+
const EtsConst_1 = require("../common/EtsConst");
|
|
21
|
+
const COMPONENT_MEMBER_DECORATORS = new Set([
|
|
22
|
+
'State', 'Prop', 'Link', 'StorageProp', 'StorageLink',
|
|
23
|
+
'Provide', 'Consume', 'ObjectLink',
|
|
24
|
+
'LocalStorageLink', 'LocalStorageProp',
|
|
25
|
+
'Local', 'Param', 'Event', 'Provider', 'Consumer'
|
|
26
|
+
]);
|
|
27
|
+
var FieldCategory;
|
|
28
|
+
(function (FieldCategory) {
|
|
29
|
+
FieldCategory[FieldCategory["PROPERTY_DECLARATION"] = 0] = "PROPERTY_DECLARATION";
|
|
30
|
+
FieldCategory[FieldCategory["PROPERTY_ASSIGNMENT"] = 1] = "PROPERTY_ASSIGNMENT";
|
|
31
|
+
FieldCategory[FieldCategory["SHORT_HAND_PROPERTY_ASSIGNMENT"] = 2] = "SHORT_HAND_PROPERTY_ASSIGNMENT";
|
|
32
|
+
FieldCategory[FieldCategory["SPREAD_ASSIGNMENT"] = 3] = "SPREAD_ASSIGNMENT";
|
|
33
|
+
FieldCategory[FieldCategory["PROPERTY_SIGNATURE"] = 4] = "PROPERTY_SIGNATURE";
|
|
34
|
+
FieldCategory[FieldCategory["ENUM_MEMBER"] = 5] = "ENUM_MEMBER";
|
|
35
|
+
FieldCategory[FieldCategory["INDEX_SIGNATURE"] = 6] = "INDEX_SIGNATURE";
|
|
36
|
+
FieldCategory[FieldCategory["GET_ACCESSOR"] = 7] = "GET_ACCESSOR";
|
|
37
|
+
})(FieldCategory = exports.FieldCategory || (exports.FieldCategory = {}));
|
|
38
|
+
/**
|
|
39
|
+
* @category core/model
|
|
40
|
+
*/
|
|
41
|
+
class ArkField {
|
|
42
|
+
constructor() {
|
|
43
|
+
this.code = "";
|
|
44
|
+
this.modifiers = new Set();
|
|
45
|
+
this.questionToken = false;
|
|
46
|
+
this.exclamationToken = false;
|
|
47
|
+
this.initializer = [];
|
|
48
|
+
}
|
|
49
|
+
getDeclaringArkClass() {
|
|
50
|
+
return this.declaringClass;
|
|
51
|
+
}
|
|
52
|
+
setDeclaringArkClass(declaringClass) {
|
|
53
|
+
this.declaringClass = declaringClass;
|
|
54
|
+
}
|
|
55
|
+
getCode() {
|
|
56
|
+
return this.code;
|
|
57
|
+
}
|
|
58
|
+
setCode(code) {
|
|
59
|
+
this.code = code;
|
|
60
|
+
}
|
|
61
|
+
getCategory() {
|
|
62
|
+
return this.category;
|
|
63
|
+
}
|
|
64
|
+
setCategory(category) {
|
|
65
|
+
this.category = category;
|
|
66
|
+
}
|
|
67
|
+
getName() {
|
|
68
|
+
return this.fieldSignature.getFieldName();
|
|
69
|
+
}
|
|
70
|
+
getType() {
|
|
71
|
+
return this.fieldSignature.getType();
|
|
72
|
+
}
|
|
73
|
+
getModifiers() {
|
|
74
|
+
return this.modifiers;
|
|
75
|
+
}
|
|
76
|
+
addModifier(modifier) {
|
|
77
|
+
this.modifiers.add(modifier);
|
|
78
|
+
}
|
|
79
|
+
getSignature() {
|
|
80
|
+
return this.fieldSignature;
|
|
81
|
+
}
|
|
82
|
+
setSignature(fieldSig) {
|
|
83
|
+
this.fieldSignature = fieldSig;
|
|
84
|
+
}
|
|
85
|
+
getInitializer() {
|
|
86
|
+
return this.initializer;
|
|
87
|
+
}
|
|
88
|
+
setInitializer(initializer) {
|
|
89
|
+
this.initializer = initializer;
|
|
90
|
+
}
|
|
91
|
+
isStatic() {
|
|
92
|
+
if (this.modifiers.has("StaticKeyword")) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
isProtected() {
|
|
98
|
+
if (this.modifiers.has("ProtectedKeyword")) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
isPrivate() {
|
|
104
|
+
if (this.modifiers.has("PrivateKeyword")) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
isPublic() {
|
|
110
|
+
if (this.modifiers.has("PublicKeyword")) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
isReadonly() {
|
|
116
|
+
if (this.modifiers.has("ReadonlyKeyword")) {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
setQuestionToken(questionToken) {
|
|
122
|
+
this.questionToken = questionToken;
|
|
123
|
+
}
|
|
124
|
+
setExclamationToken(exclamationToken) {
|
|
125
|
+
this.exclamationToken = exclamationToken;
|
|
126
|
+
}
|
|
127
|
+
getQuestionToken() {
|
|
128
|
+
return this.questionToken;
|
|
129
|
+
}
|
|
130
|
+
getExclamationToken() {
|
|
131
|
+
return this.exclamationToken;
|
|
132
|
+
}
|
|
133
|
+
setOriginPosition(position) {
|
|
134
|
+
this.originPosition = position;
|
|
135
|
+
}
|
|
136
|
+
getOriginPosition() {
|
|
137
|
+
var _a;
|
|
138
|
+
return (_a = this.originPosition) !== null && _a !== void 0 ? _a : Position_1.LineColPosition.DEFAULT;
|
|
139
|
+
}
|
|
140
|
+
getDecorators() {
|
|
141
|
+
return Array.from(this.modifiers).filter((item) => {
|
|
142
|
+
return item instanceof Decorator_1.Decorator;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
getStateDecorators() {
|
|
146
|
+
return Array.from(this.modifiers).filter((item) => {
|
|
147
|
+
return (item instanceof Decorator_1.Decorator) && (COMPONENT_MEMBER_DECORATORS.has(item.getKind()));
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
hasBuilderParamDecorator() {
|
|
151
|
+
let decorators = this.getDecorators();
|
|
152
|
+
return decorators.filter((value) => {
|
|
153
|
+
return value.getKind() == EtsConst_1.BUILDER_PARAM_DECORATOR;
|
|
154
|
+
}).length != 0;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.ArkField = ArkField;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ModuleScene, Scene } from '../../Scene';
|
|
2
|
+
import { ExportInfo } from './ArkExport';
|
|
3
|
+
import { ImportInfo } from './ArkImport';
|
|
4
|
+
import { ArkClass } from './ArkClass';
|
|
5
|
+
import { ArkNamespace } from './ArkNamespace';
|
|
6
|
+
import { ClassSignature, FileSignature, NamespaceSignature } from './ArkSignature';
|
|
7
|
+
export declare const notStmtOrExprKind: string[];
|
|
8
|
+
/**
|
|
9
|
+
* @category core/model
|
|
10
|
+
*/
|
|
11
|
+
export declare class ArkFile {
|
|
12
|
+
private absoluteFilePath;
|
|
13
|
+
private projectDir;
|
|
14
|
+
private code;
|
|
15
|
+
private defaultClass;
|
|
16
|
+
private namespaces;
|
|
17
|
+
private classes;
|
|
18
|
+
private importInfoMap;
|
|
19
|
+
private exportInfoMap;
|
|
20
|
+
private scene;
|
|
21
|
+
private moduleScene?;
|
|
22
|
+
private fileSignature;
|
|
23
|
+
private ohPackageJson5Path;
|
|
24
|
+
private anonymousClassNumber;
|
|
25
|
+
constructor();
|
|
26
|
+
getName(): string;
|
|
27
|
+
setScene(scene: Scene): void;
|
|
28
|
+
getScene(): Scene;
|
|
29
|
+
getModuleScene(): ModuleScene | undefined;
|
|
30
|
+
setModuleScene(moduleScene: ModuleScene): void;
|
|
31
|
+
setProjectDir(projectDir: string): void;
|
|
32
|
+
getProjectDir(): string;
|
|
33
|
+
getFilePath(): string;
|
|
34
|
+
setFilePath(absoluteFilePath: string): void;
|
|
35
|
+
setCode(code: string): void;
|
|
36
|
+
getCode(): string;
|
|
37
|
+
addArkClass(arkClass: ArkClass): void;
|
|
38
|
+
getDefaultClass(): ArkClass;
|
|
39
|
+
setDefaultClass(defaultClass: ArkClass): void;
|
|
40
|
+
getNamespace(namespaceSignature: NamespaceSignature): ArkNamespace | null;
|
|
41
|
+
getNamespaceWithName(namespaceName: string): ArkNamespace | null;
|
|
42
|
+
getNamespaces(): ArkNamespace[];
|
|
43
|
+
getClass(classSignature: ClassSignature): ArkClass | null;
|
|
44
|
+
getClassWithName(Class: string): ArkClass | null;
|
|
45
|
+
getClasses(): ArkClass[];
|
|
46
|
+
addNamespace(namespace: ArkNamespace): void;
|
|
47
|
+
getImportInfos(): ImportInfo[];
|
|
48
|
+
getImportInfoBy(name: string): ImportInfo | undefined;
|
|
49
|
+
addImportInfo(importInfo: ImportInfo): void;
|
|
50
|
+
getExportInfos(): ExportInfo[];
|
|
51
|
+
getExportInfoBy(name: string): ExportInfo | undefined;
|
|
52
|
+
addExportInfo(exportInfo: ExportInfo, key?: string): void;
|
|
53
|
+
getProjectName(): string;
|
|
54
|
+
getModuleName(): string | undefined;
|
|
55
|
+
setOhPackageJson5Path(ohPackageJson5Path: string[]): void;
|
|
56
|
+
getOhPackageJson5Path(): string[];
|
|
57
|
+
getFileSignature(): FileSignature;
|
|
58
|
+
setFileSignature(fileSignature: FileSignature): void;
|
|
59
|
+
getAllNamespacesUnderThisFile(): ArkNamespace[];
|
|
60
|
+
getAnonymousClassNumber(): number;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=ArkFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArkFile.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkFile.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGnF,eAAO,MAAM,iBAAiB,UAEqD,CAAC;AAEpF;;GAEG;AACH,qBAAa,OAAO;IAChB,OAAO,CAAC,gBAAgB,CAAc;IACtC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,IAAI,CAAc;IAE1B,OAAO,CAAC,YAAY,CAAY;IAGhC,OAAO,CAAC,UAAU,CAA8D;IAChF,OAAO,CAAC,OAAO,CAAsD;IAErE,OAAO,CAAC,aAAa,CAA0D;IAC/E,OAAO,CAAC,aAAa,CAA0D;IAE/E,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,WAAW,CAAC,CAAc;IAElC,OAAO,CAAC,aAAa,CAAwC;IAE7D,OAAO,CAAC,kBAAkB,CAAgB;IAE1C,OAAO,CAAC,oBAAoB,CAAa;;IAKlC,OAAO;IAIP,QAAQ,CAAC,KAAK,EAAE,KAAK;IAIrB,QAAQ;IAIR,cAAc;IAId,cAAc,CAAC,WAAW,EAAE,WAAW;IAIvC,aAAa,CAAC,UAAU,EAAE,MAAM;IAIhC,aAAa,IAAI,MAAM;IAIvB,WAAW,IAAI,MAAM;IAIrB,WAAW,CAAC,gBAAgB,EAAE,MAAM;IAIpC,OAAO,CAAC,IAAI,EAAE,MAAM;IAIpB,OAAO;IAIP,WAAW,CAAC,QAAQ,EAAE,QAAQ;IAI9B,eAAe;IAIf,eAAe,CAAC,YAAY,EAAE,QAAQ;IAItC,YAAY,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,YAAY,GAAG,IAAI;IAKzE,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAIhE,aAAa,IAAI,YAAY,EAAE;IAI/B,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,QAAQ,GAAG,IAAI;IAKzD,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAIhD,UAAU,IAAI,QAAQ,EAAE;IAIxB,YAAY,CAAC,SAAS,EAAE,YAAY;IAIpC,cAAc,IAAI,UAAU,EAAE;IAI9B,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIrD,aAAa,CAAC,UAAU,EAAE,UAAU;IAIpC,cAAc,IAAI,UAAU,EAAE;IAU9B,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIrD,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM;IAIlD,cAAc;IAId,aAAa;IAIb,qBAAqB,CAAC,kBAAkB,EAAE,MAAM,EAAE;IAIlD,qBAAqB;IAIrB,gBAAgB;IAIhB,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAIpD,6BAA6B,IAAI,YAAY,EAAE;IAS/C,uBAAuB;CAGjC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ArkFile = exports.notStmtOrExprKind = void 0;
|
|
18
|
+
const ArkSignature_1 = require("./ArkSignature");
|
|
19
|
+
const TSConst_1 = require("../common/TSConst");
|
|
20
|
+
exports.notStmtOrExprKind = ['ModuleDeclaration', 'ClassDeclaration', 'InterfaceDeclaration', 'EnumDeclaration', 'ExportDeclaration',
|
|
21
|
+
'ExportAssignment', 'MethodDeclaration', 'Constructor', 'FunctionDeclaration', 'GetAccessor', 'SetAccessor', 'ArrowFunction',
|
|
22
|
+
'FunctionExpression', 'MethodSignature', 'ConstructSignature', 'CallSignature'];
|
|
23
|
+
/**
|
|
24
|
+
* @category core/model
|
|
25
|
+
*/
|
|
26
|
+
class ArkFile {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.absoluteFilePath = '';
|
|
29
|
+
this.projectDir = '';
|
|
30
|
+
this.code = '';
|
|
31
|
+
// name to model
|
|
32
|
+
this.namespaces = new Map(); // don't contain nested namespaces
|
|
33
|
+
this.classes = new Map(); // don't contain class in namespace
|
|
34
|
+
this.importInfoMap = new Map();
|
|
35
|
+
this.exportInfoMap = new Map();
|
|
36
|
+
this.fileSignature = ArkSignature_1.FileSignature.DEFAULT;
|
|
37
|
+
this.ohPackageJson5Path = [];
|
|
38
|
+
this.anonymousClassNumber = 0;
|
|
39
|
+
}
|
|
40
|
+
getName() {
|
|
41
|
+
return this.fileSignature.getFileName();
|
|
42
|
+
}
|
|
43
|
+
setScene(scene) {
|
|
44
|
+
this.scene = scene;
|
|
45
|
+
}
|
|
46
|
+
getScene() {
|
|
47
|
+
return this.scene;
|
|
48
|
+
}
|
|
49
|
+
getModuleScene() {
|
|
50
|
+
return this.moduleScene;
|
|
51
|
+
}
|
|
52
|
+
setModuleScene(moduleScene) {
|
|
53
|
+
this.moduleScene = moduleScene;
|
|
54
|
+
}
|
|
55
|
+
setProjectDir(projectDir) {
|
|
56
|
+
this.projectDir = projectDir;
|
|
57
|
+
}
|
|
58
|
+
getProjectDir() {
|
|
59
|
+
return this.projectDir;
|
|
60
|
+
}
|
|
61
|
+
getFilePath() {
|
|
62
|
+
return this.absoluteFilePath;
|
|
63
|
+
}
|
|
64
|
+
setFilePath(absoluteFilePath) {
|
|
65
|
+
this.absoluteFilePath = absoluteFilePath;
|
|
66
|
+
}
|
|
67
|
+
setCode(code) {
|
|
68
|
+
this.code = code;
|
|
69
|
+
}
|
|
70
|
+
getCode() {
|
|
71
|
+
return this.code;
|
|
72
|
+
}
|
|
73
|
+
addArkClass(arkClass) {
|
|
74
|
+
this.classes.set(arkClass.getName(), arkClass);
|
|
75
|
+
}
|
|
76
|
+
getDefaultClass() {
|
|
77
|
+
return this.defaultClass;
|
|
78
|
+
}
|
|
79
|
+
setDefaultClass(defaultClass) {
|
|
80
|
+
this.defaultClass = defaultClass;
|
|
81
|
+
}
|
|
82
|
+
getNamespace(namespaceSignature) {
|
|
83
|
+
const namespaceName = namespaceSignature.getNamespaceName();
|
|
84
|
+
return this.getNamespaceWithName(namespaceName);
|
|
85
|
+
}
|
|
86
|
+
getNamespaceWithName(namespaceName) {
|
|
87
|
+
return this.namespaces.get(namespaceName) || null;
|
|
88
|
+
}
|
|
89
|
+
getNamespaces() {
|
|
90
|
+
return Array.from(this.namespaces.values());
|
|
91
|
+
}
|
|
92
|
+
getClass(classSignature) {
|
|
93
|
+
const className = classSignature.getClassName();
|
|
94
|
+
return this.getClassWithName(className);
|
|
95
|
+
}
|
|
96
|
+
getClassWithName(Class) {
|
|
97
|
+
return this.classes.get(Class) || null;
|
|
98
|
+
}
|
|
99
|
+
getClasses() {
|
|
100
|
+
return Array.from(this.classes.values());
|
|
101
|
+
}
|
|
102
|
+
addNamespace(namespace) {
|
|
103
|
+
this.namespaces.set(namespace.getName(), namespace);
|
|
104
|
+
}
|
|
105
|
+
getImportInfos() {
|
|
106
|
+
return Array.from(this.importInfoMap.values());
|
|
107
|
+
}
|
|
108
|
+
getImportInfoBy(name) {
|
|
109
|
+
return this.importInfoMap.get(name);
|
|
110
|
+
}
|
|
111
|
+
addImportInfo(importInfo) {
|
|
112
|
+
this.importInfoMap.set(importInfo.getImportClauseName(), importInfo);
|
|
113
|
+
}
|
|
114
|
+
getExportInfos() {
|
|
115
|
+
const exportInfos = [];
|
|
116
|
+
this.exportInfoMap.forEach((value, key) => {
|
|
117
|
+
if (key !== TSConst_1.ALL || value.getFrom()) {
|
|
118
|
+
exportInfos.push(value);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return exportInfos;
|
|
122
|
+
}
|
|
123
|
+
getExportInfoBy(name) {
|
|
124
|
+
return this.exportInfoMap.get(name);
|
|
125
|
+
}
|
|
126
|
+
addExportInfo(exportInfo, key) {
|
|
127
|
+
this.exportInfoMap.set(key !== null && key !== void 0 ? key : exportInfo.getExportClauseName(), exportInfo);
|
|
128
|
+
}
|
|
129
|
+
getProjectName() {
|
|
130
|
+
return this.fileSignature.getProjectName();
|
|
131
|
+
}
|
|
132
|
+
getModuleName() {
|
|
133
|
+
var _a;
|
|
134
|
+
return (_a = this.moduleScene) === null || _a === void 0 ? void 0 : _a.getModuleName();
|
|
135
|
+
}
|
|
136
|
+
setOhPackageJson5Path(ohPackageJson5Path) {
|
|
137
|
+
this.ohPackageJson5Path = ohPackageJson5Path;
|
|
138
|
+
}
|
|
139
|
+
getOhPackageJson5Path() {
|
|
140
|
+
return this.ohPackageJson5Path;
|
|
141
|
+
}
|
|
142
|
+
getFileSignature() {
|
|
143
|
+
return this.fileSignature;
|
|
144
|
+
}
|
|
145
|
+
setFileSignature(fileSignature) {
|
|
146
|
+
this.fileSignature = fileSignature;
|
|
147
|
+
}
|
|
148
|
+
getAllNamespacesUnderThisFile() {
|
|
149
|
+
let namespaces = [];
|
|
150
|
+
namespaces.push(...this.namespaces.values());
|
|
151
|
+
this.namespaces.forEach((ns) => {
|
|
152
|
+
namespaces.push(...ns.getAllNamespacesUnderThisNamespace());
|
|
153
|
+
});
|
|
154
|
+
return namespaces;
|
|
155
|
+
}
|
|
156
|
+
getAnonymousClassNumber() {
|
|
157
|
+
return this.anonymousClassNumber++;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.ArkFile = ArkFile;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ArkFile } from './ArkFile';
|
|
2
|
+
import { LineColPosition } from '../base/Position';
|
|
3
|
+
import { Decorator } from '../base/Decorator';
|
|
4
|
+
import { ExportInfo, FromInfo } from './ArkExport';
|
|
5
|
+
/**
|
|
6
|
+
* @category core/model
|
|
7
|
+
*/
|
|
8
|
+
export declare class ImportInfo implements FromInfo {
|
|
9
|
+
private importClauseName;
|
|
10
|
+
private importType;
|
|
11
|
+
private importFrom?;
|
|
12
|
+
private nameBeforeAs?;
|
|
13
|
+
private modifiers;
|
|
14
|
+
private declaringArkFile;
|
|
15
|
+
private originTsPosition?;
|
|
16
|
+
private tsSourceCode?;
|
|
17
|
+
private lazyExportInfo?;
|
|
18
|
+
constructor();
|
|
19
|
+
build(importClauseName: string, importType: string, importFrom: string, originTsPosition: LineColPosition, modifiers: Set<string | Decorator>, nameBeforeAs?: string): void;
|
|
20
|
+
getOriginName(): string;
|
|
21
|
+
/**
|
|
22
|
+
* 获取实际的引用(调用时生成)
|
|
23
|
+
*/
|
|
24
|
+
getLazyExportInfo(): ExportInfo | null;
|
|
25
|
+
setDeclaringArkFile(declaringArkFile: ArkFile): void;
|
|
26
|
+
getDeclaringArkFile(): ArkFile;
|
|
27
|
+
getImportClauseName(): string;
|
|
28
|
+
setImportClauseName(importClauseName: string): void;
|
|
29
|
+
getImportType(): string;
|
|
30
|
+
setImportType(importType: string): void;
|
|
31
|
+
setImportFrom(importFrom: string): void;
|
|
32
|
+
getNameBeforeAs(): string | undefined;
|
|
33
|
+
setNameBeforeAs(nameBeforeAs: string | undefined): void;
|
|
34
|
+
getModifiers(): Set<string | Decorator>;
|
|
35
|
+
addModifier(name: string | Decorator): void;
|
|
36
|
+
setOriginTsPosition(originTsPosition: LineColPosition): void;
|
|
37
|
+
getOriginTsPosition(): LineColPosition;
|
|
38
|
+
setTsSourceCode(tsSourceCode: string): void;
|
|
39
|
+
getTsSourceCode(): string;
|
|
40
|
+
getFrom(): string | undefined;
|
|
41
|
+
isDefault(): boolean;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ArkImport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArkImport.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkImport.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGnD;;GAEG;AACH,qBAAa,UAAW,YAAW,QAAQ;IACvC,OAAO,CAAC,gBAAgB,CAAc;IACtC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,SAAS,CAA0D;IAE3E,OAAO,CAAC,gBAAgB,CAAW;IAEnC,OAAO,CAAC,gBAAgB,CAAC,CAAkB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,cAAc,CAAC,CAAoB;;IAKpC,KAAK,CAAC,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,eAAe,EACnG,SAAS,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM;IAW/D,aAAa,IAAI,MAAM;IAI9B;;OAEG;IACI,iBAAiB,IAAI,UAAU,GAAG,IAAI;IAOtC,mBAAmB,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI;IAIpD,mBAAmB,IAAI,OAAO;IAI9B,mBAAmB,IAAI,MAAM;IAI7B,mBAAmB,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI;IAInD,aAAa,IAAI,MAAM;IAIvB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIvC,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIvC,eAAe,IAAI,MAAM,GAAG,SAAS;IAIrC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS;IAIhD,YAAY,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC;IAIvC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAI3C,mBAAmB,CAAC,gBAAgB,EAAE,eAAe,GAAG,IAAI;IAI5D,mBAAmB,IAAI,eAAe;IAItC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAI3C,eAAe,IAAI,MAAM;IAIzB,OAAO,IAAI,MAAM,GAAG,SAAS;IAI7B,SAAS,IAAI,OAAO;CAM9B"}
|