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 @@
|
|
|
1
|
+
{"version":3,"file":"builderUtils.d.ts","sourceRoot":"","sources":["../../../../src/core/model/builder/builderUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,oBAAoB,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC/G,OAAO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AAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,QAM3F;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,wBAAwB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAC9E,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAkF9E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,QA8CjD"}
|
|
@@ -0,0 +1,449 @@
|
|
|
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.buildTypeFromPreStr = exports.tsNode2Type = exports.buildReturnType = exports.buildGenericType = exports.buildParameters = exports.buildTypeParameters = exports.buildHeritageClauses = exports.buildModifiers = exports.handlePropertyAccessExpression = exports.handleQualifiedName = void 0;
|
|
44
|
+
const ohos_typescript_1 = __importDefault(require("ohos-typescript"));
|
|
45
|
+
const Type_1 = require("../../base/Type");
|
|
46
|
+
const TypeInference_1 = require("../../common/TypeInference");
|
|
47
|
+
const ArkField_1 = require("../ArkField");
|
|
48
|
+
const logger_1 = __importStar(require("../../../utils/logger"));
|
|
49
|
+
const ArkClass_1 = require("../ArkClass");
|
|
50
|
+
const ArkMethod_1 = require("../ArkMethod");
|
|
51
|
+
const Decorator_1 = require("../../base/Decorator");
|
|
52
|
+
const ArkMethodBuilder_1 = require("./ArkMethodBuilder");
|
|
53
|
+
const ArkClassBuilder_1 = require("./ArkClassBuilder");
|
|
54
|
+
const Builtin_1 = require("../../common/Builtin");
|
|
55
|
+
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'builderUtils');
|
|
56
|
+
function handleQualifiedName(node) {
|
|
57
|
+
let right = node.right.text;
|
|
58
|
+
let left = '';
|
|
59
|
+
if (node.left.kind === ohos_typescript_1.default.SyntaxKind.Identifier) {
|
|
60
|
+
left = node.left.text;
|
|
61
|
+
}
|
|
62
|
+
else if (node.left.kind === ohos_typescript_1.default.SyntaxKind.QualifiedName) {
|
|
63
|
+
left = handleQualifiedName(node.left);
|
|
64
|
+
}
|
|
65
|
+
let qualifiedName = left + '.' + right;
|
|
66
|
+
return qualifiedName;
|
|
67
|
+
}
|
|
68
|
+
exports.handleQualifiedName = handleQualifiedName;
|
|
69
|
+
function handlePropertyAccessExpression(node) {
|
|
70
|
+
let right = node.name.text;
|
|
71
|
+
let left = '';
|
|
72
|
+
if (ohos_typescript_1.default.SyntaxKind[node.expression.kind] == 'Identifier') {
|
|
73
|
+
left = node.expression.text;
|
|
74
|
+
}
|
|
75
|
+
else if (ohos_typescript_1.default.isStringLiteral(node.expression)) {
|
|
76
|
+
left = node.expression.text;
|
|
77
|
+
}
|
|
78
|
+
else if (ohos_typescript_1.default.isPropertyAccessExpression(node.expression)) {
|
|
79
|
+
left = handlePropertyAccessExpression(node.expression);
|
|
80
|
+
}
|
|
81
|
+
let propertyAccessExpressionName = left + '.' + right;
|
|
82
|
+
return propertyAccessExpressionName;
|
|
83
|
+
}
|
|
84
|
+
exports.handlePropertyAccessExpression = handlePropertyAccessExpression;
|
|
85
|
+
function buildModifiers(node, sourceFile) {
|
|
86
|
+
var _a;
|
|
87
|
+
let modifiers = new Set();
|
|
88
|
+
function parseModifier(modifier) {
|
|
89
|
+
if (ohos_typescript_1.default.SyntaxKind[modifier.kind] == 'FirstContextualKeyword') {
|
|
90
|
+
modifiers.add('AbstractKeyword');
|
|
91
|
+
}
|
|
92
|
+
else if (ohos_typescript_1.default.isDecorator(modifier)) {
|
|
93
|
+
if (modifier.expression) {
|
|
94
|
+
let kind = '';
|
|
95
|
+
let param = '';
|
|
96
|
+
if (ohos_typescript_1.default.isIdentifier(modifier.expression)) {
|
|
97
|
+
kind = modifier.expression.text;
|
|
98
|
+
}
|
|
99
|
+
else if (ohos_typescript_1.default.isCallExpression(modifier.expression)) {
|
|
100
|
+
if (ohos_typescript_1.default.isIdentifier(modifier.expression.expression)) {
|
|
101
|
+
kind = modifier.expression.expression.text;
|
|
102
|
+
}
|
|
103
|
+
if (modifier.expression.arguments.length > 0) {
|
|
104
|
+
const arg = modifier.expression.arguments[0];
|
|
105
|
+
if (ohos_typescript_1.default.isArrowFunction(arg)) {
|
|
106
|
+
const body = arg.body;
|
|
107
|
+
if (ohos_typescript_1.default.isIdentifier(body)) {
|
|
108
|
+
param = body.text;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const decorator = new Decorator_1.Decorator(kind);
|
|
114
|
+
decorator.setContent(modifier.expression.getText(sourceFile));
|
|
115
|
+
if (param != '') {
|
|
116
|
+
decorator.setParam(param);
|
|
117
|
+
}
|
|
118
|
+
modifiers.add(decorator);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
modifiers.add(ohos_typescript_1.default.SyntaxKind[modifier.kind]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (ohos_typescript_1.default.canHaveModifiers(node)) {
|
|
126
|
+
(_a = ohos_typescript_1.default.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.forEach(parseModifier);
|
|
127
|
+
}
|
|
128
|
+
ohos_typescript_1.default.getAllDecorators(node).forEach(parseModifier);
|
|
129
|
+
return modifiers;
|
|
130
|
+
}
|
|
131
|
+
exports.buildModifiers = buildModifiers;
|
|
132
|
+
function buildHeritageClauses(heritageClauses) {
|
|
133
|
+
let heritageClausesMap = new Map();
|
|
134
|
+
heritageClauses === null || heritageClauses === void 0 ? void 0 : heritageClauses.forEach((heritageClause) => {
|
|
135
|
+
heritageClause.types.forEach((type) => {
|
|
136
|
+
heritageClausesMap.set(type.getText(), ohos_typescript_1.default.SyntaxKind[heritageClause.token]);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
return heritageClausesMap;
|
|
140
|
+
}
|
|
141
|
+
exports.buildHeritageClauses = buildHeritageClauses;
|
|
142
|
+
function buildTypeParameters(typeParameters, sourceFile, arkInstance) {
|
|
143
|
+
const genericTypes = [];
|
|
144
|
+
let index = -1;
|
|
145
|
+
typeParameters.forEach((typeParameter) => {
|
|
146
|
+
const genericType = tsNode2Type(typeParameter, sourceFile, arkInstance);
|
|
147
|
+
if (genericType instanceof Type_1.GenericType) {
|
|
148
|
+
genericType.setIndex(++index);
|
|
149
|
+
genericTypes.push(genericType);
|
|
150
|
+
}
|
|
151
|
+
if (typeParameter.modifiers) {
|
|
152
|
+
logger.warn('This typeparameter has modifiers.');
|
|
153
|
+
}
|
|
154
|
+
if (typeParameter.expression) {
|
|
155
|
+
logger.warn('This typeparameter has expression.');
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return genericTypes;
|
|
159
|
+
}
|
|
160
|
+
exports.buildTypeParameters = buildTypeParameters;
|
|
161
|
+
function buildParameters(params, arkInstance, sourceFile) {
|
|
162
|
+
let parameters = [];
|
|
163
|
+
params.forEach((parameter) => {
|
|
164
|
+
let methodParameter = new ArkMethodBuilder_1.MethodParameter();
|
|
165
|
+
// name
|
|
166
|
+
if (ohos_typescript_1.default.isIdentifier(parameter.name)) {
|
|
167
|
+
methodParameter.setName(parameter.name.text);
|
|
168
|
+
}
|
|
169
|
+
else if (ohos_typescript_1.default.isObjectBindingPattern(parameter.name)) {
|
|
170
|
+
methodParameter.setName('ObjectBindingPattern');
|
|
171
|
+
let elements = [];
|
|
172
|
+
parameter.name.elements.forEach((element) => {
|
|
173
|
+
let paraElement = new ArkMethodBuilder_1.ObjectBindingPatternParameter();
|
|
174
|
+
if (element.propertyName) {
|
|
175
|
+
if (ohos_typescript_1.default.isIdentifier(element.propertyName)) {
|
|
176
|
+
paraElement.setPropertyName(element.propertyName.text);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
logger.warn('New propertyName of ObjectBindingPattern found, please contact developers to support this!');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (element.name) {
|
|
183
|
+
if (ohos_typescript_1.default.isIdentifier(element.name)) {
|
|
184
|
+
paraElement.setName(element.name.text);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
logger.warn('New name of ObjectBindingPattern found, please contact developers to support this!');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (element.initializer) {
|
|
191
|
+
logger.warn('TODO: support ObjectBindingPattern initializer.');
|
|
192
|
+
}
|
|
193
|
+
if (element.dotDotDotToken) {
|
|
194
|
+
paraElement.setOptional(true);
|
|
195
|
+
}
|
|
196
|
+
elements.push(paraElement);
|
|
197
|
+
});
|
|
198
|
+
methodParameter.setObjElements(elements);
|
|
199
|
+
}
|
|
200
|
+
else if (ohos_typescript_1.default.isArrayBindingPattern(parameter.name)) {
|
|
201
|
+
methodParameter.setName('ArrayBindingPattern');
|
|
202
|
+
let elements = [];
|
|
203
|
+
parameter.name.elements.forEach((element) => {
|
|
204
|
+
let paraElement = new ArkMethodBuilder_1.ArrayBindingPatternParameter();
|
|
205
|
+
if (ohos_typescript_1.default.isBindingElement(element)) {
|
|
206
|
+
if (element.propertyName) {
|
|
207
|
+
if (ohos_typescript_1.default.isIdentifier(element.propertyName)) {
|
|
208
|
+
paraElement.setPropertyName(element.propertyName.text);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
logger.warn('New propertyName of ArrayBindingPattern found, please contact developers to support this!');
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (element.name) {
|
|
215
|
+
if (ohos_typescript_1.default.isIdentifier(element.name)) {
|
|
216
|
+
paraElement.setName(element.name.text);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
logger.warn('New name of ArrayBindingPattern found, please contact developers to support this!');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (element.initializer) {
|
|
223
|
+
logger.warn('TODO: support ArrayBindingPattern initializer.');
|
|
224
|
+
}
|
|
225
|
+
if (element.dotDotDotToken) {
|
|
226
|
+
paraElement.setOptional(true);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else if (ohos_typescript_1.default.isOmittedExpression(element)) {
|
|
230
|
+
logger.warn('TODO: support OmittedExpression for ArrayBindingPattern parameter name.');
|
|
231
|
+
}
|
|
232
|
+
elements.push(paraElement);
|
|
233
|
+
});
|
|
234
|
+
methodParameter.setArrayElements(elements);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
logger.warn('Parameter name is not identifier, ObjectBindingPattern nor ArrayBindingPattern, please contact developers to support this!');
|
|
238
|
+
}
|
|
239
|
+
// questionToken
|
|
240
|
+
if (parameter.questionToken) {
|
|
241
|
+
methodParameter.setOptional(true);
|
|
242
|
+
}
|
|
243
|
+
// type
|
|
244
|
+
if (parameter.type) {
|
|
245
|
+
methodParameter.setType(buildGenericType(tsNode2Type(parameter.type, sourceFile, arkInstance), arkInstance));
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
methodParameter.setType(Type_1.UnknownType.getInstance());
|
|
249
|
+
}
|
|
250
|
+
// initializer
|
|
251
|
+
if (parameter.initializer) {
|
|
252
|
+
//TODO?
|
|
253
|
+
}
|
|
254
|
+
// dotDotDotToken
|
|
255
|
+
if (parameter.dotDotDotToken) {
|
|
256
|
+
methodParameter.setDotDotDotToken(true);
|
|
257
|
+
}
|
|
258
|
+
// modifiers
|
|
259
|
+
if (parameter.modifiers) {
|
|
260
|
+
//
|
|
261
|
+
}
|
|
262
|
+
parameters.push(methodParameter);
|
|
263
|
+
});
|
|
264
|
+
return parameters;
|
|
265
|
+
}
|
|
266
|
+
exports.buildParameters = buildParameters;
|
|
267
|
+
function buildGenericType(type, arkInstance) {
|
|
268
|
+
function replace(urType) {
|
|
269
|
+
var _a, _b;
|
|
270
|
+
const typeName = urType.getName();
|
|
271
|
+
let gType;
|
|
272
|
+
if (arkInstance instanceof ArkMethod_1.ArkMethod) {
|
|
273
|
+
gType = (_a = arkInstance.getGenericTypes()) === null || _a === void 0 ? void 0 : _a.find(f => f.getName() === typeName);
|
|
274
|
+
}
|
|
275
|
+
if (!gType) {
|
|
276
|
+
gType = (_b = arkInstance.getDeclaringArkClass().getGenericsTypes()) === null || _b === void 0 ? void 0 : _b.find(f => f.getName() === typeName);
|
|
277
|
+
}
|
|
278
|
+
return gType !== null && gType !== void 0 ? gType : urType;
|
|
279
|
+
}
|
|
280
|
+
if (type instanceof Type_1.UnclearReferenceType) {
|
|
281
|
+
return replace(type);
|
|
282
|
+
}
|
|
283
|
+
else if (type instanceof Type_1.UnionType) {
|
|
284
|
+
const types = type.getTypes();
|
|
285
|
+
for (let i = 0; i < types.length; i++) {
|
|
286
|
+
const mayType = types[i];
|
|
287
|
+
if (mayType instanceof Type_1.UnclearReferenceType) {
|
|
288
|
+
types[i] = replace(mayType);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return type;
|
|
293
|
+
}
|
|
294
|
+
exports.buildGenericType = buildGenericType;
|
|
295
|
+
function buildReturnType(node, sourceFile, method) {
|
|
296
|
+
if (node) {
|
|
297
|
+
return tsNode2Type(node, sourceFile, method);
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
return new Type_1.UnknownType();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
exports.buildReturnType = buildReturnType;
|
|
304
|
+
function tsNode2Type(typeNode, sourceFile, arkInstance) {
|
|
305
|
+
if (ohos_typescript_1.default.isTypeReferenceNode(typeNode)) {
|
|
306
|
+
const genericTypes = [];
|
|
307
|
+
if (typeNode.typeArguments) {
|
|
308
|
+
for (const typeArgument of typeNode.typeArguments) {
|
|
309
|
+
genericTypes.push(tsNode2Type(typeArgument, sourceFile, arkInstance));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
let referenceNodeName = typeNode.typeName;
|
|
313
|
+
if (ohos_typescript_1.default.isQualifiedName(referenceNodeName)) {
|
|
314
|
+
let parameterTypeStr = handleQualifiedName(referenceNodeName);
|
|
315
|
+
return new Type_1.UnclearReferenceType(parameterTypeStr, genericTypes);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
let parameterTypeStr = referenceNodeName.text;
|
|
319
|
+
return new Type_1.UnclearReferenceType(parameterTypeStr, genericTypes);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
else if (ohos_typescript_1.default.isUnionTypeNode(typeNode)) {
|
|
323
|
+
let unionTypePara = [];
|
|
324
|
+
typeNode.types.forEach((tmpType) => {
|
|
325
|
+
unionTypePara.push(tsNode2Type(tmpType, sourceFile, arkInstance));
|
|
326
|
+
});
|
|
327
|
+
return new Type_1.UnionType(unionTypePara);
|
|
328
|
+
}
|
|
329
|
+
else if (ohos_typescript_1.default.isLiteralTypeNode(typeNode)) {
|
|
330
|
+
return buildTypeFromPreStr(ohos_typescript_1.default.SyntaxKind[typeNode.literal.kind]);
|
|
331
|
+
}
|
|
332
|
+
else if (ohos_typescript_1.default.isTypeLiteralNode(typeNode)) {
|
|
333
|
+
let cls = new ArkClass_1.ArkClass();
|
|
334
|
+
let declaringClass;
|
|
335
|
+
if (arkInstance instanceof ArkMethod_1.ArkMethod) {
|
|
336
|
+
declaringClass = arkInstance.getDeclaringArkClass();
|
|
337
|
+
}
|
|
338
|
+
else if (arkInstance instanceof ArkField_1.ArkField) {
|
|
339
|
+
declaringClass = arkInstance.getDeclaringArkClass();
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
declaringClass = arkInstance;
|
|
343
|
+
}
|
|
344
|
+
if (declaringClass.getDeclaringArkNamespace()) {
|
|
345
|
+
cls.setDeclaringArkNamespace(declaringClass.getDeclaringArkNamespace());
|
|
346
|
+
cls.setDeclaringArkFile(declaringClass.getDeclaringArkFile());
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
cls.setDeclaringArkFile(declaringClass.getDeclaringArkFile());
|
|
350
|
+
}
|
|
351
|
+
(0, ArkClassBuilder_1.buildNormalArkClassFromArkMethod)(typeNode, cls, sourceFile);
|
|
352
|
+
return new Type_1.ClassType(cls.getSignature());
|
|
353
|
+
}
|
|
354
|
+
else if (ohos_typescript_1.default.isFunctionTypeNode(typeNode)) {
|
|
355
|
+
let mtd = new ArkMethod_1.ArkMethod();
|
|
356
|
+
let cls;
|
|
357
|
+
if (arkInstance instanceof ArkMethod_1.ArkMethod) {
|
|
358
|
+
cls = arkInstance.getDeclaringArkClass();
|
|
359
|
+
}
|
|
360
|
+
else if (arkInstance instanceof ArkClass_1.ArkClass) {
|
|
361
|
+
cls = arkInstance;
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
cls = arkInstance.getDeclaringArkClass();
|
|
365
|
+
}
|
|
366
|
+
(0, ArkMethodBuilder_1.buildArkMethodFromArkClass)(typeNode, cls, mtd, sourceFile);
|
|
367
|
+
return new Type_1.FunctionType(mtd.getSignature());
|
|
368
|
+
}
|
|
369
|
+
else if (ohos_typescript_1.default.isTypeParameterDeclaration(typeNode)) {
|
|
370
|
+
const name = typeNode.name.text;
|
|
371
|
+
let defaultType;
|
|
372
|
+
if (typeNode.default) {
|
|
373
|
+
defaultType = tsNode2Type(typeNode.default, sourceFile, arkInstance);
|
|
374
|
+
}
|
|
375
|
+
let constraint;
|
|
376
|
+
if (typeNode.constraint) {
|
|
377
|
+
constraint = tsNode2Type(typeNode.constraint, sourceFile, arkInstance);
|
|
378
|
+
}
|
|
379
|
+
return new Type_1.GenericType(name, defaultType, constraint);
|
|
380
|
+
}
|
|
381
|
+
else if (ohos_typescript_1.default.isTupleTypeNode(typeNode)) {
|
|
382
|
+
const types = [];
|
|
383
|
+
typeNode.elements.forEach(element => {
|
|
384
|
+
types.push(tsNode2Type(element, sourceFile, arkInstance));
|
|
385
|
+
});
|
|
386
|
+
return new Type_1.TupleType(types);
|
|
387
|
+
}
|
|
388
|
+
else if (ohos_typescript_1.default.isArrayTypeNode(typeNode)) {
|
|
389
|
+
return new Type_1.ArrayType(tsNode2Type(typeNode.elementType, sourceFile, arkInstance), 1);
|
|
390
|
+
}
|
|
391
|
+
else if (ohos_typescript_1.default.isParenthesizedTypeNode(typeNode)) {
|
|
392
|
+
return tsNode2Type(typeNode.type, sourceFile, arkInstance);
|
|
393
|
+
}
|
|
394
|
+
else if (typeNode.kind === ohos_typescript_1.default.SyntaxKind.ObjectKeyword) {
|
|
395
|
+
return new Type_1.ClassType(Builtin_1.Builtin.OBJECT_CLASS_SIGNATURE);
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
return buildTypeFromPreStr(ohos_typescript_1.default.SyntaxKind[typeNode.kind]);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
exports.tsNode2Type = tsNode2Type;
|
|
402
|
+
function buildTypeFromPreStr(preStr) {
|
|
403
|
+
let postStr = '';
|
|
404
|
+
switch (preStr) {
|
|
405
|
+
case 'BooleanKeyword':
|
|
406
|
+
postStr = 'boolean';
|
|
407
|
+
break;
|
|
408
|
+
case 'FalseKeyword':
|
|
409
|
+
postStr = 'boolean';
|
|
410
|
+
break;
|
|
411
|
+
case 'TrueKeyword':
|
|
412
|
+
postStr = 'boolean';
|
|
413
|
+
break;
|
|
414
|
+
case 'NumberKeyword':
|
|
415
|
+
postStr = 'number';
|
|
416
|
+
break;
|
|
417
|
+
case 'NumericLiteral':
|
|
418
|
+
postStr = 'number';
|
|
419
|
+
break;
|
|
420
|
+
case 'FirstLiteralToken':
|
|
421
|
+
postStr = 'number';
|
|
422
|
+
break;
|
|
423
|
+
case 'StringKeyword':
|
|
424
|
+
postStr = 'string';
|
|
425
|
+
break;
|
|
426
|
+
case 'StringLiteral':
|
|
427
|
+
postStr = 'string';
|
|
428
|
+
break;
|
|
429
|
+
case 'UndefinedKeyword':
|
|
430
|
+
postStr = 'undefined';
|
|
431
|
+
break;
|
|
432
|
+
case 'NullKeyword':
|
|
433
|
+
postStr = 'null';
|
|
434
|
+
break;
|
|
435
|
+
case 'AnyKeyword':
|
|
436
|
+
postStr = 'any';
|
|
437
|
+
break;
|
|
438
|
+
case 'VoidKeyword':
|
|
439
|
+
postStr = 'void';
|
|
440
|
+
break;
|
|
441
|
+
case 'NeverKeyword':
|
|
442
|
+
postStr = 'never';
|
|
443
|
+
break;
|
|
444
|
+
default:
|
|
445
|
+
postStr = preStr;
|
|
446
|
+
}
|
|
447
|
+
return TypeInference_1.TypeInference.buildTypeFromStr(postStr);
|
|
448
|
+
}
|
|
449
|
+
exports.buildTypeFromPreStr = buildTypeFromPreStr;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export { AbstractAnalysis } from './callgraph/algorithm/AbstractAnalysis';
|
|
2
|
+
export { ClassHierarchyAnalysis } from './callgraph/algorithm/ClassHierarchyAnalysis';
|
|
3
|
+
export { RapidTypeAnalysis } from './callgraph/algorithm/RapidTypeAnalysis';
|
|
4
|
+
export { PTAStat, PAGStat, CGStat } from './callgraph/common/Statistics';
|
|
5
|
+
export { NodeID, Kind, GraphTraits, BaseEdge, BaseNode, BaseGraph } from './callgraph/model/BaseGraph';
|
|
6
|
+
export * from './callgraph/model/CallGraph';
|
|
7
|
+
export { CallGraphBuilder } from './callgraph/model/builder/CallGraphBuilder';
|
|
8
|
+
export { KLimitedContextSensitive } from './callgraph/pointerAnalysis/Context';
|
|
9
|
+
export { DummyCallCreator } from './callgraph/pointerAnalysis/DummyCallCreator';
|
|
10
|
+
export * from './callgraph/pointerAnalysis/Pag';
|
|
11
|
+
export { CSFuncID, PagBuilder } from './callgraph/pointerAnalysis/PagBuilder';
|
|
12
|
+
export { PointerAnalysis } from './callgraph/pointerAnalysis/PointerAnalysis';
|
|
13
|
+
export { PointerAnalysisConfig } from './callgraph/pointerAnalysis/PointerAnalysisConfig';
|
|
14
|
+
export { PtsSet, DiffPTData } from './callgraph/pointerAnalysis/PtsDS';
|
|
15
|
+
export { Constant } from './core/base/Constant';
|
|
16
|
+
export { Decorator } from './core/base/Decorator';
|
|
17
|
+
export { DefUseChain } from './core/base/DefUseChain';
|
|
18
|
+
export * from './core/base/Expr';
|
|
19
|
+
export { Local } from './core/base/Local';
|
|
20
|
+
export { LineColPosition, FullPosition } from './core/base/Position';
|
|
21
|
+
export * from './core/base/Ref';
|
|
22
|
+
export * from './core/base/Stmt';
|
|
23
|
+
export * from './core/base/Type';
|
|
24
|
+
export { Value } from './core/base/Value';
|
|
25
|
+
export { ModelUtils } from './core/common/ModelUtils';
|
|
26
|
+
export * from './core/common/Const';
|
|
27
|
+
export { DummyMainCreater } from './core/common/DummyMainCreater';
|
|
28
|
+
export * from './core/common/EtsConst';
|
|
29
|
+
export { ExprUseReplacer } from './core/common/ExprUseReplacer';
|
|
30
|
+
export { IRUtils } from './core/common/IRUtils';
|
|
31
|
+
export { RefUseReplacer } from './core/common/RefUseReplacer';
|
|
32
|
+
export { StmtUseReplacer } from './core/common/StmtUseReplacer';
|
|
33
|
+
export * from './core/common/TSConst';
|
|
34
|
+
export { TypeInference } from './core/common/TypeInference';
|
|
35
|
+
export { ValueUtil } from './core/common/ValueUtil';
|
|
36
|
+
export { VisibleValue, Scope } from './core/common/VisibleValue';
|
|
37
|
+
export { DataflowProblem, FlowFunction } from './core/dataflow/DataflowProblem';
|
|
38
|
+
export { DataflowResult } from './core/dataflow/DataflowResult';
|
|
39
|
+
export { DataflowSolver, factEqual } from './core/dataflow/DataflowSolver';
|
|
40
|
+
export { Edge, PathEdgePoint, PathEdge } from './core/dataflow/Edge';
|
|
41
|
+
export { Fact } from './core/dataflow/Fact';
|
|
42
|
+
export { TiantAnalysisChecker, TiantAnalysisSolver } from './core/dataflow/TiantAnalysis';
|
|
43
|
+
export { UndefinedVariableChecker, UndefinedVariableSolver } from './core/dataflow/UndefinedVariable';
|
|
44
|
+
export { BasicBlock } from './core/graph/BasicBlock';
|
|
45
|
+
export { Cfg } from './core/graph/Cfg';
|
|
46
|
+
export { ViewTree, ViewTreeNode } from './core/graph/ViewTree';
|
|
47
|
+
export { DominanceFinder } from './core/graph/DominanceFinder';
|
|
48
|
+
export { DominanceTree } from './core/graph/DominanceTree';
|
|
49
|
+
export { ArkFile } from './core/model/ArkFile';
|
|
50
|
+
export { ArkNamespace } from './core/model/ArkNamespace';
|
|
51
|
+
export { ArkClass } from './core/model/ArkClass';
|
|
52
|
+
export { ArkMethod } from './core/model/ArkMethod';
|
|
53
|
+
export { ArkField } from './core/model/ArkField';
|
|
54
|
+
export { ExportInfo } from './core/model/ArkExport';
|
|
55
|
+
export { ImportInfo } from './core/model/ArkImport';
|
|
56
|
+
export { ArkBody } from './core/model/ArkBody';
|
|
57
|
+
export * from './core/model/ArkSignature';
|
|
58
|
+
export * from './core/model/builder/ArkSignatureBuilder';
|
|
59
|
+
export { SceneConfig } from './Config';
|
|
60
|
+
export { Scene } from './Scene';
|
|
61
|
+
export { Printer } from './save/Printer';
|
|
62
|
+
export { PrinterBuilder } from './save/PrinterBuilder';
|
|
63
|
+
export { DotMethodPrinter, DotClassPrinter, DotNamespacePrinter, DotFilePrinter } from './save/DotPrinter';
|
|
64
|
+
export { SourceMethod as SourceMethodPrinter } from './save/source/SourceMethod';
|
|
65
|
+
export { SourceClass as SourceClassPrinter } from './save/source/SourceClass';
|
|
66
|
+
export { SourceNamespace as SourceNamespacePrinter } from './save/source/SourceNamespace';
|
|
67
|
+
export { SourceFilePrinter } from './save/source/SourceFilePrinter';
|
|
68
|
+
export { JsonPrinter } from './save/JsonPrinter';
|
|
69
|
+
export { GraphPrinter } from './save/GraphPrinter';
|
|
70
|
+
export * from './transformer/StaticSingleAssignmentFormer';
|
|
71
|
+
export * from './utils/callGraphUtils';
|
|
72
|
+
export * from './utils/entryMethodUtils';
|
|
73
|
+
export * from './utils/FileUtils';
|
|
74
|
+
export * from './utils/getAllFiles';
|
|
75
|
+
export * from './utils/json5parser';
|
|
76
|
+
export * from './utils/pathTransfer';
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1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