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,154 @@
|
|
|
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.Cfg = void 0;
|
|
18
|
+
const DefUseChain_1 = require("../base/DefUseChain");
|
|
19
|
+
const Local_1 = require("../base/Local");
|
|
20
|
+
const Stmt_1 = require("../base/Stmt");
|
|
21
|
+
const ArkMethod_1 = require("../model/ArkMethod");
|
|
22
|
+
const Position_1 = require("../base/Position");
|
|
23
|
+
/**
|
|
24
|
+
* @category core/graph
|
|
25
|
+
*/
|
|
26
|
+
class Cfg {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.blocks = new Set();
|
|
29
|
+
this.stmtToBlock = new Map();
|
|
30
|
+
this.startingStmt = new Stmt_1.OriginalStmt('', Position_1.LineColPosition.DEFAULT);
|
|
31
|
+
this.defUseChains = [];
|
|
32
|
+
this.declaringMethod = new ArkMethod_1.ArkMethod();
|
|
33
|
+
}
|
|
34
|
+
getStmts() {
|
|
35
|
+
let stmts = new Array();
|
|
36
|
+
for (const block of this.blocks) {
|
|
37
|
+
stmts.push(...block.getStmts());
|
|
38
|
+
}
|
|
39
|
+
return stmts;
|
|
40
|
+
}
|
|
41
|
+
// TODO
|
|
42
|
+
insertBefore(beforeStmt, newStmt) {
|
|
43
|
+
const block = this.stmtToBlock.get(beforeStmt);
|
|
44
|
+
// Simplify edition just for SSA
|
|
45
|
+
block.addStmtToFirst(newStmt);
|
|
46
|
+
this.stmtToBlock.set(newStmt, block);
|
|
47
|
+
}
|
|
48
|
+
// TODO: 添加block之间的边
|
|
49
|
+
addBlock(block) {
|
|
50
|
+
this.blocks.add(block);
|
|
51
|
+
for (const stmt of block.getStmts()) {
|
|
52
|
+
this.stmtToBlock.set(stmt, block);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
getBlocks() {
|
|
56
|
+
return this.blocks;
|
|
57
|
+
}
|
|
58
|
+
getStartingBlock() {
|
|
59
|
+
return this.stmtToBlock.get(this.startingStmt);
|
|
60
|
+
}
|
|
61
|
+
getStartingStmt() {
|
|
62
|
+
return this.startingStmt;
|
|
63
|
+
}
|
|
64
|
+
setStartingStmt(newStartingStmt) {
|
|
65
|
+
this.startingStmt = newStartingStmt;
|
|
66
|
+
}
|
|
67
|
+
getDeclaringMethod() {
|
|
68
|
+
return this.declaringMethod;
|
|
69
|
+
}
|
|
70
|
+
setDeclaringMethod(method) {
|
|
71
|
+
this.declaringMethod = method;
|
|
72
|
+
}
|
|
73
|
+
getDefUseChains() {
|
|
74
|
+
return this.defUseChains;
|
|
75
|
+
}
|
|
76
|
+
// TODO: 整理成类似jimple的输出
|
|
77
|
+
toString() {
|
|
78
|
+
return 'cfg';
|
|
79
|
+
}
|
|
80
|
+
buildDefUseStmt() {
|
|
81
|
+
for (const block of this.blocks) {
|
|
82
|
+
for (const stmt of block.getStmts()) {
|
|
83
|
+
const defValue = stmt.getDef();
|
|
84
|
+
if (defValue && defValue instanceof Local_1.Local) {
|
|
85
|
+
defValue.setDeclaringStmt(stmt);
|
|
86
|
+
}
|
|
87
|
+
for (const value of stmt.getUses()) {
|
|
88
|
+
if (value instanceof Local_1.Local) {
|
|
89
|
+
const local = value;
|
|
90
|
+
local.addUsedStmt(stmt);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
buildDefUseChain() {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
for (const block of this.blocks) {
|
|
99
|
+
for (let stmtIndex = 0; stmtIndex < block.getStmts().length; stmtIndex++) {
|
|
100
|
+
const stmt = block.getStmts()[stmtIndex];
|
|
101
|
+
for (const value of stmt.getUses()) {
|
|
102
|
+
const name = value.toString();
|
|
103
|
+
const defStmts = [];
|
|
104
|
+
// 判断本block之前有无对应def
|
|
105
|
+
for (let i = stmtIndex - 1; i >= 0; i--) {
|
|
106
|
+
const beforeStmt = block.getStmts()[i];
|
|
107
|
+
if (beforeStmt.getDef() && ((_a = beforeStmt.getDef()) === null || _a === void 0 ? void 0 : _a.toString()) == name) {
|
|
108
|
+
defStmts.push(beforeStmt);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// 本block有对应def直接结束,否则找所有的前序block
|
|
113
|
+
if (defStmts.length != 0) {
|
|
114
|
+
this.defUseChains.push(new DefUseChain_1.DefUseChain(value, defStmts[0], stmt));
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
const needWalkBlocks = [];
|
|
118
|
+
for (const predecessor of block.getPredecessors()) {
|
|
119
|
+
needWalkBlocks.push(predecessor);
|
|
120
|
+
}
|
|
121
|
+
const walkedBlocks = new Set();
|
|
122
|
+
while (needWalkBlocks.length > 0) {
|
|
123
|
+
const predecessor = needWalkBlocks.pop();
|
|
124
|
+
if (!predecessor) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const predecessorStmts = predecessor.getStmts();
|
|
128
|
+
let predecessorHasDef = false;
|
|
129
|
+
for (let i = predecessorStmts.length - 1; i >= 0; i--) {
|
|
130
|
+
const beforeStmt = predecessorStmts[i];
|
|
131
|
+
if (beforeStmt.getDef() && ((_b = beforeStmt.getDef()) === null || _b === void 0 ? void 0 : _b.toString()) == name) {
|
|
132
|
+
defStmts.push(beforeStmt);
|
|
133
|
+
predecessorHasDef = true;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (!predecessorHasDef) {
|
|
138
|
+
for (const morePredecessor of predecessor.getPredecessors()) {
|
|
139
|
+
if (!walkedBlocks.has(morePredecessor) && !needWalkBlocks.includes(morePredecessor))
|
|
140
|
+
needWalkBlocks.unshift(morePredecessor);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
walkedBlocks.add(predecessor);
|
|
144
|
+
}
|
|
145
|
+
for (const def of defStmts) {
|
|
146
|
+
this.defUseChains.push(new DefUseChain_1.DefUseChain(value, def, stmt));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.Cfg = Cfg;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BasicBlock } from './BasicBlock';
|
|
2
|
+
import { Cfg } from './Cfg';
|
|
3
|
+
export declare class DominanceFinder {
|
|
4
|
+
private blocks;
|
|
5
|
+
private blockToIdx;
|
|
6
|
+
private idoms;
|
|
7
|
+
private domFrontiers;
|
|
8
|
+
constructor(cfg: Cfg);
|
|
9
|
+
getDominanceFrontiers(block: BasicBlock): Set<BasicBlock>;
|
|
10
|
+
getBlocks(): BasicBlock[];
|
|
11
|
+
getBlockToIdx(): Map<BasicBlock, number>;
|
|
12
|
+
getImmediateDominators(): number[];
|
|
13
|
+
private getFirstDefinedBlockPredIdx;
|
|
14
|
+
private intersect;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=DominanceFinder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DominanceFinder.d.ts","sourceRoot":"","sources":["../../../src/core/graph/DominanceFinder.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,qBAAa,eAAe;IACxB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,YAAY,CAAkB;gBAE1B,GAAG,EAAE,GAAG;IA2Db,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IAazD,SAAS,IAAI,UAAU,EAAE;IAIzB,aAAa,IAAI,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC;IAIxC,sBAAsB,IAAI,MAAM,EAAE;IAKzC,OAAO,CAAC,2BAA2B;IAUnC,OAAO,CAAC,SAAS;CAUpB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
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.DominanceFinder = void 0;
|
|
18
|
+
class DominanceFinder {
|
|
19
|
+
constructor(cfg) {
|
|
20
|
+
this.blocks = [];
|
|
21
|
+
this.blockToIdx = new Map;
|
|
22
|
+
this.idoms = [];
|
|
23
|
+
this.domFrontiers = [];
|
|
24
|
+
this.blocks = Array.from(cfg.getBlocks());
|
|
25
|
+
for (let i = 0; i < this.blocks.length; i++) {
|
|
26
|
+
let block = this.blocks[i];
|
|
27
|
+
this.blockToIdx.set(block, i);
|
|
28
|
+
}
|
|
29
|
+
const startingBlock = cfg.getStartingBlock();
|
|
30
|
+
// calculate immediate dominator for each block
|
|
31
|
+
this.idoms = new Array(this.blocks.length);
|
|
32
|
+
this.idoms[0] = 0;
|
|
33
|
+
for (let i = 1; i < this.idoms.length; i++) {
|
|
34
|
+
this.idoms[i] = -1;
|
|
35
|
+
}
|
|
36
|
+
let isChanged = true;
|
|
37
|
+
while (isChanged) {
|
|
38
|
+
isChanged = false;
|
|
39
|
+
for (const block of this.blocks) {
|
|
40
|
+
if (block == startingBlock) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
let blockIdx = this.blockToIdx.get(block);
|
|
44
|
+
let preds = Array.from(block.getPredecessors());
|
|
45
|
+
let newIdom = this.getFirstDefinedBlockPredIdx(preds);
|
|
46
|
+
if (preds.length > 0 && newIdom != -1) {
|
|
47
|
+
for (const pred of preds) {
|
|
48
|
+
let predIdx = this.blockToIdx.get(pred);
|
|
49
|
+
if (this.idoms[predIdx] != -1) {
|
|
50
|
+
newIdom = this.intersect(newIdom, predIdx);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (this.idoms[blockIdx] != newIdom) {
|
|
54
|
+
this.idoms[blockIdx] = newIdom;
|
|
55
|
+
isChanged = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// calculate dominance frontiers for each block
|
|
61
|
+
this.domFrontiers = new Array(this.blocks.length);
|
|
62
|
+
for (let i = 0; i < this.domFrontiers.length; i++) {
|
|
63
|
+
this.domFrontiers[i] = new Array();
|
|
64
|
+
}
|
|
65
|
+
for (const block of this.blocks) {
|
|
66
|
+
let preds = Array.from(block.getPredecessors());
|
|
67
|
+
if (preds.length > 1) {
|
|
68
|
+
let blockIdx = this.blockToIdx.get(block);
|
|
69
|
+
for (const pred of preds) {
|
|
70
|
+
let predIdx = this.blockToIdx.get(pred);
|
|
71
|
+
while (predIdx != this.idoms[blockIdx]) {
|
|
72
|
+
this.domFrontiers[predIdx].push(blockIdx);
|
|
73
|
+
predIdx = this.idoms[predIdx];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
getDominanceFrontiers(block) {
|
|
80
|
+
if (!this.blockToIdx.has(block)) {
|
|
81
|
+
throw new Error("The given block: " + block + " is not in Cfg!");
|
|
82
|
+
}
|
|
83
|
+
let idx = this.blockToIdx.get(block);
|
|
84
|
+
let dfs = new Set();
|
|
85
|
+
let dfsIdx = this.domFrontiers[idx];
|
|
86
|
+
for (const dfIdx of dfsIdx) {
|
|
87
|
+
dfs.add(this.blocks[dfIdx]);
|
|
88
|
+
}
|
|
89
|
+
return dfs;
|
|
90
|
+
}
|
|
91
|
+
getBlocks() {
|
|
92
|
+
return this.blocks;
|
|
93
|
+
}
|
|
94
|
+
getBlockToIdx() {
|
|
95
|
+
return this.blockToIdx;
|
|
96
|
+
}
|
|
97
|
+
getImmediateDominators() {
|
|
98
|
+
return this.idoms;
|
|
99
|
+
}
|
|
100
|
+
getFirstDefinedBlockPredIdx(preds) {
|
|
101
|
+
for (const block of preds) {
|
|
102
|
+
let idx = this.blockToIdx.get(block);
|
|
103
|
+
if (this.idoms[idx] != -1) {
|
|
104
|
+
return idx;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return -1;
|
|
108
|
+
}
|
|
109
|
+
intersect(a, b) {
|
|
110
|
+
while (a != b) {
|
|
111
|
+
if (a > b) {
|
|
112
|
+
a = this.idoms[a];
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
b = this.idoms[b];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return a;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.DominanceFinder = DominanceFinder;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BasicBlock } from './BasicBlock';
|
|
2
|
+
import { DominanceFinder } from './DominanceFinder';
|
|
3
|
+
export declare class DominanceTree {
|
|
4
|
+
private blocks;
|
|
5
|
+
private blockToIdx;
|
|
6
|
+
private children;
|
|
7
|
+
private parents;
|
|
8
|
+
constructor(dominanceFinder: DominanceFinder);
|
|
9
|
+
getAllNodesDFS(): BasicBlock[];
|
|
10
|
+
getChildren(block: BasicBlock): BasicBlock[];
|
|
11
|
+
getRoot(): BasicBlock;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DominanceTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DominanceTree.d.ts","sourceRoot":"","sources":["../../../src/core/graph/DominanceTree.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,OAAO,CAAgB;gBAEnB,eAAe,EAAE,eAAe;IAqBrC,cAAc,IAAI,UAAU,EAAE;IAiB9B,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE;IAS5C,OAAO,IAAI,UAAU;CAG/B"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.DominanceTree = void 0;
|
|
18
|
+
class DominanceTree {
|
|
19
|
+
constructor(dominanceFinder) {
|
|
20
|
+
this.blocks = [];
|
|
21
|
+
this.blockToIdx = new Map();
|
|
22
|
+
this.children = [];
|
|
23
|
+
this.parents = [];
|
|
24
|
+
this.blocks = dominanceFinder.getBlocks();
|
|
25
|
+
this.blockToIdx = dominanceFinder.getBlockToIdx();
|
|
26
|
+
let idoms = dominanceFinder.getImmediateDominators();
|
|
27
|
+
// build the tree
|
|
28
|
+
let treeSize = this.blocks.length;
|
|
29
|
+
this.children = new Array(treeSize);
|
|
30
|
+
this.parents = new Array(treeSize);
|
|
31
|
+
for (let i = 0; i < treeSize; i++) {
|
|
32
|
+
this.children[i] = new Array();
|
|
33
|
+
this.parents[i] = -1;
|
|
34
|
+
}
|
|
35
|
+
for (let i = 0; i < treeSize; i++) {
|
|
36
|
+
if (idoms[i] != i) {
|
|
37
|
+
this.parents[i] = idoms[i];
|
|
38
|
+
this.children[idoms[i]].push(i);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
getAllNodesDFS() {
|
|
43
|
+
let dfsBlocks = new Array();
|
|
44
|
+
let queue = new Array();
|
|
45
|
+
queue.push(this.getRoot());
|
|
46
|
+
while (queue.length != 0) {
|
|
47
|
+
let curr = queue.splice(0, 1)[0];
|
|
48
|
+
dfsBlocks.push(curr);
|
|
49
|
+
let childList = this.getChildren(curr);
|
|
50
|
+
if (childList.length != 0) {
|
|
51
|
+
for (let i = childList.length - 1; i >= 0; i--) {
|
|
52
|
+
queue.splice(0, 0, childList[i]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return dfsBlocks;
|
|
57
|
+
}
|
|
58
|
+
getChildren(block) {
|
|
59
|
+
let childList = new Array();
|
|
60
|
+
let idx = this.blockToIdx.get(block);
|
|
61
|
+
for (const i of this.children[idx]) {
|
|
62
|
+
childList.push(this.blocks[i]);
|
|
63
|
+
}
|
|
64
|
+
return childList;
|
|
65
|
+
}
|
|
66
|
+
getRoot() {
|
|
67
|
+
return this.blocks[0];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.DominanceTree = DominanceTree;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Constant } from '../base/Constant';
|
|
2
|
+
import { Decorator } from '../base/Decorator';
|
|
3
|
+
import { ArkInstanceFieldRef } from '../base/Ref';
|
|
4
|
+
import { Stmt } from '../base/Stmt';
|
|
5
|
+
import { Type } from '../base/Type';
|
|
6
|
+
import { ArkField } from '../model/ArkField';
|
|
7
|
+
import { ArkMethod } from '../model/ArkMethod';
|
|
8
|
+
import { ClassSignature, MethodSignature } from '../model/ArkSignature';
|
|
9
|
+
/**
|
|
10
|
+
* @category core/graph
|
|
11
|
+
*/
|
|
12
|
+
export interface ViewTreeNode {
|
|
13
|
+
/** Component node name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** @deprecated Use {@link attributes} instead. */
|
|
16
|
+
stmts: Map<string, [Stmt, (Constant | ArkInstanceFieldRef | MethodSignature)[]]>;
|
|
17
|
+
/** Component attribute stmts, key is attribute name, value is [Stmt, [Uses Values]]. */
|
|
18
|
+
attributes: Map<string, [Stmt, (Constant | ArkInstanceFieldRef | MethodSignature)[]]>;
|
|
19
|
+
/** Used state values. */
|
|
20
|
+
stateValues: Set<ArkField>;
|
|
21
|
+
/** Node's parent, CustomComponent and root node no parent. */
|
|
22
|
+
parent: ViewTreeNode | null;
|
|
23
|
+
/** Node's children. */
|
|
24
|
+
children: ViewTreeNode[];
|
|
25
|
+
/** @deprecated Use {@link signature} instead. */
|
|
26
|
+
classSignature?: ClassSignature | MethodSignature;
|
|
27
|
+
/** CustomComponent class signature or Builder method signature. */
|
|
28
|
+
signature?: ClassSignature | MethodSignature;
|
|
29
|
+
/**
|
|
30
|
+
* Custom component value transfer
|
|
31
|
+
* - key: ArkField, child custom component class stateValue field.
|
|
32
|
+
* - value: ArkField | ArkMethod, parent component transfer value.
|
|
33
|
+
* key is BuilderParam, the value is Builder ArkMethod.
|
|
34
|
+
* Others, the value is parent class stateValue field.
|
|
35
|
+
*/
|
|
36
|
+
stateValuesTransfer?: Map<ArkField, ArkField | ArkMethod>;
|
|
37
|
+
/** BuilderParam placeholders ArkField. */
|
|
38
|
+
builderParam?: ArkField;
|
|
39
|
+
/** builderParam bind builder method signature. */
|
|
40
|
+
builder?: MethodSignature;
|
|
41
|
+
/**
|
|
42
|
+
* walk node and node's children
|
|
43
|
+
* @param selector Node selector function, return true skipping the follow-up nodes.
|
|
44
|
+
* @returns
|
|
45
|
+
* - true: There are nodes that meet the selector.
|
|
46
|
+
* - false: does not exist.
|
|
47
|
+
*/
|
|
48
|
+
walk(selector: (item: ViewTreeNode) => boolean): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the node type is Builder.
|
|
51
|
+
* @returns true: node is Builder, false others.
|
|
52
|
+
*/
|
|
53
|
+
isBuilder(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the node type is custom component.
|
|
56
|
+
* @returns true: node is custom component, false others.
|
|
57
|
+
*/
|
|
58
|
+
isCustomComponent(): boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* ArkUI Component Tree
|
|
62
|
+
* @example
|
|
63
|
+
* // Component Class get ViewTree
|
|
64
|
+
* let arkClas: ArkClass = ...;
|
|
65
|
+
* let viewtree = arkClas.getViewTree();
|
|
66
|
+
*
|
|
67
|
+
* // get viewtree root node
|
|
68
|
+
* let root: ViewTreeNode = viewtree.getRoot();
|
|
69
|
+
*
|
|
70
|
+
* // get viewtree stateValues Map
|
|
71
|
+
* let stateValues: Map<ArkField, Set<ViewTreeNode>> = viewtree.getStateValues();
|
|
72
|
+
*
|
|
73
|
+
* // walk all nodes
|
|
74
|
+
* root.walk((node) => {
|
|
75
|
+
* // check node is builder
|
|
76
|
+
* if (node.isBuilder()) {
|
|
77
|
+
* xx
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* // check node is sub CustomComponent
|
|
81
|
+
* if (node.isCustomComponent()) {
|
|
82
|
+
* xx
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* if (xxx) {
|
|
86
|
+
* // Skip the remaining nodes and end the traversal
|
|
87
|
+
* return true;
|
|
88
|
+
* }
|
|
89
|
+
*
|
|
90
|
+
* return false;
|
|
91
|
+
* })
|
|
92
|
+
*
|
|
93
|
+
* @category core/graph
|
|
94
|
+
*/
|
|
95
|
+
export interface ViewTree {
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated Use {@link getStateValues} instead.
|
|
98
|
+
*/
|
|
99
|
+
isClassField(name: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use {@link getStateValues} instead.
|
|
102
|
+
*/
|
|
103
|
+
getClassFieldType(name: string): Decorator | Type | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Map of the component controlled by the state variable
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
getStateValues(): Map<ArkField, Set<ViewTreeNode>>;
|
|
109
|
+
/**
|
|
110
|
+
* ViewTree root node.
|
|
111
|
+
* @returns root node
|
|
112
|
+
*/
|
|
113
|
+
getRoot(): ViewTreeNode | null;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=ViewTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewTree.d.ts","sourceRoot":"","sources":["../../../src/core/graph/ViewTree.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,mBAAmB,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;IACjF,wFAAwF;IACxF,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,mBAAmB,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;IACtF,yBAAyB;IACzB,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC3B,8DAA8D;IAC9D,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,uBAAuB;IACvB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iDAAiD;IACjD,cAAc,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC;IAClD,mEAAmE;IACnE,SAAS,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC;IAE7C;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IAE1D,0CAA0C;IAC1C,YAAY,CAAC,EAAE,QAAQ,CAAC;IAExB,kDAAkD;IAClD,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B;;;;;;OAMG;IACH,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,GAAG,OAAO,CAAC;IAEzD;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC;IAErB;;;OAGG;IACH,iBAAiB,IAAI,OAAO,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,QAAQ;IACrB;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAEpC;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IAE9D;;;OAGG;IACH,cAAc,IAAI,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnD;;;OAGG;IACH,OAAO,IAAI,YAAY,GAAG,IAAI,CAAC;CAClC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 });
|