arkanalyzer 1.0.85 → 1.0.87
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/README.en.md +69 -65
- package/README.md +56 -70
- package/config/arkanalyzer.json +7 -2
- package/docs/cppFrontend/ArkAnalyzer-cpp_usage_guide.md +245 -0
- package/docs/cppFrontend/cpp_frontend_build_guide.md +126 -0
- package/docs/cppFrontend/cpp_frontend_user_guide.md +175 -0
- package/docs/cppFrontend/img.png +0 -0
- package/docs/cppFrontend/img_1.png +0 -0
- package/docs/cppFrontend/img_10.png +0 -0
- package/docs/cppFrontend/img_11.png +0 -0
- package/docs/cppFrontend/img_12.png +0 -0
- package/docs/cppFrontend/img_13.png +0 -0
- package/docs/cppFrontend/img_14.png +0 -0
- package/docs/cppFrontend/img_15.png +0 -0
- package/docs/cppFrontend/img_16.png +0 -0
- package/docs/cppFrontend/img_17.png +0 -0
- package/docs/cppFrontend/img_18.png +0 -0
- package/docs/cppFrontend/img_19.png +0 -0
- package/docs/cppFrontend/img_2.png +0 -0
- package/docs/cppFrontend/img_20.png +0 -0
- package/docs/cppFrontend/img_21.png +0 -0
- package/docs/cppFrontend/img_22.png +0 -0
- package/docs/cppFrontend/img_23.png +0 -0
- package/docs/cppFrontend/img_3.png +0 -0
- package/docs/cppFrontend/img_4.png +0 -0
- package/docs/cppFrontend/img_5.png +0 -0
- package/docs/cppFrontend/img_6.png +0 -0
- package/docs/cppFrontend/img_7.png +0 -0
- package/docs/cppFrontend/img_8.png +0 -0
- package/docs/cppFrontend/img_9.png +0 -0
- package/docs/sig_programanalysis.en.md +66 -0
- package/docs/sig_programanalysis.md +73 -0
- package/lib/Config.d.ts +32 -1
- package/lib/Config.d.ts.map +1 -1
- package/lib/Config.js +76 -2
- package/lib/Scene.d.ts +25 -2
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +148 -40
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts +4 -3
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/AbstractAnalysis.js +17 -17
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts +6 -1
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +117 -14
- package/lib/callgraph/common/Statistics.d.ts +4 -2
- package/lib/callgraph/common/Statistics.d.ts.map +1 -1
- package/lib/callgraph/common/Statistics.js +14 -2
- package/lib/callgraph/model/CallGraph.d.ts +12 -8
- package/lib/callgraph/model/CallGraph.d.ts.map +1 -1
- package/lib/callgraph/model/CallGraph.js +53 -29
- package/lib/callgraph/model/builder/CallGraphBuilder.d.ts +1 -0
- package/lib/callgraph/model/builder/CallGraphBuilder.d.ts.map +1 -1
- package/lib/callgraph/model/builder/CallGraphBuilder.js +5 -1
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.js +3 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +4 -2
- package/lib/cli/cli.d.ts +3 -0
- package/lib/cli/cli.d.ts.map +1 -0
- package/lib/cli/cli.js +82 -0
- package/lib/cli/commands/cg.d.ts +32 -0
- package/lib/cli/commands/cg.d.ts.map +1 -0
- package/lib/cli/commands/cg.js +401 -0
- package/lib/cli/commands/index.d.ts +6 -0
- package/lib/cli/commands/index.d.ts.map +1 -0
- package/lib/cli/commands/index.js +64 -0
- package/lib/cli/commands/ir.d.ts +26 -0
- package/lib/cli/commands/ir.d.ts.map +1 -0
- package/lib/cli/commands/ir.js +94 -0
- package/lib/core/base/Constant.d.ts +1 -1
- package/lib/core/base/Constant.d.ts.map +1 -1
- package/lib/core/base/Constant.js +1 -1
- package/lib/core/base/Expr.d.ts +29 -5
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +144 -22
- package/lib/core/base/Position.d.ts +14 -0
- package/lib/core/base/Position.d.ts.map +1 -1
- package/lib/core/base/Position.js +27 -0
- package/lib/core/base/Ref.d.ts +1 -0
- package/lib/core/base/Ref.d.ts.map +1 -1
- package/lib/core/base/Ref.js +4 -1
- package/lib/core/base/Type.d.ts +64 -24
- package/lib/core/base/Type.d.ts.map +1 -1
- package/lib/core/base/Type.js +144 -49
- package/lib/core/common/ArkError.d.ts +26 -2
- package/lib/core/common/ArkError.d.ts.map +1 -1
- package/lib/core/common/ArkError.js +56 -2
- package/lib/core/common/ArkIRTransformer.d.ts +11 -10
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +1 -1
- package/lib/core/common/ArkValueTransformer.d.ts +14 -12
- package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkValueTransformer.js +1 -5
- package/lib/core/common/Const.d.ts +3 -0
- package/lib/core/common/Const.d.ts.map +1 -1
- package/lib/core/common/Const.js +4 -1
- package/lib/core/common/DummyMainCreater.d.ts +23 -13
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
- package/lib/core/common/DummyMainCreater.js +66 -43
- package/lib/core/common/EtsConst.d.ts +11 -0
- package/lib/core/common/EtsConst.d.ts.map +1 -1
- package/lib/core/common/EtsConst.js +12 -1
- package/lib/core/common/IRInference.d.ts.map +1 -1
- package/lib/core/common/IRInference.js +5 -1
- package/lib/core/common/ModelUtils.d.ts +4 -7
- package/lib/core/common/ModelUtils.d.ts.map +1 -1
- package/lib/core/common/ModelUtils.js +77 -110
- package/lib/core/common/SdkUtils.d.ts +1 -1
- package/lib/core/common/SdkUtils.d.ts.map +1 -1
- package/lib/core/common/SdkUtils.js +14 -5
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +9 -3
- package/lib/core/graph/BaseExplicitGraph.d.ts +4 -4
- package/lib/core/graph/BaseExplicitGraph.d.ts.map +1 -1
- package/lib/core/graph/BaseExplicitGraph.js +15 -8
- package/lib/core/graph/BasicBlock.d.ts.map +1 -1
- package/lib/core/graph/Scc.d.ts.map +1 -1
- package/lib/core/graph/Scc.js +7 -2
- package/lib/core/graph/builder/CfgBuilder.d.ts +10 -7
- package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/CfgBuilder.js +12 -5
- package/lib/core/inference/Inference.d.ts.map +1 -1
- package/lib/core/inference/Inference.js +7 -0
- package/lib/core/inference/ModelInference.d.ts +1 -1
- package/lib/core/inference/ModelInference.d.ts.map +1 -1
- package/lib/core/inference/ValueInference.d.ts +3 -2
- package/lib/core/inference/ValueInference.d.ts.map +1 -1
- package/lib/core/inference/ValueInference.js +64 -12
- package/lib/core/inference/abc/AbcInference.d.ts +28 -2
- package/lib/core/inference/abc/AbcInference.d.ts.map +1 -1
- package/lib/core/inference/abc/AbcInference.js +105 -4
- package/lib/core/model/ArkBaseModel.d.ts +14 -1
- package/lib/core/model/ArkBaseModel.d.ts.map +1 -1
- package/lib/core/model/ArkBaseModel.js +61 -2
- package/lib/core/model/ArkBody.d.ts.map +1 -1
- package/lib/core/model/ArkBody.js +1 -3
- package/lib/core/model/ArkClass.d.ts +22 -2
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +59 -28
- package/lib/core/model/ArkField.d.ts.map +1 -1
- package/lib/core/model/ArkField.js +3 -1
- package/lib/core/model/ArkFile.d.ts +4 -1
- package/lib/core/model/ArkFile.d.ts.map +1 -1
- package/lib/core/model/ArkFile.js +44 -3
- package/lib/core/model/ArkImport.d.ts.map +1 -1
- package/lib/core/model/ArkImport.js +9 -1
- package/lib/core/model/ArkMethod.d.ts +5 -0
- package/lib/core/model/ArkMethod.d.ts.map +1 -1
- package/lib/core/model/ArkMethod.js +33 -1
- package/lib/core/model/ArkNamespace.d.ts +2 -0
- package/lib/core/model/ArkNamespace.d.ts.map +1 -1
- package/lib/core/model/ArkNamespace.js +11 -0
- package/lib/core/model/ArkSignature.d.ts +3 -3
- package/lib/core/model/ArkSignature.d.ts.map +1 -1
- package/lib/core/model/ArkSignature.js +14 -9
- package/lib/core/model/builder/ArkClassBuilder.d.ts +2 -0
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +3 -3
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +4 -1
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +19 -6
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts +1 -0
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkNamespaceBuilder.js +2 -1
- package/lib/core/model/builder/BodyBuilder.d.ts +4 -0
- package/lib/core/model/builder/BodyBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.d.ts +1 -0
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.js +7 -3
- package/lib/frontend/cppFrontend/ast/ArkCxxAstNode.d.ts +296 -0
- package/lib/frontend/cppFrontend/ast/ArkCxxAstNode.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/ArkCxxAstNode.js +145 -0
- package/lib/frontend/cppFrontend/ast/astUtils.d.ts +51 -0
- package/lib/frontend/cppFrontend/ast/astUtils.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/astUtils.js +470 -0
- package/lib/frontend/cppFrontend/ast/const.d.ts +30 -0
- package/lib/frontend/cppFrontend/ast/const.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/const.js +134 -0
- package/lib/frontend/cppFrontend/base/Constant.d.ts +9 -0
- package/lib/frontend/cppFrontend/base/Constant.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/base/Constant.js +33 -0
- package/lib/frontend/cppFrontend/base/Expr.d.ts +174 -0
- package/lib/frontend/cppFrontend/base/Expr.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/base/Expr.js +530 -0
- package/lib/frontend/cppFrontend/base/Ref.d.ts +25 -0
- package/lib/frontend/cppFrontend/base/Ref.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/base/Ref.js +53 -0
- package/lib/frontend/cppFrontend/base/Trap.d.ts +8 -0
- package/lib/frontend/cppFrontend/base/Trap.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/base/Trap.js +28 -0
- package/lib/frontend/cppFrontend/base/Type.d.ts +264 -0
- package/lib/frontend/cppFrontend/base/Type.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/base/Type.js +600 -0
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.d.ts +109 -0
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.js +925 -0
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts +477 -0
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.js +2746 -0
- package/lib/frontend/cppFrontend/common/Builtin.d.ts +57 -0
- package/lib/frontend/cppFrontend/common/Builtin.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/common/Builtin.js +106 -0
- package/lib/frontend/cppFrontend/common/IRInference.d.ts +94 -0
- package/lib/frontend/cppFrontend/common/IRInference.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/common/IRInference.js +1087 -0
- package/lib/frontend/cppFrontend/common/IRUtils.d.ts +23 -0
- package/lib/frontend/cppFrontend/common/IRUtils.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/common/IRUtils.js +168 -0
- package/lib/frontend/cppFrontend/common/ModelUtils.d.ts +44 -0
- package/lib/frontend/cppFrontend/common/ModelUtils.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/common/ModelUtils.js +567 -0
- package/lib/frontend/cppFrontend/common/TypeInference.d.ts +278 -0
- package/lib/frontend/cppFrontend/common/TypeInference.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/common/TypeInference.js +1354 -0
- package/lib/frontend/cppFrontend/common/ValueUtil.d.ts +16 -0
- package/lib/frontend/cppFrontend/common/ValueUtil.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/common/ValueUtil.js +61 -0
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.d.ts +182 -0
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.js +1435 -0
- package/lib/frontend/cppFrontend/graph/builder/ConditionBuilder.d.ts +21 -0
- package/lib/frontend/cppFrontend/graph/builder/ConditionBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/graph/builder/ConditionBuilder.js +303 -0
- package/lib/frontend/cppFrontend/graph/builder/IfBuilder.d.ts +15 -0
- package/lib/frontend/cppFrontend/graph/builder/IfBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/graph/builder/IfBuilder.js +161 -0
- package/lib/frontend/cppFrontend/graph/builder/LoopBuilder.d.ts +21 -0
- package/lib/frontend/cppFrontend/graph/builder/LoopBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/graph/builder/LoopBuilder.js +261 -0
- package/lib/frontend/cppFrontend/graph/builder/SwitchBuilder.d.ts +12 -0
- package/lib/frontend/cppFrontend/graph/builder/SwitchBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/graph/builder/SwitchBuilder.js +155 -0
- package/lib/frontend/cppFrontend/graph/builder/TrapBuilder.d.ts +29 -0
- package/lib/frontend/cppFrontend/graph/builder/TrapBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/graph/builder/TrapBuilder.js +302 -0
- package/lib/frontend/cppFrontend/inference/CxxInference.d.ts +10 -0
- package/lib/frontend/cppFrontend/inference/CxxInference.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/inference/CxxInference.js +41 -0
- package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts +28 -0
- package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/inference/CxxModelInference.js +98 -0
- package/lib/frontend/cppFrontend/inference/CxxValueInference.d.ts +20 -0
- package/lib/frontend/cppFrontend/inference/CxxValueInference.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/inference/CxxValueInference.js +128 -0
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.d.ts +11 -0
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.js +413 -0
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.d.ts +5 -0
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.js +61 -0
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts +17 -0
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.js +285 -0
- package/lib/frontend/cppFrontend/model/builder/ArkImportBuilder.d.ts +6 -0
- package/lib/frontend/cppFrontend/model/builder/ArkImportBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/model/builder/ArkImportBuilder.js +57 -0
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.d.ts +14 -0
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.js +422 -0
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts +8 -0
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.js +194 -0
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts +59 -0
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.js +605 -0
- package/lib/frontend/cppFrontend/model/builder/builderUtils.d.ts +46 -0
- package/lib/frontend/cppFrontend/model/builder/builderUtils.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/model/builder/builderUtils.js +499 -0
- package/lib/frontend/cppFrontend/utils/cmakeUtils.d.ts +44 -0
- package/lib/frontend/cppFrontend/utils/cmakeUtils.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/utils/cmakeUtils.js +240 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/node_modules/ohos-typescript/.ohos-typescript-version +1 -0
- package/{node_modules → lib/node_modules}/ohos-typescript/package.json +2 -1
- package/lib/save/CGJsonPrinter.d.ts +8 -0
- package/lib/save/CGJsonPrinter.d.ts.map +1 -0
- package/lib/save/CGJsonPrinter.js +41 -0
- package/lib/save/GraphPrinter.js +2 -2
- package/lib/save/json/JsonDto.d.ts +86 -2
- package/lib/save/json/JsonDto.d.ts.map +1 -1
- package/lib/save/json/JsonSerialization.d.ts +1 -1
- package/lib/save/json/JsonSerialization.d.ts.map +1 -1
- package/lib/save/json/JsonSerialization.js +235 -145
- package/lib/save/source/SourceTransformer.d.ts.map +1 -1
- package/lib/save/source/SourceTransformer.js +0 -3
- package/lib/utils/CxxSceneUtils.d.ts +11 -0
- package/lib/utils/CxxSceneUtils.d.ts.map +1 -0
- package/lib/utils/CxxSceneUtils.js +178 -0
- package/lib/utils/FileUtils.d.ts +7 -8
- package/lib/utils/FileUtils.d.ts.map +1 -1
- package/lib/utils/FileUtils.js +27 -45
- package/lib/utils/LRUCacheDecorator.d.ts +20 -0
- package/lib/utils/LRUCacheDecorator.d.ts.map +1 -0
- package/lib/utils/LRUCacheDecorator.js +89 -0
- package/lib/utils/ModuleUtils.d.ts +39 -0
- package/lib/utils/ModuleUtils.d.ts.map +1 -0
- package/lib/utils/ModuleUtils.js +261 -0
- package/package.json +15 -12
- /package/{node_modules → lib/node_modules}/ohos-typescript/LICENSE +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/README.OpenSource +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/README.md +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/SECURITY.md +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/ThirdPartyNoticeText.txt +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/bin/tsc +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/bin/tsserver +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/README.md +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/cancellationToken.js +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/cs/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/de/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/es/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/fr/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/it/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/ja/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/ko/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.dom.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.dom.iterable.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.collection.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.core.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.generator.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.iterable.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.promise.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.proxy.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.reflect.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.symbol.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2015.symbol.wellknown.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2016.array.include.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2016.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2016.full.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2017.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2017.full.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2017.intl.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2017.object.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2017.sharedmemory.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2017.string.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2017.typedarrays.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2018.asyncgenerator.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2018.asynciterable.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2018.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2018.full.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2018.intl.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2018.promise.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2018.regexp.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2019.array.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2019.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2019.full.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2019.intl.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2019.object.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2019.string.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2019.symbol.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.bigint.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.date.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.full.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.intl.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.number.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.promise.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.sharedmemory.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.string.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2020.symbol.wellknown.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2021.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2021.full.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2021.intl.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2021.promise.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2021.string.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2021.weakref.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2022.array.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2022.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2022.error.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2022.full.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2022.intl.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2022.object.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2022.sharedmemory.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es2022.string.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es5.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.es6.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.esnext.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.esnext.full.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.esnext.intl.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.scripthost.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.webworker.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.webworker.importscripts.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/lib.webworker.iterable.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/pl/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/pt-br/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/ru/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/tr/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/tsc.js +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/tsserver.js +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/tsserverlibrary.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/tsserverlibrary.js +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/typesMap.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/typescript.d.ts +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/typescript.js +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/typingsInstaller.js +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/watchGuard.js +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -0
- /package/{node_modules → lib/node_modules}/ohos-typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -0
|
@@ -40,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
41
|
};
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.
|
|
43
|
+
exports.findExportInfoInfile = exports.findArkExportInFile = exports.findArkExport = exports.findExportInfo = exports.getArkFile = exports.ModelUtils = void 0;
|
|
44
44
|
const Local_1 = require("../base/Local");
|
|
45
45
|
const ArkClass_1 = require("../model/ArkClass");
|
|
46
46
|
const ArkFile_1 = require("../model/ArkFile");
|
|
@@ -50,7 +50,6 @@ const ArkSignature_1 = require("../model/ArkSignature");
|
|
|
50
50
|
const ArkExport_1 = require("../model/ArkExport");
|
|
51
51
|
const ArkField_1 = require("../model/ArkField");
|
|
52
52
|
const logger_1 = __importStar(require("../../utils/logger"));
|
|
53
|
-
const FileUtils_1 = require("../../utils/FileUtils");
|
|
54
53
|
const path_1 = __importDefault(require("path"));
|
|
55
54
|
const TSConst_1 = require("./TSConst");
|
|
56
55
|
const ArkExportBuilder_1 = require("../model/builder/ArkExportBuilder");
|
|
@@ -64,6 +63,7 @@ const TypeInference_1 = require("./TypeInference");
|
|
|
64
63
|
const Constant_1 = require("../base/Constant");
|
|
65
64
|
const Builtin_1 = require("./Builtin");
|
|
66
65
|
const EtsConst_1 = require("./EtsConst");
|
|
66
|
+
const ModuleUtils_1 = require("../../utils/ModuleUtils");
|
|
67
67
|
class ModelUtils {
|
|
68
68
|
/*
|
|
69
69
|
* Set static field to be null, then all related objects could be freed by GC.
|
|
@@ -572,9 +572,9 @@ class ModelUtils {
|
|
|
572
572
|
static matchType(paramType, argType, arg, scene) {
|
|
573
573
|
var _a, _b;
|
|
574
574
|
if (paramType instanceof Type_1.LiteralType) {
|
|
575
|
-
const argStr = arg instanceof Constant_1.Constant ? arg.getValue() : argType.
|
|
575
|
+
const argStr = arg instanceof Constant_1.Constant ? arg.getValue() : argType.toString();
|
|
576
576
|
return argStr.replace(/[\"|\']/g, '') ===
|
|
577
|
-
paramType.
|
|
577
|
+
paramType.toString().replace(/[\"|\']/g, '');
|
|
578
578
|
}
|
|
579
579
|
else if (paramType instanceof Type_1.ClassType && argType instanceof Type_1.EnumValueType) {
|
|
580
580
|
return paramType.getClassSignature() === argType.getFieldSignature().getDeclaringSignature();
|
|
@@ -651,7 +651,6 @@ exports.ModelUtils = ModelUtils;
|
|
|
651
651
|
ModelUtils.implicitArkUIBuilderMethods = new Set();
|
|
652
652
|
ModelUtils.popMethodSignatureCache = new Map();
|
|
653
653
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ModelUtils');
|
|
654
|
-
let moduleMap;
|
|
655
654
|
/**
|
|
656
655
|
* find arkFile by from info
|
|
657
656
|
* export xx from '../xx'
|
|
@@ -660,31 +659,39 @@ let moduleMap;
|
|
|
660
659
|
* @param im importInfo or exportInfo
|
|
661
660
|
*/
|
|
662
661
|
function getArkFile(im) {
|
|
662
|
+
var _a;
|
|
663
663
|
const from = im.getFrom();
|
|
664
664
|
if (!from) {
|
|
665
665
|
return null;
|
|
666
666
|
}
|
|
667
|
-
if (
|
|
667
|
+
if (/^\.\.?\/|^\.$/.test(from)) {
|
|
668
668
|
//relative path
|
|
669
|
-
|
|
670
|
-
const originPath = path_1.default.resolve(parentPath, from);
|
|
671
|
-
return getArkFileFromScene(im, originPath);
|
|
669
|
+
return getArkFileFromScene(im, path_1.default.resolve(path_1.default.dirname(im.getDeclaringArkFile().getFilePath()), from));
|
|
672
670
|
}
|
|
673
|
-
else if ((
|
|
674
|
-
//
|
|
675
|
-
const
|
|
671
|
+
else if (from.startsWith(EtsConst_1.ETS_CODE_PATH)) {
|
|
672
|
+
//relative path
|
|
673
|
+
const curPath = im.getDeclaringArkFile().getFilePath();
|
|
674
|
+
return getArkFileFromScene(im, path_1.default.resolve(curPath.substring(0, curPath.lastIndexOf(path_1.default.sep + EtsConst_1.ETS_PATH + path_1.default.sep)), from));
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
//module path or sdk path
|
|
678
|
+
const arkFile = (_a = getArkFileFromOtherModule(im)) !== null && _a !== void 0 ? _a : SdkUtils_1.SdkUtils.getImportSdkFile(from);
|
|
676
679
|
if (arkFile) {
|
|
677
680
|
return arkFile;
|
|
678
681
|
}
|
|
679
682
|
}
|
|
680
|
-
//
|
|
681
|
-
const file = SdkUtils_1.SdkUtils.getImportSdkFile(from);
|
|
682
|
-
if (file) {
|
|
683
|
-
return file;
|
|
684
|
-
}
|
|
683
|
+
// ohos common module
|
|
685
684
|
const scene = im.getDeclaringArkFile().getScene();
|
|
686
|
-
|
|
687
|
-
|
|
685
|
+
const module = scene.getSdkGlobal(from);
|
|
686
|
+
if (module instanceof ArkNamespace_1.ArkNamespace) {
|
|
687
|
+
return module.getDeclaringArkFile();
|
|
688
|
+
}
|
|
689
|
+
// custom sdk
|
|
690
|
+
let sdks = Array.from(scene.getProjectSdkMap().values());
|
|
691
|
+
const len = sdks.length > EtsConst_1.DEFAULT_SDK_NUMS ? EtsConst_1.DEFAULT_SDK_NUMS : sdks.length - 1;
|
|
692
|
+
sdks = sdks.slice(len);
|
|
693
|
+
for (const sdk of sdks) {
|
|
694
|
+
const arkFile = getArkFileFormSDK(sdk, from, scene);
|
|
688
695
|
if (arkFile) {
|
|
689
696
|
return arkFile;
|
|
690
697
|
}
|
|
@@ -713,15 +720,20 @@ function findExportInfo(fromInfo, visited = new Set([fromInfo.getDeclaringArkFil
|
|
|
713
720
|
if (exportInfo === null) {
|
|
714
721
|
return null;
|
|
715
722
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
723
|
+
if (!exportInfo.getArkExport()) {
|
|
724
|
+
const arkExport = findArkExport(exportInfo, visited);
|
|
725
|
+
if (arkExport) {
|
|
726
|
+
exportInfo.setArkExport(arkExport);
|
|
727
|
+
exportInfo.setExportClauseType(arkExport.getExportType());
|
|
728
|
+
}
|
|
729
|
+
else if (file.getScene().getBuildStage() > 5) {
|
|
730
|
+
exportInfo.setArkExport(arkExport);
|
|
731
|
+
}
|
|
720
732
|
}
|
|
721
733
|
return exportInfo;
|
|
722
734
|
}
|
|
723
735
|
exports.findExportInfo = findExportInfo;
|
|
724
|
-
function findArkExport(exportInfo) {
|
|
736
|
+
function findArkExport(exportInfo, visited = new Set()) {
|
|
725
737
|
var _a, _b, _c, _d, _e, _f;
|
|
726
738
|
if (!exportInfo) {
|
|
727
739
|
return null;
|
|
@@ -730,9 +742,11 @@ function findArkExport(exportInfo) {
|
|
|
730
742
|
if (arkExport || arkExport === null) {
|
|
731
743
|
return arkExport;
|
|
732
744
|
}
|
|
745
|
+
const declaringFile = exportInfo.getDeclaringArkFile();
|
|
746
|
+
const effectiveVisited = visited.size > 0 ? visited : new Set([declaringFile]);
|
|
733
747
|
if (!exportInfo.getFrom()) {
|
|
734
748
|
const name = exportInfo.getOriginName();
|
|
735
|
-
const defaultClass = (_b = (_a = exportInfo.getDeclaringArkNamespace()) === null || _a === void 0 ? void 0 : _a.getDefaultClass()) !== null && _b !== void 0 ? _b :
|
|
749
|
+
const defaultClass = (_b = (_a = exportInfo.getDeclaringArkNamespace()) === null || _a === void 0 ? void 0 : _a.getDefaultClass()) !== null && _b !== void 0 ? _b : declaringFile.getDefaultClass();
|
|
736
750
|
if (exportInfo.getExportClauseType() === ArkExport_1.ExportType.LOCAL) {
|
|
737
751
|
arkExport = (_d = (_c = defaultClass.getDefaultArkMethod()) === null || _c === void 0 ? void 0 : _c.getBody()) === null || _d === void 0 ? void 0 : _d.getExportLocalByName(name);
|
|
738
752
|
}
|
|
@@ -740,11 +754,11 @@ function findArkExport(exportInfo) {
|
|
|
740
754
|
arkExport = (_f = (_e = defaultClass.getDefaultArkMethod()) === null || _e === void 0 ? void 0 : _e.getBody()) === null || _f === void 0 ? void 0 : _f.getAliasTypeByName(name);
|
|
741
755
|
}
|
|
742
756
|
else {
|
|
743
|
-
arkExport = findArkExportInFile(name,
|
|
757
|
+
arkExport = findArkExportInFile(name, declaringFile, effectiveVisited);
|
|
744
758
|
}
|
|
745
759
|
}
|
|
746
760
|
else if (exportInfo.getExportClauseType() === ArkExport_1.ExportType.UNKNOWN) {
|
|
747
|
-
const result = findExportInfo(exportInfo);
|
|
761
|
+
const result = findExportInfo(exportInfo, effectiveVisited);
|
|
748
762
|
if (result) {
|
|
749
763
|
arkExport = result.getArkExport() || null;
|
|
750
764
|
}
|
|
@@ -759,13 +773,13 @@ function findArkExport(exportInfo) {
|
|
|
759
773
|
return arkExport || null;
|
|
760
774
|
}
|
|
761
775
|
exports.findArkExport = findArkExport;
|
|
762
|
-
function findArkExportInFile(name, declaringArkFile) {
|
|
776
|
+
function findArkExportInFile(name, declaringArkFile, visited = new Set([declaringArkFile])) {
|
|
763
777
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
764
778
|
let arkExport = (_f = (_e = (_d = (_a = declaringArkFile.getNamespaceWithName(name)) !== null && _a !== void 0 ? _a : (_c = (_b = declaringArkFile.getDefaultClass().getDefaultArkMethod()) === null || _b === void 0 ? void 0 : _b.getBody()) === null || _c === void 0 ? void 0 : _c.getAliasTypeByName(name)) !== null && _d !== void 0 ? _d : declaringArkFile.getClassWithName(name)) !== null && _e !== void 0 ? _e : declaringArkFile.getDefaultClass().getMethodWithName(name)) !== null && _f !== void 0 ? _f : (_h = (_g = declaringArkFile.getDefaultClass().getDefaultArkMethod()) === null || _g === void 0 ? void 0 : _g.getBody()) === null || _h === void 0 ? void 0 : _h.getExportLocalByName(name);
|
|
765
779
|
if (!arkExport) {
|
|
766
780
|
const importInfo = declaringArkFile.getImportInfoBy(name);
|
|
767
781
|
if (importInfo) {
|
|
768
|
-
const result = findExportInfo(importInfo);
|
|
782
|
+
const result = findExportInfo(importInfo, visited);
|
|
769
783
|
if (result) {
|
|
770
784
|
arkExport = result.getArkExport();
|
|
771
785
|
}
|
|
@@ -774,41 +788,20 @@ function findArkExportInFile(name, declaringArkFile) {
|
|
|
774
788
|
return arkExport || null;
|
|
775
789
|
}
|
|
776
790
|
exports.findArkExportInFile = findArkExportInFile;
|
|
777
|
-
function processSdkPath(sdk, formPath) {
|
|
778
|
-
let originPath = path_1.default.join(sdk.path, formPath);
|
|
779
|
-
if (FileUtils_1.FileUtils.isDirectory(originPath)) {
|
|
780
|
-
formPath = path_1.default.join(formPath, FileUtils_1.FileUtils.getIndexFileName(originPath));
|
|
781
|
-
}
|
|
782
|
-
return `${formPath}`;
|
|
783
|
-
}
|
|
784
791
|
function getArkFileFromScene(im, originPath) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
const fileName = path_1.default.relative(im.getDeclaringArkFile().getProjectDir(), originPath);
|
|
792
|
+
const realPath = ModuleUtils_1.ModuleUtils.getFileRealPath(originPath);
|
|
793
|
+
const fileName = path_1.default.relative(im.getDeclaringArkFile().getProjectDir(), realPath);
|
|
794
|
+
const fromSignature = new ArkSignature_1.FileSignature(im.getDeclaringArkFile().getProjectName(), fileName);
|
|
789
795
|
const scene = im.getDeclaringArkFile().getScene();
|
|
790
|
-
|
|
791
|
-
const fromSignature = new ArkSignature_1.FileSignature(im.getDeclaringArkFile().getProjectName(), fileName);
|
|
792
|
-
return scene.getFile(fromSignature);
|
|
793
|
-
}
|
|
794
|
-
const projectName = im.getDeclaringArkFile().getProjectName();
|
|
795
|
-
return getArkFileFormMap(projectName, fileName, scene);
|
|
796
|
+
return scene.getFile(fromSignature);
|
|
796
797
|
}
|
|
797
|
-
function
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
}
|
|
801
|
-
const fileSuffixArray = scene.getOptions().supportFileExts;
|
|
802
|
-
if (!fileSuffixArray) {
|
|
798
|
+
function getArkFileFormSDK(sdk, from, scene) {
|
|
799
|
+
const realPath = ModuleUtils_1.ModuleUtils.getFileRealPath(path_1.default.resolve(sdk.path, from));
|
|
800
|
+
if (!realPath) {
|
|
803
801
|
return null;
|
|
804
802
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
if (arkFile) {
|
|
808
|
-
return arkFile;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
return null;
|
|
803
|
+
const fromSignature = new ArkSignature_1.FileSignature(sdk.name, path_1.default.relative(sdk.path, realPath));
|
|
804
|
+
return scene.getFile(fromSignature);
|
|
812
805
|
}
|
|
813
806
|
function findExportInfoInfile(fromInfo, file, visited = new Set([fromInfo.getDeclaringArkFile()])) {
|
|
814
807
|
//check cycle
|
|
@@ -824,13 +817,25 @@ function findExportInfoInfile(fromInfo, file, visited = new Set([fromInfo.getDec
|
|
|
824
817
|
if (fromInfo.getOriginName().startsWith(TSConst_1.TEMP_EXPORT_ALL_PREFIX) && fromInfo instanceof ArkExport_1.ExportInfo) {
|
|
825
818
|
const declaringArkFile = fromInfo.getDeclaringArkFile();
|
|
826
819
|
file.getExportInfos().filter(f => !f.isDefault() && !f.getExportClauseName().startsWith(TSConst_1.TEMP_EXPORT_ALL_PREFIX))
|
|
827
|
-
.forEach(exportInfo =>
|
|
820
|
+
.forEach(exportInfo => {
|
|
821
|
+
const existing = declaringArkFile.getExportInfoBy(exportInfo.getExportClauseName());
|
|
822
|
+
if (!existing || existing.getFrom()) {
|
|
823
|
+
declaringArkFile.addExportInfo(exportInfo);
|
|
824
|
+
}
|
|
825
|
+
});
|
|
828
826
|
declaringArkFile.removeExportInfo(fromInfo);
|
|
829
827
|
return undefined;
|
|
830
828
|
}
|
|
831
829
|
const exportName = fromInfo.isDefault() ? TSConst_1.DEFAULT : fromInfo.getOriginName();
|
|
832
830
|
let exportInfo = file.getExportInfoBy(exportName);
|
|
833
831
|
if (exportInfo) {
|
|
832
|
+
// Re-export with target already in visited indicates a cycle; return undefined to avoid stack overflow
|
|
833
|
+
if (exportInfo.getFrom()) {
|
|
834
|
+
const targetFile = getArkFile(exportInfo);
|
|
835
|
+
if (targetFile && visited.has(targetFile)) {
|
|
836
|
+
return undefined;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
834
839
|
return exportInfo;
|
|
835
840
|
}
|
|
836
841
|
if (exportName === TSConst_1.DEFAULT) {
|
|
@@ -845,64 +850,26 @@ function findExportInfoInfile(fromInfo, file, visited = new Set([fromInfo.getDec
|
|
|
845
850
|
file.addExportInfo(exportInfo, TSConst_1.ALL);
|
|
846
851
|
}
|
|
847
852
|
else if (/\.d\.e?ts$/.test(file.getName())) {
|
|
848
|
-
let declare = exportName === TSConst_1.DEFAULT ? undefined : findArkExportInFile(fromInfo.getOriginName(), file) || undefined;
|
|
853
|
+
let declare = exportName === TSConst_1.DEFAULT ? undefined : findArkExportInFile(fromInfo.getOriginName(), file, visited) || undefined;
|
|
849
854
|
exportInfo = (0, ArkExportBuilder_1.buildDefaultExportInfo)(fromInfo, file, declare);
|
|
850
855
|
}
|
|
851
856
|
return exportInfo;
|
|
852
857
|
}
|
|
853
858
|
exports.findExportInfoInfile = findExportInfoInfile;
|
|
854
|
-
function initModulePathMap(ohPkgContentMap) {
|
|
855
|
-
if (moduleMap) {
|
|
856
|
-
moduleMap.clear();
|
|
857
|
-
}
|
|
858
|
-
moduleMap = FileUtils_1.FileUtils.generateModuleMap(ohPkgContentMap);
|
|
859
|
-
}
|
|
860
|
-
exports.initModulePathMap = initModulePathMap;
|
|
861
859
|
function getArkFileFromOtherModule(fromInfo) {
|
|
862
|
-
if (!moduleMap || moduleMap.size === 0) {
|
|
863
|
-
return undefined;
|
|
864
|
-
}
|
|
865
860
|
const from = fromInfo.getFrom();
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
let modulePath;
|
|
869
|
-
//find file by given from like '@ohos/module/src/xxx' '@ohos/module/index'
|
|
870
|
-
if ((index = from.indexOf('src')) > 0 || (index = from.indexOf('Index')) > 0 || (index = from.indexOf('index')) > 0) {
|
|
871
|
-
modulePath = moduleMap.get(from.substring(0, index).replace(/\/*$/, ''));
|
|
872
|
-
file = findFileInModule(fromInfo, modulePath, from.substring(index));
|
|
873
|
-
}
|
|
874
|
-
if (file) {
|
|
875
|
-
return file;
|
|
876
|
-
}
|
|
877
|
-
modulePath = modulePath !== null && modulePath !== void 0 ? modulePath : moduleMap.get(from);
|
|
878
|
-
if (!modulePath) {
|
|
879
|
-
return file;
|
|
880
|
-
}
|
|
881
|
-
//find file in module json main path
|
|
882
|
-
if (modulePath.main) {
|
|
883
|
-
file = getArkFileFromScene(fromInfo, modulePath.main);
|
|
884
|
-
}
|
|
885
|
-
//find file in module path Index.ts
|
|
886
|
-
if (!file && FileUtils_1.FileUtils.isDirectory(modulePath.path)) {
|
|
887
|
-
file = findFileInModule(fromInfo, modulePath, FileUtils_1.FileUtils.getIndexFileName(modulePath.path));
|
|
888
|
-
}
|
|
889
|
-
//find file in module path/src/main/ets/TsIndex.ts
|
|
890
|
-
if (!file) {
|
|
891
|
-
file = findFileInModule(fromInfo, modulePath, '/src/main/ets/TsIndex.ts');
|
|
861
|
+
if (!from || ModuleUtils_1.ModuleUtils.MODULES.size === 0) {
|
|
862
|
+
return null;
|
|
892
863
|
}
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
864
|
+
//find file by given from like '@ohos/module/src/xxx' 'module/src/xxx'
|
|
865
|
+
const parts = from.split(EtsConst_1.PATH_DELIMITER);
|
|
866
|
+
const candidate = from.startsWith(EtsConst_1.SCOPE_PREFIX) ? parts.slice(0, 2).join(EtsConst_1.PATH_DELIMITER) : parts[0];
|
|
867
|
+
const modulePath = ModuleUtils_1.ModuleUtils.MODULES.get(candidate);
|
|
896
868
|
if (!modulePath) {
|
|
897
|
-
return
|
|
898
|
-
}
|
|
899
|
-
const originPath = path_1.default.join(modulePath.path, contentPath);
|
|
900
|
-
let file;
|
|
901
|
-
if (originPath !== modulePath.main) {
|
|
902
|
-
file = getArkFileFromScene(fromInfo, originPath);
|
|
903
|
-
}
|
|
904
|
-
if (file && findExportInfoInfile(fromInfo, file)) {
|
|
905
|
-
return file;
|
|
869
|
+
return null;
|
|
906
870
|
}
|
|
907
|
-
|
|
871
|
+
const suffix = from.substring(candidate.length + 1).trim();
|
|
872
|
+
const middle = suffix.startsWith(EtsConst_1.ETS_CODE_PATH) ? EtsConst_1.PATH_BE_OMITTED : '';
|
|
873
|
+
const filePath = suffix.length > 1 ? path_1.default.join(modulePath.path, middle, suffix) : modulePath.main;
|
|
874
|
+
return getArkFileFromScene(fromInfo, filePath);
|
|
908
875
|
}
|
|
@@ -10,7 +10,7 @@ export declare class SdkUtils {
|
|
|
10
10
|
private static esVersionMap;
|
|
11
11
|
private static sdkImportMap;
|
|
12
12
|
static BUILT_IN_NAME: string;
|
|
13
|
-
private static
|
|
13
|
+
private static BUILT_IN_PATHS;
|
|
14
14
|
static setEsVersion(buildProfile: any): void;
|
|
15
15
|
static getBuiltInSdk(): Sdk;
|
|
16
16
|
static fetchBuiltInFiles(builtInPath: string): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SdkUtils.d.ts","sourceRoot":"","sources":["../../../src/core/common/SdkUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAI3D,OAAO,EAAE,QAAQ,EAAiB,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC,qBAAa,QAAQ;IACjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAoB;IAC5C,OAAO,CAAC,MAAM,CAAC,YAAY,CAGxB;IAEH,OAAO,CAAC,MAAM,CAAC,YAAY,CAAoD;IAC/E,OAAc,aAAa,SAAc;IACzC,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"SdkUtils.d.ts","sourceRoot":"","sources":["../../../src/core/common/SdkUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAI3D,OAAO,EAAE,QAAQ,EAAiB,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,gBAA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M,CAAC,eAAe;WA0BhB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,GAAG,IAAI;WAqB/C,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;WAWvE,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAWhD"}
|
|
@@ -65,15 +65,18 @@ class SdkUtils {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
static getBuiltInSdk() {
|
|
68
|
+
var _a, _b;
|
|
68
69
|
let builtInPath;
|
|
69
70
|
try {
|
|
70
71
|
// If arkanalyzer is used as dependency by other project, the base directory should be the module path.
|
|
71
72
|
const moduleRoot = path_1.default.dirname(path_1.default.dirname(require.resolve('arkanalyzer')));
|
|
72
|
-
|
|
73
|
+
const candidatePaths = this.BUILT_IN_PATHS.map(item => path_1.default.join(moduleRoot, item));
|
|
74
|
+
builtInPath = (_a = candidatePaths.find(item => fs_1.default.existsSync(item))) !== null && _a !== void 0 ? _a : candidatePaths[0];
|
|
73
75
|
logger.debug(`arkanalyzer is used as dependency, so using builtin sdk file in ${builtInPath}.`);
|
|
74
76
|
}
|
|
75
|
-
catch (
|
|
76
|
-
|
|
77
|
+
catch (_c) {
|
|
78
|
+
const candidatePaths = this.BUILT_IN_PATHS.map(item => path_1.default.resolve(item));
|
|
79
|
+
builtInPath = (_b = candidatePaths.find(item => fs_1.default.existsSync(item))) !== null && _b !== void 0 ? _b : candidatePaths[0];
|
|
77
80
|
logger.debug(`use builtin sdk file in ${builtInPath}.`);
|
|
78
81
|
}
|
|
79
82
|
return {
|
|
@@ -110,9 +113,12 @@ class SdkUtils {
|
|
|
110
113
|
}
|
|
111
114
|
static buildSdkImportMap(file) {
|
|
112
115
|
const fileName = path_1.default.basename(file.getName());
|
|
113
|
-
if (fileName.startsWith(
|
|
116
|
+
if (fileName.startsWith(EtsConst_1.SCOPE_PREFIX)) {
|
|
114
117
|
this.sdkImportMap.set(fileName.replace(/\.d\.e?ts$/, ''), file);
|
|
115
118
|
}
|
|
119
|
+
else if (file.getName().startsWith('api')) {
|
|
120
|
+
this.sdkImportMap.set(file.getName().replace('api', '').replace(/\.d\.e?ts$/, ''), file);
|
|
121
|
+
}
|
|
116
122
|
}
|
|
117
123
|
static getImportSdkFile(from) {
|
|
118
124
|
return this.sdkImportMap.get(from);
|
|
@@ -298,4 +304,7 @@ SdkUtils.esVersionMap = new Map([
|
|
|
298
304
|
]);
|
|
299
305
|
SdkUtils.sdkImportMap = new Map();
|
|
300
306
|
SdkUtils.BUILT_IN_NAME = 'built-in';
|
|
301
|
-
SdkUtils.
|
|
307
|
+
SdkUtils.BUILT_IN_PATHS = [
|
|
308
|
+
'lib/node_modules/ohos-typescript/lib',
|
|
309
|
+
'node_modules/ohos-typescript/lib',
|
|
310
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeInference.d.ts","sourceRoot":"","sources":["../../../src/core/common/TypeInference.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAUtC,OAAO,EAAwD,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAQH,aAAa,EACb,YAAY,EACZ,WAAW,EAOX,IAAI,EACJ,oBAAoB,EAKvB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"TypeInference.d.ts","sourceRoot":"","sources":["../../../src/core/common/TypeInference.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAUtC,OAAO,EAAwD,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAQH,aAAa,EACb,YAAY,EACZ,WAAW,EAOX,IAAI,EACJ,oBAAoB,EAKvB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CA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G,OAAO;WAO1C,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;WAcxC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI;WAuBrC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO;CAY9D"}
|
|
@@ -44,6 +44,7 @@ const Local_1 = require("../base/Local");
|
|
|
44
44
|
const Ref_1 = require("../base/Ref");
|
|
45
45
|
const Stmt_1 = require("../base/Stmt");
|
|
46
46
|
const Type_1 = require("../base/Type");
|
|
47
|
+
const Type_2 = require("../../frontend/cppFrontend/base/Type");
|
|
47
48
|
const ArkMethod_1 = require("../model/ArkMethod");
|
|
48
49
|
const ArkClass_1 = require("../model/ArkClass");
|
|
49
50
|
const ArkField_1 = require("../model/ArkField");
|
|
@@ -487,6 +488,9 @@ class TypeInference {
|
|
|
487
488
|
return this.isUnclearType(type.getType()) ||
|
|
488
489
|
!!((_a = type.getGenerateTypes()) === null || _a === void 0 ? void 0 : _a.find(t => this.checkType(t, e => e instanceof Type_1.UnclearReferenceType || e instanceof Type_1.GenericType)));
|
|
489
490
|
}
|
|
491
|
+
else if (type instanceof Type_2.PointerType || type instanceof Type_2.ReferenceType) {
|
|
492
|
+
return this.isUnclearType(type.getBaseType());
|
|
493
|
+
}
|
|
490
494
|
return false;
|
|
491
495
|
}
|
|
492
496
|
// This is the temporal function to check Type recursively and can be removed after typeInfer supports multiple candidate types.
|
|
@@ -632,7 +636,9 @@ class TypeInference {
|
|
|
632
636
|
else {
|
|
633
637
|
returnType = Type_1.VoidType.getInstance();
|
|
634
638
|
}
|
|
635
|
-
|
|
639
|
+
// If the method is async and the return type is not Promise, wrap it with Promise
|
|
640
|
+
if (arkMethod.containsModifier(ArkBaseModel_1.ModifierType.ASYNC) && (!(returnType instanceof Type_1.ClassType) ||
|
|
641
|
+
returnType.getClassSignature().getClassName() !== TSConst_1.PROMISE)) {
|
|
636
642
|
const promise = arkMethod.getDeclaringArkFile().getScene().getSdkGlobal(TSConst_1.PROMISE);
|
|
637
643
|
if (promise instanceof ArkClass_1.ArkClass) {
|
|
638
644
|
return new Type_1.ClassType(promise.getSignature(), [returnType]);
|
|
@@ -688,8 +694,8 @@ class TypeInference {
|
|
|
688
694
|
if (!refName) {
|
|
689
695
|
return null;
|
|
690
696
|
}
|
|
691
|
-
//split and iterate to infer each type
|
|
692
|
-
const singleNames = refName.split(
|
|
697
|
+
//split and iterate to infer each type. In C++, the operators used to access members also include :: and ->
|
|
698
|
+
const singleNames = refName.split(/\.|::|->/);
|
|
693
699
|
let type = null;
|
|
694
700
|
for (let i = 0; i < singleNames.length; i++) {
|
|
695
701
|
let genericName = ValueUtil_1.EMPTY_STRING;
|
|
@@ -20,8 +20,8 @@ export declare abstract class BaseEdge {
|
|
|
20
20
|
export declare abstract class BaseNode {
|
|
21
21
|
private id;
|
|
22
22
|
protected kind: Kind;
|
|
23
|
-
private inEdges
|
|
24
|
-
private outEdges
|
|
23
|
+
private inEdges?;
|
|
24
|
+
private outEdges?;
|
|
25
25
|
constructor(id: NodeID, k: Kind);
|
|
26
26
|
getID(): NodeID;
|
|
27
27
|
getKind(): Kind;
|
|
@@ -34,8 +34,8 @@ export declare abstract class BaseNode {
|
|
|
34
34
|
addOutgoingEdge(e: BaseEdge): void;
|
|
35
35
|
removeIncomingEdge(e: BaseEdge): boolean;
|
|
36
36
|
removeOutgoingEdge(e: BaseEdge): boolean;
|
|
37
|
-
getIncomingEdge(): Set<BaseEdge
|
|
38
|
-
getOutgoingEdges(): Set<BaseEdge
|
|
37
|
+
getIncomingEdge(): Set<BaseEdge> | undefined;
|
|
38
|
+
getOutgoingEdges(): Set<BaseEdge> | undefined;
|
|
39
39
|
getDotAttr(): string;
|
|
40
40
|
abstract getDotLabel(): string;
|
|
41
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseExplicitGraph.d.ts","sourceRoot":"","sources":["../../../src/core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E,MAAM,CAAK;IAC9B,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7C,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;;IAO5B,UAAU,IAAI,MAAM;IAIpB,UAAU,IAAI,MAAM;IAIpB,SAAS,IAAI,gBAAgB,CAAC,QAAQ,CAAC;IAIvC,OAAO,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI;IAK1B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAQzC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI5B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAQ/B,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO;IAc9C,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;IAUvC,YAAY,IAAI,gBAAgB,CAAC,QAAQ,CAAC;aAIjC,YAAY,IAAI,MAAM;CACzC"}
|
|
@@ -52,8 +52,6 @@ class BaseEdge {
|
|
|
52
52
|
exports.BaseEdge = BaseEdge;
|
|
53
53
|
class BaseNode {
|
|
54
54
|
constructor(id, k) {
|
|
55
|
-
this.inEdges = new Set();
|
|
56
|
-
this.outEdges = new Set();
|
|
57
55
|
this.id = id;
|
|
58
56
|
this.kind = k;
|
|
59
57
|
}
|
|
@@ -67,28 +65,34 @@ class BaseNode {
|
|
|
67
65
|
this.kind = kind;
|
|
68
66
|
}
|
|
69
67
|
hasIncomingEdges() {
|
|
70
|
-
return this.inEdges.size !== 0;
|
|
68
|
+
return this.inEdges ? this.inEdges.size !== 0 : false;
|
|
71
69
|
}
|
|
72
70
|
hasOutgoingEdges() {
|
|
73
|
-
return this.outEdges.size === 0;
|
|
71
|
+
return this.outEdges ? this.outEdges.size === 0 : false;
|
|
74
72
|
}
|
|
75
73
|
hasIncomingEdge(e) {
|
|
76
|
-
return this.inEdges.has(e);
|
|
74
|
+
return this.inEdges ? this.inEdges.has(e) : false;
|
|
77
75
|
}
|
|
78
76
|
hasOutgoingEdge(e) {
|
|
79
|
-
return this.outEdges.has(e);
|
|
77
|
+
return this.outEdges ? this.outEdges.has(e) : false;
|
|
80
78
|
}
|
|
81
79
|
addIncomingEdge(e) {
|
|
80
|
+
if (!this.inEdges) {
|
|
81
|
+
this.inEdges = new Set();
|
|
82
|
+
}
|
|
82
83
|
this.inEdges.add(e);
|
|
83
84
|
}
|
|
84
85
|
addOutgoingEdge(e) {
|
|
86
|
+
if (!this.outEdges) {
|
|
87
|
+
this.outEdges = new Set();
|
|
88
|
+
}
|
|
85
89
|
this.outEdges.add(e);
|
|
86
90
|
}
|
|
87
91
|
removeIncomingEdge(e) {
|
|
88
|
-
return this.inEdges.delete(e);
|
|
92
|
+
return this.inEdges ? this.inEdges.delete(e) : false;
|
|
89
93
|
}
|
|
90
94
|
removeOutgoingEdge(e) {
|
|
91
|
-
return this.outEdges.delete(e);
|
|
95
|
+
return this.outEdges ? this.outEdges.delete(e) : false;
|
|
92
96
|
}
|
|
93
97
|
getIncomingEdge() {
|
|
94
98
|
return this.inEdges;
|
|
@@ -138,6 +142,9 @@ class BaseExplicitGraph {
|
|
|
138
142
|
return false;
|
|
139
143
|
}
|
|
140
144
|
hasEdge(src, dst) {
|
|
145
|
+
if (!src.getOutgoingEdges()) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
141
148
|
for (let e of src.getOutgoingEdges()) {
|
|
142
149
|
if (e.getDstNode() === dst) {
|
|
143
150
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicBlock.d.ts","sourceRoot":"","sources":["../../../src/core/graph/BasicBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BasicBlock.d.ts","sourceRoot":"","sources":["../../../src/core/graph/BasicBlock.ts"],"names":[],"mappings":"AAgBA,OAAO,EAA+C,IAAI,EAAE,M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;IAc/B,WAAW,IAAI,OAAO;CAGhC"}
|
package/lib/core/graph/Scc.js
CHANGED
|
@@ -101,12 +101,13 @@ class SCCDetection {
|
|
|
101
101
|
return n;
|
|
102
102
|
}
|
|
103
103
|
visit(v) {
|
|
104
|
+
var _a;
|
|
104
105
|
this._I += 1;
|
|
105
106
|
this._D.set(v, this._I);
|
|
106
107
|
this.setRep(v, v);
|
|
107
108
|
this.setVisited(v);
|
|
108
109
|
let node = this.getNode(v);
|
|
109
|
-
node.getOutgoingEdges().forEach(e => {
|
|
110
|
+
(_a = node.getOutgoingEdges()) === null || _a === void 0 ? void 0 : _a.forEach(e => {
|
|
110
111
|
let w = e.getDstID();
|
|
111
112
|
if (!this.isVisited(w)) {
|
|
112
113
|
this.visit(w);
|
|
@@ -191,7 +192,11 @@ class SCCDetection {
|
|
|
191
192
|
}
|
|
192
193
|
// self-cycle: a call a
|
|
193
194
|
let repNode = this._G.getNode(rep);
|
|
194
|
-
|
|
195
|
+
const outgoingEdges = repNode === null || repNode === void 0 ? void 0 : repNode.getOutgoingEdges();
|
|
196
|
+
if (!outgoingEdges) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
for (const e of outgoingEdges) {
|
|
195
200
|
if (e.getDstID() === rep) {
|
|
196
201
|
return true;
|
|
197
202
|
}
|