arkanalyzer 1.0.86 → 1.0.88
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 +35 -1
- package/lib/Config.d.ts.map +1 -1
- package/lib/Config.js +91 -2
- package/lib/Scene.d.ts +25 -2
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +151 -44
- 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 +53 -0
- package/lib/cli/commands/cg.d.ts.map +1 -0
- package/lib/cli/commands/cg.js +404 -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 +145 -23
- 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 +4 -0
- package/lib/core/common/Const.d.ts.map +1 -1
- package/lib/core/common/Const.js +5 -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 +6 -2
- package/lib/core/common/IRUtils.d.ts.map +1 -1
- package/lib/core/common/IRUtils.js +3 -33
- 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 +25 -2
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +72 -30
- 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/ArkMetadata.d.ts +32 -1
- package/lib/core/model/ArkMetadata.d.ts.map +1 -1
- package/lib/core/model/ArkMetadata.js +28 -2
- 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/ArkMetadataBuilder.d.ts +21 -0
- package/lib/core/model/builder/ArkMetadataBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkMetadataBuilder.js +160 -0
- 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 +50 -29
- 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/astJsonNapi/napiApi.d.ts +8 -0
- package/lib/frontend/cppFrontend/ast/astJsonNapi/napiApi.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/astJsonNapi/napiApi.js +90 -0
- package/lib/frontend/cppFrontend/ast/astJsonNapi/napiRunner.d.ts +8 -0
- package/lib/frontend/cppFrontend/ast/astJsonNapi/napiRunner.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/astJsonNapi/napiRunner.js +183 -0
- package/lib/frontend/cppFrontend/ast/astParser.d.ts +25 -0
- package/lib/frontend/cppFrontend/ast/astParser.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/astParser.js +280 -0
- package/lib/frontend/cppFrontend/ast/astUtils.d.ts +18 -0
- package/lib/frontend/cppFrontend/ast/astUtils.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/astUtils.js +158 -0
- package/lib/frontend/cppFrontend/ast/const.d.ts +17 -0
- package/lib/frontend/cppFrontend/ast/const.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/const.js +58 -0
- package/lib/frontend/cppFrontend/ast/index.d.ts +5 -0
- package/lib/frontend/cppFrontend/ast/index.d.ts.map +1 -0
- package/lib/frontend/cppFrontend/ast/index.js +31 -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 +284 -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 +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -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/SourceStmt.d.ts.map +1 -1
- package/lib/save/source/SourceStmt.js +3 -1
- 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 +8 -8
- package/lib/utils/FileUtils.d.ts.map +1 -1
- package/lib/utils/FileUtils.js +35 -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 +13 -7
- /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
|
@@ -2,28 +2,30 @@ import * as ts from 'ohos-typescript';
|
|
|
2
2
|
import { Local } from '../base/Local';
|
|
3
3
|
import { FullPosition } from '../base/Position';
|
|
4
4
|
import { ArkAliasTypeDefineStmt, Stmt } from '../base/Stmt';
|
|
5
|
+
import { BinaryOperator } from '../base/Expr';
|
|
5
6
|
import { AliasType, Type } from '../base/Type';
|
|
7
|
+
import { Value } from '../base/Value';
|
|
6
8
|
import { GlobalRef } from '../base/Ref';
|
|
7
9
|
import { ArkMethod } from '../model/ArkMethod';
|
|
8
10
|
import { ArkIRTransformer, ValueAndStmts } from './ArkIRTransformer';
|
|
9
11
|
export declare class ArkValueTransformer {
|
|
10
12
|
conditionalOperatorNo: number;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
protected tempLocalNo: number;
|
|
14
|
+
protected sourceFile: ts.SourceFile;
|
|
15
|
+
protected locals: Map<string, Local>;
|
|
16
|
+
protected globals?: Map<string, GlobalRef>;
|
|
17
|
+
protected thisLocal: Local;
|
|
18
|
+
protected declaringMethod: ArkMethod;
|
|
19
|
+
protected arkIRTransformer: ArkIRTransformer;
|
|
20
|
+
protected aliasTypeMap: Map<string, [AliasType, ArkAliasTypeDefineStmt]>;
|
|
21
|
+
protected builderMethodContextFlag: boolean;
|
|
20
22
|
constructor(arkIRTransformer: ArkIRTransformer, sourceFile: ts.SourceFile, declaringMethod: ArkMethod);
|
|
21
23
|
getLocals(): Set<Local>;
|
|
22
24
|
getThisLocal(): Local;
|
|
23
25
|
getAliasTypeMap(): Map<string, [AliasType, ArkAliasTypeDefineStmt]>;
|
|
24
26
|
addNewLocal(localName: string, localType?: Type): Local;
|
|
25
27
|
getGlobals(): Map<string, GlobalRef> | null;
|
|
26
|
-
|
|
28
|
+
protected addNewGlobal(name: string, ref?: Value): GlobalRef;
|
|
27
29
|
tsNodeToValueAndStmts(node: ts.Node): ValueAndStmts;
|
|
28
30
|
private tsNodeToSingleAddressValueAndStmts;
|
|
29
31
|
private thisExpressionToValueAndStmts;
|
|
@@ -83,9 +85,9 @@ export declare class ArkValueTransformer {
|
|
|
83
85
|
private compoundAssignmentTokenToBinaryOperator;
|
|
84
86
|
conditionToValueAndStmts(condition: ts.Expression): ValueAndStmts;
|
|
85
87
|
private literalNodeToValueAndStmts;
|
|
86
|
-
|
|
88
|
+
protected getOrCreateLocal(localName: string, localType?: Type): Local;
|
|
87
89
|
generateTempLocal(localType?: Type): Local;
|
|
88
|
-
|
|
90
|
+
protected isRelationalOperator(operator: BinaryOperator): boolean;
|
|
89
91
|
private isLiteralNode;
|
|
90
92
|
resolveTypeNode(type: ts.TypeNode): Type;
|
|
91
93
|
private resolveTypeQueryNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkValueTransformer.d.ts","sourceRoot":"","sources":["../../../src/core/common/ArkValueTransformer.ts"],"names":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AAC,iCAAiC;IA+CzC,OAAO,CAAC,uCAAuC;IAqCxC,wBAAwB,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,GAAG,aAAa;IA+BxE,OAAO,CAAC,0BAA0B;IA6ClC,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,IAAgC,GAAG,KAAK;IAU1F,iBAAiB,CAAC,SAAS,GAAE,IAAgC,GAAG,KAAK;IAQ5E,SAAS,CAAC,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO;IAajE,OAAO,CAAC,aAAa;IAiBd,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,GAAG,IAAI;IA+D/C,OAAO,CAAC,oBAAoB;IA+B5B,OAAO,CAAC,uBAAuB;WAqBjB,sBAAsB,CAAC,eAAe,EAAE,EAAE,CAAC,eAAe,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,IAAI;IAmB1G,OAAO,CAAC,8BAA8B;IA6CtC,OAAO,CAAC,wBAAwB;IAqChC,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,uBAAuB;WAOjB,4BAA4B,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,GAAG,OAAO;CAoB/E"}
|
|
@@ -204,11 +204,7 @@ class ArkValueTransformer {
|
|
|
204
204
|
let { value, valueOriginalPositions, stmts } = this.tsNodeToValueAndStmts(node);
|
|
205
205
|
stmts.forEach(stmt => allStmts.push(stmt));
|
|
206
206
|
if (IRUtils_1.IRUtils.moreThanOneAddress(value)) {
|
|
207
|
-
({
|
|
208
|
-
value,
|
|
209
|
-
valueOriginalPositions,
|
|
210
|
-
stmts,
|
|
211
|
-
} = this.arkIRTransformer.generateAssignStmtForValue(value, valueOriginalPositions));
|
|
207
|
+
({ value, valueOriginalPositions, stmts } = this.arkIRTransformer.generateAssignStmtForValue(value, valueOriginalPositions));
|
|
212
208
|
stmts.forEach(stmt => allStmts.push(stmt));
|
|
213
209
|
}
|
|
214
210
|
return { value, valueOriginalPositions, stmts: allStmts };
|
|
@@ -4,6 +4,8 @@ export declare const UNKNOWN_NAME = "unk";
|
|
|
4
4
|
export declare const DEFAULT_NAME = "dflt";
|
|
5
5
|
export declare const DEFAULT_ARK_CLASS_NAME: string;
|
|
6
6
|
export declare const ANONYMOUS_CLASS_PREFIX: string;
|
|
7
|
+
/** Prefix for anonymous namespace names (e.g. C++ unnamed namespace). */
|
|
8
|
+
export declare const ANONYMOUS_NAMESPACE_PREFIX: string;
|
|
7
9
|
export declare const ANONYMOUS_CLASS_DELIMITER = "$";
|
|
8
10
|
export declare const NESTED_CLASS_METHOD_DELIMITER = "-";
|
|
9
11
|
export declare const DEFAULT_ARK_METHOD_NAME: string;
|
|
@@ -14,6 +16,7 @@ export declare const ANONYMOUS_METHOD_PREFIX: string;
|
|
|
14
16
|
export declare const CALL_SIGNATURE_NAME = "create";
|
|
15
17
|
export declare const GETTER_PREFIX = "Get-";
|
|
16
18
|
export declare const SETTER_PREFIX = "Set-";
|
|
19
|
+
export declare const CONSTRUCT_SIGNATURE_NAME = "construct-signature";
|
|
17
20
|
export declare const UNKNOWN_PROJECT_NAME: string;
|
|
18
21
|
export declare const UNKNOWN_FILE_NAME: string;
|
|
19
22
|
export declare const UNKNOWN_NAMESPACE_NAME: string;
|
|
@@ -33,6 +36,7 @@ export declare const DUMMY_CLASS = "@dummyClass";
|
|
|
33
36
|
export declare const DUMMY_METHOD = "@dummyMain";
|
|
34
37
|
export declare const ABILITY_CREATE_METHOD = "onCreate";
|
|
35
38
|
export declare const ABILITY_STAGE_CREATE_METHOD = "onWindowStageCreate";
|
|
39
|
+
export declare const ABILITY_STAGE_WILL_DESTROY_METHOD = "onWindowStageWillDestroy";
|
|
36
40
|
export declare const ABILITY_STAGE_DESTROY_METHOD = "onWindowStageDestroy";
|
|
37
41
|
export declare const ABILITY_DESTROY_METHOD = "onDestroy";
|
|
38
42
|
export declare const COMPONENT_START_METHOD = "aboutToAppear";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Const.d.ts","sourceRoot":"","sources":["../../../src/core/common/Const.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,YAAY,SAAS,CAAC;AAGnC,eAAO,MAAM,sBAAsB,QAA6B,CAAC;AACjE,eAAO,MAAM,sBAAsB,QAAqB,CAAC;AACzD,eAAO,MAAM,yBAAyB,MAAiB,CAAC;AACxD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAGjD,eAAO,MAAM,uBAAuB,QAA6B,CAAC;AAClE,eAAO,MAAM,yBAAyB,QAA2B,CAAC;AAClE,eAAO,MAAM,uBAAuB,QAA2B,CAAC;AAChE,eAAO,MAAM,+BAA+B,QAA4B,CAAC;AACzE,eAAO,MAAM,uBAAuB,QAAqB,CAAC;AAC1D,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAC5C,eAAO,MAAM,aAAa,SAAS,CAAC;AACpC,eAAO,MAAM,aAAa,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Const.d.ts","sourceRoot":"","sources":["../../../src/core/common/Const.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,YAAY,SAAS,CAAC;AAGnC,eAAO,MAAM,sBAAsB,QAA6B,CAAC;AACjE,eAAO,MAAM,sBAAsB,QAAqB,CAAC;AACzD,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,QAAqB,CAAC;AAC7D,eAAO,MAAM,yBAAyB,MAAiB,CAAC;AACxD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAGjD,eAAO,MAAM,uBAAuB,QAA6B,CAAC;AAClE,eAAO,MAAM,yBAAyB,Q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B,CAAC;AAC7D,eAAO,MAAM,yBAAyB,eAAe,CAAC"}
|
package/lib/core/common/Const.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.COMPONENT_DETACHED_METHOD = exports.COMPONENT_DISAPPEAR_METHOD = exports.COMPONENT_START_METHOD = exports.ABILITY_DESTROY_METHOD = exports.ABILITY_STAGE_DESTROY_METHOD = exports.ABILITY_STAGE_CREATE_METHOD = exports.ABILITY_CREATE_METHOD = exports.DUMMY_METHOD = exports.DUMMY_CLASS = exports.DUMMY_FILE = exports.ONMESSAGEFUNCNAME = exports.POSTMESSAGEWITHSHAREDSENDABLEFUNCNAME = exports.POSTMESSAGEFUNCNAME = exports.CONSTRUCTORFUCNNAME = exports.MAKEOBSERVED = exports.ARKTS_STATIC_MARK = exports.LEXICAL_ENV_NAME_PREFIX = exports.TEMP_LOCAL_PREFIX = exports.UNKNOWN_METHOD_NAME = exports.UNKNOWN_FIELD_NAME = exports.UNKNOWN_CLASS_NAME = exports.UNKNOWN_NAMESPACE_NAME = exports.UNKNOWN_FILE_NAME = exports.UNKNOWN_PROJECT_NAME = exports.SETTER_PREFIX = exports.GETTER_PREFIX = exports.CALL_SIGNATURE_NAME = exports.ANONYMOUS_METHOD_PREFIX = exports.STATIC_BLOCK_METHOD_NAME_PREFIX = exports.STATIC_INIT_METHOD_NAME = exports.INSTANCE_INIT_METHOD_NAME = exports.DEFAULT_ARK_METHOD_NAME = exports.NESTED_CLASS_METHOD_DELIMITER = exports.ANONYMOUS_CLASS_DELIMITER = exports.ANONYMOUS_CLASS_PREFIX = exports.DEFAULT_ARK_CLASS_NAME = exports.DEFAULT_NAME = exports.UNKNOWN_NAME = exports.NAME_PREFIX = exports.NAME_DELIMITER = void 0;
|
|
17
|
+
exports.COMPONENT_DETACHED_METHOD = exports.COMPONENT_DISAPPEAR_METHOD = exports.COMPONENT_START_METHOD = exports.ABILITY_DESTROY_METHOD = exports.ABILITY_STAGE_DESTROY_METHOD = exports.ABILITY_STAGE_WILL_DESTROY_METHOD = exports.ABILITY_STAGE_CREATE_METHOD = exports.ABILITY_CREATE_METHOD = exports.DUMMY_METHOD = exports.DUMMY_CLASS = exports.DUMMY_FILE = exports.ONMESSAGEFUNCNAME = exports.POSTMESSAGEWITHSHAREDSENDABLEFUNCNAME = exports.POSTMESSAGEFUNCNAME = exports.CONSTRUCTORFUCNNAME = exports.MAKEOBSERVED = exports.ARKTS_STATIC_MARK = exports.LEXICAL_ENV_NAME_PREFIX = exports.TEMP_LOCAL_PREFIX = exports.UNKNOWN_METHOD_NAME = exports.UNKNOWN_FIELD_NAME = exports.UNKNOWN_CLASS_NAME = exports.UNKNOWN_NAMESPACE_NAME = exports.UNKNOWN_FILE_NAME = exports.UNKNOWN_PROJECT_NAME = exports.CONSTRUCT_SIGNATURE_NAME = exports.SETTER_PREFIX = exports.GETTER_PREFIX = exports.CALL_SIGNATURE_NAME = exports.ANONYMOUS_METHOD_PREFIX = exports.STATIC_BLOCK_METHOD_NAME_PREFIX = exports.STATIC_INIT_METHOD_NAME = exports.INSTANCE_INIT_METHOD_NAME = exports.DEFAULT_ARK_METHOD_NAME = exports.NESTED_CLASS_METHOD_DELIMITER = exports.ANONYMOUS_CLASS_DELIMITER = exports.ANONYMOUS_NAMESPACE_PREFIX = exports.ANONYMOUS_CLASS_PREFIX = exports.DEFAULT_ARK_CLASS_NAME = exports.DEFAULT_NAME = exports.UNKNOWN_NAME = exports.NAME_PREFIX = exports.NAME_DELIMITER = void 0;
|
|
18
18
|
// names
|
|
19
19
|
exports.NAME_DELIMITER = '$';
|
|
20
20
|
exports.NAME_PREFIX = '%';
|
|
@@ -23,6 +23,8 @@ exports.DEFAULT_NAME = 'dflt';
|
|
|
23
23
|
// ArkClass const
|
|
24
24
|
exports.DEFAULT_ARK_CLASS_NAME = exports.NAME_PREFIX + exports.DEFAULT_NAME;
|
|
25
25
|
exports.ANONYMOUS_CLASS_PREFIX = exports.NAME_PREFIX + 'AC';
|
|
26
|
+
/** Prefix for anonymous namespace names (e.g. C++ unnamed namespace). */
|
|
27
|
+
exports.ANONYMOUS_NAMESPACE_PREFIX = exports.NAME_PREFIX + 'AN';
|
|
26
28
|
exports.ANONYMOUS_CLASS_DELIMITER = exports.NAME_DELIMITER;
|
|
27
29
|
exports.NESTED_CLASS_METHOD_DELIMITER = '-';
|
|
28
30
|
// ArkMethod const
|
|
@@ -34,6 +36,7 @@ exports.ANONYMOUS_METHOD_PREFIX = exports.NAME_PREFIX + 'AM';
|
|
|
34
36
|
exports.CALL_SIGNATURE_NAME = 'create';
|
|
35
37
|
exports.GETTER_PREFIX = 'Get-';
|
|
36
38
|
exports.SETTER_PREFIX = 'Set-';
|
|
39
|
+
exports.CONSTRUCT_SIGNATURE_NAME = 'construct-signature'; // method name for constructor like method in library
|
|
37
40
|
// ArkSignature const
|
|
38
41
|
exports.UNKNOWN_PROJECT_NAME = exports.NAME_PREFIX + exports.UNKNOWN_NAME;
|
|
39
42
|
exports.UNKNOWN_FILE_NAME = exports.NAME_PREFIX + exports.UNKNOWN_NAME;
|
|
@@ -58,6 +61,7 @@ exports.DUMMY_CLASS = '@dummyClass';
|
|
|
58
61
|
exports.DUMMY_METHOD = '@dummyMain';
|
|
59
62
|
exports.ABILITY_CREATE_METHOD = 'onCreate';
|
|
60
63
|
exports.ABILITY_STAGE_CREATE_METHOD = 'onWindowStageCreate';
|
|
64
|
+
exports.ABILITY_STAGE_WILL_DESTROY_METHOD = 'onWindowStageWillDestroy';
|
|
61
65
|
exports.ABILITY_STAGE_DESTROY_METHOD = 'onWindowStageDestroy';
|
|
62
66
|
exports.ABILITY_DESTROY_METHOD = 'onDestroy';
|
|
63
67
|
exports.COMPONENT_START_METHOD = 'aboutToAppear';
|
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
import { Scene } from '../../Scene';
|
|
2
|
+
import { ArkClass } from '../model/ArkClass';
|
|
2
3
|
import { ArkMethod } from '../model/ArkMethod';
|
|
3
4
|
import { CallGraph } from '../../callgraph/model/CallGraph';
|
|
4
5
|
/**
|
|
5
|
-
收集所有的
|
|
6
|
-
|
|
6
|
+
收集所有的 Ability 和 Component 类,构造一个虚拟函数进行类的实例生成、初始化、生命周期函数调用等操作,具体为:
|
|
7
|
+
classA.%statInit()
|
|
8
|
+
const %1 = new classA()
|
|
9
|
+
%1.%instInit()
|
|
10
|
+
%1.aboutToAppear()
|
|
11
|
+
const %2 = new abilityA()
|
|
7
12
|
...
|
|
8
13
|
count = 0
|
|
9
14
|
while (true) {
|
|
10
15
|
if (count === 1) {
|
|
11
|
-
|
|
12
|
-
temp2 = new want
|
|
13
|
-
temp1.onCreate(temp2)
|
|
16
|
+
%1.onPageShow()
|
|
14
17
|
}
|
|
15
18
|
if (count === 2) {
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
...
|
|
19
|
-
if (count === *) {
|
|
20
|
-
callbackMethod1()
|
|
19
|
+
%2.onBackground()
|
|
21
20
|
}
|
|
22
21
|
...
|
|
23
22
|
}
|
|
23
|
+
%1.aboutToDisappear()
|
|
24
|
+
%1.onDetached()
|
|
25
|
+
%2.onWindowStageDestroy()
|
|
26
|
+
...
|
|
24
27
|
return
|
|
25
|
-
如果是instanceInvoke还要先实例化对象,如果是其他文件的类或者方法还要添加import信息
|
|
26
28
|
*/
|
|
27
29
|
export declare class DummyMainCreater {
|
|
28
30
|
private entryMethods;
|
|
29
31
|
private entryClasses;
|
|
30
32
|
private abilityCreateMethods;
|
|
31
33
|
private abilityStageCreateMethods;
|
|
34
|
+
private abilityStageWillDestroyMethods;
|
|
32
35
|
private abilityStageDestroyMethods;
|
|
33
36
|
private abilityDestroyMethods;
|
|
34
37
|
private componentAppearMethods;
|
|
@@ -39,7 +42,15 @@ export declare class DummyMainCreater {
|
|
|
39
42
|
private scene;
|
|
40
43
|
private tempLocalIndex;
|
|
41
44
|
private tempBlockIndex;
|
|
42
|
-
|
|
45
|
+
private classScope?;
|
|
46
|
+
private dummyMethodName?;
|
|
47
|
+
/**
|
|
48
|
+
* Create dummy entry method and add it to the specified scene.
|
|
49
|
+
* @param scene
|
|
50
|
+
* @param dummyMethodName if not provided, using the default method name '@dummyMain'
|
|
51
|
+
* @param classScope if not provided, collect all Ability class and Component struct.
|
|
52
|
+
*/
|
|
53
|
+
constructor(scene: Scene, dummyMethodName?: string, classScope?: ArkClass[]);
|
|
43
54
|
setEntryMethods(methods: ArkMethod[]): void;
|
|
44
55
|
createDummyMain(): void;
|
|
45
56
|
private addStaticInit;
|
|
@@ -54,7 +65,6 @@ export declare class DummyMainCreater {
|
|
|
54
65
|
private getEntryMethodsFromComponents;
|
|
55
66
|
private classInheritsAbility;
|
|
56
67
|
private getMethodsFromAllAbilities;
|
|
57
|
-
private getCallbackMethods;
|
|
58
68
|
/**
|
|
59
69
|
* Analysis the coverage of files, methods, stmts when starting from the dummy main method according to the given call graph.
|
|
60
70
|
* @param callGraph - the call graph create within ArkAnalyzer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DummyMainCreater.d.ts","sourceRoot":"","sources":["../../../src/core/common/DummyMainCreater.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DummyMainCreater.d.ts","sourceRoot":"","sources":["../../../src/core/common/DummyMainCreater.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAUpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAqB/C,OAAO,EAAE,SAAS,EAAiB,MAAM,iCAAiC,CAAC;AAK3E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,YAAY,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UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -38,35 +38,43 @@ const EtsConst_1 = require("./EtsConst");
|
|
|
38
38
|
const COMPONENT_BASE_CLASSES = ['CustomComponent', 'ViewPU'];
|
|
39
39
|
const ABILITY_BASE_CLASSES = ['UIExtensionAbility', 'Ability', 'FormExtensionAbility', 'UIAbility', 'BackupExtensionAbility'];
|
|
40
40
|
/**
|
|
41
|
-
收集所有的
|
|
42
|
-
|
|
41
|
+
收集所有的 Ability 和 Component 类,构造一个虚拟函数进行类的实例生成、初始化、生命周期函数调用等操作,具体为:
|
|
42
|
+
classA.%statInit()
|
|
43
|
+
const %1 = new classA()
|
|
44
|
+
%1.%instInit()
|
|
45
|
+
%1.aboutToAppear()
|
|
46
|
+
const %2 = new abilityA()
|
|
43
47
|
...
|
|
44
48
|
count = 0
|
|
45
49
|
while (true) {
|
|
46
50
|
if (count === 1) {
|
|
47
|
-
|
|
48
|
-
temp2 = new want
|
|
49
|
-
temp1.onCreate(temp2)
|
|
51
|
+
%1.onPageShow()
|
|
50
52
|
}
|
|
51
53
|
if (count === 2) {
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
...
|
|
55
|
-
if (count === *) {
|
|
56
|
-
callbackMethod1()
|
|
54
|
+
%2.onBackground()
|
|
57
55
|
}
|
|
58
56
|
...
|
|
59
57
|
}
|
|
58
|
+
%1.aboutToDisappear()
|
|
59
|
+
%1.onDetached()
|
|
60
|
+
%2.onWindowStageDestroy()
|
|
61
|
+
...
|
|
60
62
|
return
|
|
61
|
-
如果是instanceInvoke还要先实例化对象,如果是其他文件的类或者方法还要添加import信息
|
|
62
63
|
*/
|
|
63
64
|
class DummyMainCreater {
|
|
64
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Create dummy entry method and add it to the specified scene.
|
|
67
|
+
* @param scene
|
|
68
|
+
* @param dummyMethodName if not provided, using the default method name '@dummyMain'
|
|
69
|
+
* @param classScope if not provided, collect all Ability class and Component struct.
|
|
70
|
+
*/
|
|
71
|
+
constructor(scene, dummyMethodName, classScope) {
|
|
65
72
|
// entryMethods includes all UIAbility and Component lifecycle methods as well as all callback methods, but exclude the start and end methods
|
|
66
73
|
this.entryMethods = [];
|
|
67
74
|
this.entryClasses = [];
|
|
68
75
|
this.abilityCreateMethods = [];
|
|
69
76
|
this.abilityStageCreateMethods = [];
|
|
77
|
+
this.abilityStageWillDestroyMethods = [];
|
|
70
78
|
this.abilityStageDestroyMethods = [];
|
|
71
79
|
this.abilityDestroyMethods = [];
|
|
72
80
|
this.componentAppearMethods = [];
|
|
@@ -78,32 +86,41 @@ class DummyMainCreater {
|
|
|
78
86
|
this.tempLocalIndex = 0;
|
|
79
87
|
this.tempBlockIndex = 0;
|
|
80
88
|
this.scene = scene;
|
|
89
|
+
this.dummyMethodName = dummyMethodName;
|
|
90
|
+
this.classScope = classScope;
|
|
81
91
|
// Currently get entries from module.json5 can't visit all of abilities
|
|
82
92
|
// Todo: handle ability/component jump, then get entries from module.json5
|
|
83
93
|
this.getMethodsFromAllAbilities();
|
|
84
94
|
this.getEntryMethodsFromComponents();
|
|
85
|
-
this.getCallbackMethods();
|
|
86
95
|
}
|
|
87
96
|
setEntryMethods(methods) {
|
|
88
97
|
this.entryMethods = methods;
|
|
89
98
|
}
|
|
90
99
|
createDummyMain() {
|
|
91
100
|
var _a;
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
// The first choice is to use the existing dummy class and add the new created dummy method into it.
|
|
102
|
+
// Then it can create more than one dummy methods with different names by using this creation api several times.
|
|
103
|
+
// step1: find out or create the dummy file
|
|
95
104
|
const dummyMainFileSignature = new ArkSignature_1.FileSignature(this.scene.getProjectName(), Const_1.DUMMY_FILE);
|
|
96
|
-
dummyMainFile.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
let dummyMainFile = this.scene.getFile(dummyMainFileSignature);
|
|
106
|
+
if (!dummyMainFile) {
|
|
107
|
+
dummyMainFile = new ArkFile_1.ArkFile(ArkFile_1.Language.ARKTS1_1);
|
|
108
|
+
dummyMainFile.setScene(this.scene);
|
|
109
|
+
dummyMainFile.setFileSignature(dummyMainFileSignature);
|
|
110
|
+
this.scene.setFile(dummyMainFile);
|
|
111
|
+
}
|
|
112
|
+
// step2: find out or create dummy class
|
|
113
|
+
let dummyMainClass = dummyMainFile.getClassWithName(Const_1.DUMMY_CLASS);
|
|
114
|
+
if (!dummyMainClass) {
|
|
115
|
+
dummyMainClass = new ArkClass_1.ArkClass();
|
|
116
|
+
dummyMainClass.setDeclaringArkFile(dummyMainFile);
|
|
117
|
+
const dummyMainClassSignature = new ArkSignature_1.ClassSignature(Const_1.DUMMY_CLASS, dummyMainFileSignature);
|
|
118
|
+
dummyMainClass.setSignature(dummyMainClassSignature);
|
|
119
|
+
dummyMainFile.addArkClass(dummyMainClass);
|
|
120
|
+
}
|
|
104
121
|
// step3: create dummy method
|
|
105
122
|
this.dummyMain.setDeclaringArkClass(dummyMainClass);
|
|
106
|
-
const methodSubSignature = ArkSignatureBuilder_1.ArkSignatureBuilder.buildMethodSubSignatureFromMethodName(Const_1.DUMMY_METHOD);
|
|
123
|
+
const methodSubSignature = ArkSignatureBuilder_1.ArkSignatureBuilder.buildMethodSubSignatureFromMethodName((_a = this.dummyMethodName) !== null && _a !== void 0 ? _a : Const_1.DUMMY_METHOD);
|
|
107
124
|
const methodSignature = new ArkSignature_1.MethodSignature(this.dummyMain.getDeclaringArkClass().getSignature(), methodSubSignature);
|
|
108
125
|
this.dummyMain.setImplementationSignature(methodSignature);
|
|
109
126
|
this.dummyMain.setLineCol(0);
|
|
@@ -234,6 +251,7 @@ class DummyMainCreater {
|
|
|
234
251
|
// step4: create the last return block
|
|
235
252
|
const returnBlock = new BasicBlock_1.BasicBlock(this.tempBlockIndex++);
|
|
236
253
|
this.addMethodsInvokeStmt(returnBlock, this.componentDisappearMethods);
|
|
254
|
+
this.addMethodsInvokeStmt(returnBlock, this.abilityStageWillDestroyMethods);
|
|
237
255
|
this.addMethodsInvokeStmt(returnBlock, this.abilityStageDestroyMethods);
|
|
238
256
|
this.addMethodsInvokeStmt(returnBlock, this.componentDetachedMethods);
|
|
239
257
|
this.addMethodsInvokeStmt(returnBlock, this.abilityDestroyMethods);
|
|
@@ -280,6 +298,9 @@ class DummyMainCreater {
|
|
|
280
298
|
this.scene
|
|
281
299
|
.getClasses()
|
|
282
300
|
.filter(cls => {
|
|
301
|
+
if (this.classScope && this.classScope.length > 0 && !this.classScope.includes(cls)) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
283
304
|
if (COMPONENT_BASE_CLASSES.includes(cls.getSuperClassName())) {
|
|
284
305
|
return true;
|
|
285
306
|
}
|
|
@@ -312,7 +333,12 @@ class DummyMainCreater {
|
|
|
312
333
|
return true;
|
|
313
334
|
}
|
|
314
335
|
let superClass = arkClass.getSuperClass();
|
|
336
|
+
let visitedClasses = new Set();
|
|
315
337
|
while (superClass) {
|
|
338
|
+
if (visitedClasses.has(superClass)) {
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
visitedClasses.add(superClass);
|
|
316
342
|
if (ABILITY_BASE_CLASSES.includes(superClass.getSuperClassName())) {
|
|
317
343
|
return true;
|
|
318
344
|
}
|
|
@@ -323,7 +349,12 @@ class DummyMainCreater {
|
|
|
323
349
|
getMethodsFromAllAbilities() {
|
|
324
350
|
this.scene
|
|
325
351
|
.getClasses()
|
|
326
|
-
.filter(cls =>
|
|
352
|
+
.filter(cls => {
|
|
353
|
+
if (this.classScope && this.classScope.length > 0 && !this.classScope.includes(cls)) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
return this.classInheritsAbility(cls);
|
|
357
|
+
})
|
|
327
358
|
.forEach(cls => {
|
|
328
359
|
this.entryClasses.push(cls);
|
|
329
360
|
for (const mtd of cls.getMethods()) {
|
|
@@ -336,6 +367,10 @@ class DummyMainCreater {
|
|
|
336
367
|
this.abilityStageCreateMethods.push(mtd);
|
|
337
368
|
continue;
|
|
338
369
|
}
|
|
370
|
+
if (name === Const_1.ABILITY_STAGE_WILL_DESTROY_METHOD) {
|
|
371
|
+
this.abilityStageWillDestroyMethods.push(mtd);
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
339
374
|
if (name === Const_1.ABILITY_STAGE_DESTROY_METHOD) {
|
|
340
375
|
this.abilityStageDestroyMethods.push(mtd);
|
|
341
376
|
continue;
|
|
@@ -350,22 +385,6 @@ class DummyMainCreater {
|
|
|
350
385
|
}
|
|
351
386
|
});
|
|
352
387
|
}
|
|
353
|
-
getCallbackMethods() {
|
|
354
|
-
this.scene.getMethods().forEach(method => {
|
|
355
|
-
if (!method.getCfg()) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
method
|
|
359
|
-
.getCfg()
|
|
360
|
-
.getStmts()
|
|
361
|
-
.forEach(stmt => {
|
|
362
|
-
const cbMethod = (0, entryMethodUtils_1.getCallbackMethodFromStmt)(stmt, this.scene);
|
|
363
|
-
if (cbMethod && !this.entryMethods.includes(cbMethod)) {
|
|
364
|
-
this.entryMethods.push(cbMethod);
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
388
|
/**
|
|
370
389
|
* Analysis the coverage of files, methods, stmts when starting from the dummy main method according to the given call graph.
|
|
371
390
|
* @param callGraph - the call graph create within ArkAnalyzer
|
|
@@ -448,7 +467,11 @@ class CoverageAnalysis {
|
|
|
448
467
|
this.addVisitedStmt(stmt);
|
|
449
468
|
});
|
|
450
469
|
const node = this.callGraph.getCallGraphNodeByMethod(method.getSignature());
|
|
451
|
-
|
|
470
|
+
const outgoingEdges = node.getOutgoingEdges();
|
|
471
|
+
if (!outgoingEdges) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
for (const outEdge of outgoingEdges) {
|
|
452
475
|
const calleeSig = outEdge.getDstNode().getMethod();
|
|
453
476
|
const callee = this.scene.getMethod(calleeSig);
|
|
454
477
|
if (!callee) {
|
|
@@ -75,4 +75,15 @@ export declare const BUILD_PROFILE_JSON5 = "build-profile.json5";
|
|
|
75
75
|
export declare const COMPONENT: string;
|
|
76
76
|
export declare const COMMON_METHOD: string;
|
|
77
77
|
export declare const COMPONENT_EXTEND_DECORATOR: Set<string>;
|
|
78
|
+
export declare const BUSINESS_ERROR = "BusinessError";
|
|
79
|
+
export declare const OHOS_BASE_FILE = "api/@ohos.base.d.ts";
|
|
80
|
+
export declare const OHPM: string;
|
|
81
|
+
export declare const OH_MODULES: string;
|
|
82
|
+
export declare const MODULE_PREFIX = "@module:";
|
|
83
|
+
export declare const DEFAULT_SDK_NUMS = 3;
|
|
84
|
+
export declare const PATH_BE_OMITTED = "/src/main";
|
|
85
|
+
export declare const SCOPE_PREFIX = "@";
|
|
86
|
+
export declare const ETS_PATH = "ets";
|
|
87
|
+
export declare const PATH_DELIMITER = "/";
|
|
88
|
+
export declare const ETS_CODE_PATH = "ets/";
|
|
78
89
|
//# sourceMappingURL=EtsConst.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EtsConst.d.ts","sourceRoot":"","sources":["../../../src/core/common/EtsConst.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAy4BhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAkB,CAAC;AACpD,eAAO,MAAM,uBAAuB,EAAE,MAAsB,CAAC;AAE7D,eAAO,MAAM,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAAkG,CAAC;AAEpJ,eAAO,MAAM,wBAAwB,EAAE,GAAG,CAAC,MAAM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= exports.COMMON_METHOD = exports.COMPONENT = exports.BUILD_PROFILE_JSON5 = exports.OH_PACKAGE_JSON5 = exports.ON_OFF = exports.CALL_BACK = exports.COMPONENT_ATTRIBUTE = exports.COMPONENT_INSTANCE = exports.COMPONENT_COMMON = exports.SPECIAL_CONTAINER_COMPONENT = exports.COMPONENT_BUILD_FUNCTION = exports.COMPONENT_BRANCH_FUNCTION = exports.COMPONENT_IF_BRANCH = exports.COMPONENT_IF = exports.COMPONENT_REPEAT = exports.COMPONENT_CUSTOMVIEW = exports.COMPONENT_POP_FUNCTION = exports.COMPONENT_CREATE_FUNCTION = exports.isEtsContainerComponent = exports.isEtsSystemComponent = exports.isEtsAtomicComponent = exports.COMPONENT_BEHAVIOR = exports.BUILDER_PARAM_DECORATOR = exports.BUILDER_DECORATOR = exports.ENTRY_DECORATOR = exports.COMPONENT_DECORATOR = exports.BUILDIN_ATOMIC_COMPONENT = exports.BUILDIN_SYSTEM_COMPONENT = exports.COMPONENT_LAZY_FOR_EACH = exports.COMPONENT_FOR_EACH = exports.ETS_COMPILER_OPTIONS = void 0;
|
|
17
|
+
exports.ETS_CODE_PATH = exports.PATH_DELIMITER = exports.ETS_PATH = exports.SCOPE_PREFIX = exports.PATH_BE_OMITTED = exports.DEFAULT_SDK_NUMS = exports.MODULE_PREFIX = exports.OH_MODULES = exports.OHPM = exports.OHOS_BASE_FILE = exports.BUSINESS_ERROR = exports.COMPONENT_EXTEND_DECORATOR = exports.COMMON_METHOD = exports.COMPONENT = exports.BUILD_PROFILE_JSON5 = exports.OH_PACKAGE_JSON5 = exports.ON_OFF = exports.CALL_BACK = exports.COMPONENT_ATTRIBUTE = exports.COMPONENT_INSTANCE = exports.COMPONENT_COMMON = exports.SPECIAL_CONTAINER_COMPONENT = exports.COMPONENT_BUILD_FUNCTION = exports.COMPONENT_BRANCH_FUNCTION = exports.COMPONENT_IF_BRANCH = exports.COMPONENT_IF = exports.COMPONENT_REPEAT = exports.COMPONENT_CUSTOMVIEW = exports.COMPONENT_POP_FUNCTION = exports.COMPONENT_CREATE_FUNCTION = exports.isEtsContainerComponent = exports.isEtsSystemComponent = exports.isEtsAtomicComponent = exports.COMPONENT_BEHAVIOR = exports.BUILDER_PARAM_DECORATOR = exports.BUILDER_DECORATOR = exports.ENTRY_DECORATOR = exports.COMPONENT_DECORATOR = exports.BUILDIN_ATOMIC_COMPONENT = exports.BUILDIN_SYSTEM_COMPONENT = exports.COMPONENT_LAZY_FOR_EACH = exports.COMPONENT_FOR_EACH = exports.ETS_COMPILER_OPTIONS = void 0;
|
|
18
18
|
exports.ETS_COMPILER_OPTIONS = {
|
|
19
19
|
ets: {
|
|
20
20
|
emitDecorators: [
|
|
@@ -1014,3 +1014,14 @@ exports.BUILD_PROFILE_JSON5 = 'build-profile.json5';
|
|
|
1014
1014
|
exports.COMPONENT = 'Component';
|
|
1015
1015
|
exports.COMMON_METHOD = 'CommonMethod';
|
|
1016
1016
|
exports.COMPONENT_EXTEND_DECORATOR = new Set(['Extend', 'Styles', 'AnimatableExtend']);
|
|
1017
|
+
exports.BUSINESS_ERROR = 'BusinessError';
|
|
1018
|
+
exports.OHOS_BASE_FILE = 'api/@ohos.base.d.ts';
|
|
1019
|
+
exports.OHPM = '.ohpm';
|
|
1020
|
+
exports.OH_MODULES = 'oh_modules';
|
|
1021
|
+
exports.MODULE_PREFIX = '@module:';
|
|
1022
|
+
exports.DEFAULT_SDK_NUMS = 3;
|
|
1023
|
+
exports.PATH_BE_OMITTED = '/src/main';
|
|
1024
|
+
exports.SCOPE_PREFIX = '@';
|
|
1025
|
+
exports.ETS_PATH = 'ets';
|
|
1026
|
+
exports.PATH_DELIMITER = '/';
|
|
1027
|
+
exports.ETS_CODE_PATH = 'ets/';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRInference.d.ts","sourceRoot":"","sources":["../../../src/core/common/IRInference.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC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E,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,WAAW,GAAG,IAAI;IAuCjH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAiChC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAgChC,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAoB5C,OAAO,CAAC,MAAM,CAAC,UAAU;WAeX,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,IAAI;IAoC/H,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAM/B,OAAO,CAAC,MAAM,CAAC,eAAe;WAiChB,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,GAAG,YAAY;WAiC3E,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;WA2CnE,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;WAcnE,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,GAAG,WAAW;CAsB3F"}
|
|
@@ -455,7 +455,7 @@ class IRInference {
|
|
|
455
455
|
}
|
|
456
456
|
let method;
|
|
457
457
|
if (methodName === TSConst_1.CONSTRUCTOR_NAME) {
|
|
458
|
-
method = (_c = (_b = declaredClass === null || declaredClass === void 0 ? void 0 : declaredClass.getMethodWithName(
|
|
458
|
+
method = (_c = (_b = declaredClass === null || declaredClass === void 0 ? void 0 : declaredClass.getMethodWithName(Const_1.CONSTRUCT_SIGNATURE_NAME)) !== null && _b !== void 0 ? _b : declaredClass.getMethodWithName(Const_1.CALL_SIGNATURE_NAME)) !== null && _c !== void 0 ? _c : declaredClass === null || declaredClass === void 0 ? void 0 : declaredClass.getMethodWithName(TSConst_1.CONSTRUCTOR_NAME);
|
|
459
459
|
if (!method) {
|
|
460
460
|
const subSignature = new ArkSignature_1.MethodSubSignature(methodName, [], new Type_1.ClassType(baseType.getClassSignature()));
|
|
461
461
|
expr.setMethodSignature(new ArkSignature_1.MethodSignature(baseType.getClassSignature(), subSignature));
|
|
@@ -477,6 +477,7 @@ class IRInference {
|
|
|
477
477
|
return expr;
|
|
478
478
|
}
|
|
479
479
|
else if (method instanceof ArkField_1.ArkField || method instanceof Local_1.Local) {
|
|
480
|
+
expr.setRealGenericTypes(IRInference.getRealTypes(expr, declaredClass, baseType));
|
|
480
481
|
return (_e = this.changePtrInvokeExpr(method, scene, expr)) !== null && _e !== void 0 ? _e : expr;
|
|
481
482
|
}
|
|
482
483
|
return null;
|
|
@@ -493,6 +494,9 @@ class IRInference {
|
|
|
493
494
|
static changePtrInvokeExpr(method, scene, expr) {
|
|
494
495
|
var _a;
|
|
495
496
|
let type = method.getType();
|
|
497
|
+
if (expr.getRealGenericTypes() && TypeInference_1.TypeInference.checkType(type, t => t instanceof Type_1.GenericType || t instanceof Type_1.AnyType)) {
|
|
498
|
+
type = TypeInference_1.TypeInference.replaceTypeWithReal(type, expr.getRealGenericTypes());
|
|
499
|
+
}
|
|
496
500
|
if (type instanceof Type_1.UnionType) {
|
|
497
501
|
const funType = type.getTypes().find(t => t instanceof Type_1.FunctionType);
|
|
498
502
|
if (funType instanceof Type_1.FunctionType) {
|
|
@@ -526,7 +530,7 @@ class IRInference {
|
|
|
526
530
|
var _a;
|
|
527
531
|
let realTypes;
|
|
528
532
|
const tmp = [];
|
|
529
|
-
if (method.getGenericTypes()) {
|
|
533
|
+
if (method === null || method === void 0 ? void 0 : method.getGenericTypes()) {
|
|
530
534
|
expr.getMethodSignature().getMethodSubSignature().getParameters()
|
|
531
535
|
.filter(p => !p.getName().startsWith(Const_1.LEXICAL_ENV_NAME_PREFIX))
|
|
532
536
|
.forEach((p, i) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRUtils.d.ts","sourceRoot":"","sources":["../../../src/core/common/IRUtils.ts"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AG,MAAM;WAYlD,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,GAAG,IAAI;WAqClF,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE;CAOxE"}
|
|
@@ -13,18 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
17
|
exports.IRUtils = void 0;
|
|
21
18
|
const Expr_1 = require("../base/Expr");
|
|
22
19
|
const Ref_1 = require("../base/Ref");
|
|
23
|
-
const ohos_typescript_1 = __importDefault(require("ohos-typescript"));
|
|
24
|
-
const ArkMetadata_1 = require("../model/ArkMetadata");
|
|
25
20
|
const Position_1 = require("../base/Position");
|
|
26
21
|
const Local_1 = require("../base/Local");
|
|
27
22
|
const Const_1 = require("./Const");
|
|
23
|
+
const ArkMetadataBuilder_1 = require("../model/builder/ArkMetadataBuilder");
|
|
28
24
|
class IRUtils {
|
|
29
25
|
static moreThanOneAddress(value) {
|
|
30
26
|
if (value instanceof Expr_1.AbstractBinopExpr ||
|
|
@@ -48,36 +44,10 @@ class IRUtils {
|
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
static setComments(metadata, node, sourceFile, options) {
|
|
51
|
-
|
|
52
|
-
if (leadingCommentsMetadata.getComments().length > 0) {
|
|
53
|
-
metadata.setMetadata(ArkMetadata_1.ArkMetadataKind.LEADING_COMMENTS, leadingCommentsMetadata);
|
|
54
|
-
}
|
|
55
|
-
const trailingCommentsMetadata = this.getCommentsMetadata(node, sourceFile, options, false);
|
|
56
|
-
if (trailingCommentsMetadata.getComments().length > 0) {
|
|
57
|
-
metadata.setMetadata(ArkMetadata_1.ArkMetadataKind.TRAILING_COMMENTS, trailingCommentsMetadata);
|
|
58
|
-
}
|
|
47
|
+
ArkMetadataBuilder_1.ArkMetadataBuilder.setComments(metadata, node, sourceFile, options);
|
|
59
48
|
}
|
|
60
49
|
static getCommentsMetadata(node, sourceFile, options, isLeading) {
|
|
61
|
-
|
|
62
|
-
if ((isLeading && !options.enableLeadingComments) || (!isLeading && !options.enableTrailingComments)) {
|
|
63
|
-
return new ArkMetadata_1.CommentsMetadata(comments);
|
|
64
|
-
}
|
|
65
|
-
// node.pos is the start position of
|
|
66
|
-
const commentRanges = (isLeading ? ohos_typescript_1.default.getLeadingCommentRanges(sourceFile.text, node.pos) : ohos_typescript_1.default.getTrailingCommentRanges(sourceFile.text, node.end)) || [];
|
|
67
|
-
// leading comment, while node.end is the
|
|
68
|
-
// end position of the statement
|
|
69
|
-
const getPosition = (pos, end) => {
|
|
70
|
-
const start = ohos_typescript_1.default.getLineAndCharacterOfPosition(sourceFile, pos);
|
|
71
|
-
const endPos = ohos_typescript_1.default.getLineAndCharacterOfPosition(sourceFile, end);
|
|
72
|
-
return new Position_1.FullPosition(start.line + 1, start.character + 1, endPos.line + 1, endPos.character + 1);
|
|
73
|
-
};
|
|
74
|
-
for (const range of commentRanges) {
|
|
75
|
-
comments.push({
|
|
76
|
-
content: sourceFile.text.substring(range.pos, range.end).replace(/\r\n/g, '\n'),
|
|
77
|
-
position: getPosition(range.pos, range.end),
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return new ArkMetadata_1.CommentsMetadata(comments);
|
|
50
|
+
return ArkMetadataBuilder_1.ArkMetadataBuilder.getCommentsMetadata(node, sourceFile, options, isLeading);
|
|
81
51
|
}
|
|
82
52
|
static isTempLocal(value) {
|
|
83
53
|
return value instanceof Local_1.Local && value.getName().startsWith(Const_1.NAME_PREFIX);
|