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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GenericType, Type } from '../../../../core/base/Type';
|
|
2
|
+
import { ArkField } from '../../../../core/model/ArkField';
|
|
3
|
+
import { ArkClass } from '../../../../core/model/ArkClass';
|
|
4
|
+
import { ArkMethod } from '../../../../core/model/ArkMethod';
|
|
5
|
+
import { MethodParameter } from '../../../../core/model/builder/ArkMethodBuilder';
|
|
6
|
+
import { CxxAstNode, CxxTranslationUnit, defaultArg } from '../../ast/ArkCxxAstNode';
|
|
7
|
+
import { Decorator } from '../../../../core/base/Decorator';
|
|
8
|
+
export declare function buildModifiers(node: CxxAstNode): number;
|
|
9
|
+
export declare function buildDecorators(node: CxxAstNode, sourceFile: CxxAstNode): Set<Decorator>;
|
|
10
|
+
export declare function buildModifiersForCxxClass(cls: ArkClass): number;
|
|
11
|
+
export declare function buildTypeParameters(clsNode: CxxAstNode, sourceFile: CxxAstNode, arkInstance: ArkMethod | ArkClass): GenericType[];
|
|
12
|
+
export declare function buildParameters(params: CxxAstNode[], arkInstance: ArkMethod | ArkField, sourceFile: CxxAstNode): MethodParameter[];
|
|
13
|
+
export declare function buildReturnType(mtdNode: CxxAstNode, sourceFile: CxxAstNode, method: ArkMethod): Type;
|
|
14
|
+
export declare function isCxxFunctionPointer(type: string): boolean;
|
|
15
|
+
export declare function buildFuncPtrType(funcPtrNode: CxxAstNode, arkMtd: ArkMethod, sourceFile: CxxAstNode | CxxTranslationUnit): Type;
|
|
16
|
+
/**
|
|
17
|
+
*Convert C++AST node to Type
|
|
18
|
+
*@ param nodeQualType - type information of C++AST node or string type
|
|
19
|
+
*@ param arkInstance - Ark instance (method, class or field) that may contain generic information
|
|
20
|
+
*@ param sourceFile - optional source file node
|
|
21
|
+
*@ returns Type after conversion
|
|
22
|
+
*/
|
|
23
|
+
export declare function cxxNode2Type(nodeQualType: CxxAstNode, arkInstance: ArkMethod | ArkClass | ArkField | undefined, sourceFile?: CxxAstNode, currNode?: CxxAstNode, defaultArg?: defaultArg): Type;
|
|
24
|
+
/**
|
|
25
|
+
*The corresponding Type object is constructed according to the pre type string and the optional Ark instance.
|
|
26
|
+
*
|
|
27
|
+
*The main processing flow of this function includes:
|
|
28
|
+
*1 Remove modifiers (such as const, static, mutable);
|
|
29
|
+
*2 Judge whether it is a function pointer, and handle pointers and references;
|
|
30
|
+
*3 Type inference to generate basic types;
|
|
31
|
+
*4 Wrap the final Type object according to the pointer level and the number of references.
|
|
32
|
+
*
|
|
33
|
+
*@ param preStr The original pre type string, such as "const int *" or "std:: vector<int>&"
|
|
34
|
+
*@ param arkInstance The optional ArkMethod, ArkClass or ArkField instances are used to assist type construction
|
|
35
|
+
*@ returns Type object constructed
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildTypeFromPreStr(preStr: string, node: CxxAstNode, arkInstance: ArkMethod | ArkClass | ArkField | undefined): Type;
|
|
38
|
+
export declare function buildArrayType(qualType: string, node: CxxAstNode, arkInstance: ArkMethod | ArkClass | ArkField | undefined): Type;
|
|
39
|
+
export declare function buildPointerType(preStr: string, pointerLevel: number, node: CxxAstNode, arkInstance: ArkMethod | ArkClass | ArkField | undefined): Type;
|
|
40
|
+
export declare function buildReferenceType(preStr: string, referenceCount: number, node: CxxAstNode, arkInstance: ArkMethod | ArkClass | ArkField | undefined): Type;
|
|
41
|
+
export declare function isCXXSTLContainer(qualType: string): boolean;
|
|
42
|
+
export declare function isFuncInClassOrNamespace(callNode: CxxAstNode): boolean;
|
|
43
|
+
export declare function isCxxBasicString(qualType: string): boolean;
|
|
44
|
+
export declare function buildTypeFromDerivedType(preStr: string, node: CxxAstNode, arkInstance: ArkMethod | ArkClass | ArkField | undefined): Type;
|
|
45
|
+
export declare function convertDataType(typeName: string): string;
|
|
46
|
+
//# sourceMappingURL=builderUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builderUtils.d.ts","sourceRoot":"","sources":["../../../../../src/frontend/cppFrontend/model/builder/builderUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAGH,WAAW,EACX,IAAI,EAIP,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAGlF,OAAO,EAAW,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AA8C5D,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAUvD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,CAGxF;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAS/D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,EAAE,CA4BjI;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,SAAS,GAAG,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAG,eAAe,EAAE,CA4BlI;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAqBpG;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,GAAG,kBAAkB,GAAG,IAAI,CAM9H;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,YAAY,EAAE,UAAU,EACxB,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,EACxD,UAAU,CAAC,EAAE,UAAU,EACvB,QAAQ,CAAC,EAAE,UAAU,EACrB,UAAU,CAAC,EAAE,UAAU,GACxB,IAAI,CAuBN;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CA6DpI;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CA6BjI;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAkBvJ;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAS3J;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAItE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAsCzI;AA8CD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGxD"}
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2024-2025 Huawei Device Co., Ltd.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.convertDataType = exports.buildTypeFromDerivedType = exports.isCxxBasicString = exports.isFuncInClassOrNamespace = exports.isCXXSTLContainer = exports.buildReferenceType = exports.buildPointerType = exports.buildArrayType = exports.buildTypeFromPreStr = exports.cxxNode2Type = exports.buildFuncPtrType = exports.isCxxFunctionPointer = exports.buildReturnType = exports.buildParameters = exports.buildTypeParameters = exports.buildModifiersForCxxClass = exports.buildDecorators = exports.buildModifiers = void 0;
|
|
41
|
+
const Type_1 = require("../../../../core/base/Type");
|
|
42
|
+
const Type_2 = require("../../base/Type");
|
|
43
|
+
const TypeInference_1 = require("../../common/TypeInference");
|
|
44
|
+
const ArkClass_1 = require("../../../../core/model/ArkClass");
|
|
45
|
+
const ArkMethod_1 = require("../../../../core/model/ArkMethod");
|
|
46
|
+
const ArkMethodBuilder_1 = require("../../../../core/model/builder/ArkMethodBuilder");
|
|
47
|
+
const ArkBaseModel_1 = require("../../../../core/model/ArkBaseModel");
|
|
48
|
+
const builderUtils_1 = require("../../../../core/model/builder/builderUtils");
|
|
49
|
+
const ArkCxxAstNode_1 = require("../../ast/ArkCxxAstNode");
|
|
50
|
+
const ArkMethodBuilder_2 = require("./ArkMethodBuilder");
|
|
51
|
+
const Builtin_1 = require("../../common/Builtin");
|
|
52
|
+
const ModelUtils_1 = require("../../common/ModelUtils");
|
|
53
|
+
const logger_1 = __importStar(require("../../../../utils/logger"));
|
|
54
|
+
const FUNC_PTR_REGEX = /\(\s*\*\s*(?:\[\s*[^]]*\s*\])?\s*\)\s*\(\s*[^)]*\s*\)/;
|
|
55
|
+
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkValueTransformer');
|
|
56
|
+
function extractCommonModifiers(node) {
|
|
57
|
+
var _a;
|
|
58
|
+
let modifiers = 0;
|
|
59
|
+
if (!node.modifiers) {
|
|
60
|
+
return modifiers;
|
|
61
|
+
}
|
|
62
|
+
for (let i = 0; i < node.modifiers.length; i++) {
|
|
63
|
+
if (Object.prototype.hasOwnProperty.call(node, 'modifiers')) {
|
|
64
|
+
modifiers |= (0, ArkBaseModel_1.modifierKind2CxxEnum)(node.modifiers[i]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(node, 'storageClass')) {
|
|
68
|
+
modifiers |= (0, ArkBaseModel_1.modifierKind2CxxEnum)((_a = node.storageClass) !== null && _a !== void 0 ? _a : '');
|
|
69
|
+
}
|
|
70
|
+
return modifiers;
|
|
71
|
+
}
|
|
72
|
+
function hasOverrideAttr(inner) {
|
|
73
|
+
if (!inner) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return inner.some(child => child.kind === 'attribute(override)');
|
|
77
|
+
}
|
|
78
|
+
function getMtdModifier(node, modifiers) {
|
|
79
|
+
if (node.code.startsWith('virtual ')) {
|
|
80
|
+
modifiers |= (0, ArkBaseModel_1.modifierKind2CxxEnum)('virtual');
|
|
81
|
+
// Definition of pure virtual function: virtual func()=0/virtual func()=0
|
|
82
|
+
if (node.code.endsWith('= 0') || node.code.endsWith('=0')) {
|
|
83
|
+
modifiers |= (0, ArkBaseModel_1.modifierKind2CxxEnum)('pure virtual');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (hasOverrideAttr(node.inner)) {
|
|
87
|
+
modifiers |= (0, ArkBaseModel_1.modifierKind2CxxEnum)('override');
|
|
88
|
+
}
|
|
89
|
+
return modifiers;
|
|
90
|
+
}
|
|
91
|
+
function buildModifiers(node) {
|
|
92
|
+
let modifiers = extractCommonModifiers(node);
|
|
93
|
+
if (node.kind === 'CXXMethodDecl') {
|
|
94
|
+
modifiers = getMtdModifier(node, modifiers);
|
|
95
|
+
}
|
|
96
|
+
if (node.kind === 'FriendDecl') {
|
|
97
|
+
modifiers |= (0, ArkBaseModel_1.modifierKind2CxxEnum)('friend');
|
|
98
|
+
}
|
|
99
|
+
return modifiers;
|
|
100
|
+
}
|
|
101
|
+
exports.buildModifiers = buildModifiers;
|
|
102
|
+
function buildDecorators(node, sourceFile) {
|
|
103
|
+
let decorators = new Set();
|
|
104
|
+
return decorators;
|
|
105
|
+
}
|
|
106
|
+
exports.buildDecorators = buildDecorators;
|
|
107
|
+
function buildModifiersForCxxClass(cls) {
|
|
108
|
+
const mtds = cls.getMethods();
|
|
109
|
+
for (const mtd of mtds) {
|
|
110
|
+
// If a class contains a pure virtual member function, then the class is an abstract class.
|
|
111
|
+
if (mtd.isPureVirtual()) {
|
|
112
|
+
return (0, ArkBaseModel_1.modifierKind2CxxEnum)('abstract');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
exports.buildModifiersForCxxClass = buildModifiersForCxxClass;
|
|
118
|
+
function buildTypeParameters(clsNode, sourceFile, arkInstance) {
|
|
119
|
+
const genericTypes = [];
|
|
120
|
+
let index = -1;
|
|
121
|
+
for (const innerNode of clsNode.inner) {
|
|
122
|
+
if (innerNode.kind === ArkCxxAstNode_1.astKind.TemplateTypeParmDecl) {
|
|
123
|
+
let defaultType;
|
|
124
|
+
if (innerNode.inner && innerNode.inner.length > 0) {
|
|
125
|
+
innerNode.default = innerNode.inner[0].type.qualType;
|
|
126
|
+
}
|
|
127
|
+
if (innerNode.defaultArg) {
|
|
128
|
+
defaultType = cxxNode2Type(innerNode, arkInstance);
|
|
129
|
+
}
|
|
130
|
+
let templateType = new Type_1.GenericType(innerNode.name, defaultType);
|
|
131
|
+
templateType.setIndex(++index);
|
|
132
|
+
genericTypes.push(templateType);
|
|
133
|
+
}
|
|
134
|
+
else if (innerNode.kind === ArkCxxAstNode_1.astKind.NonTypeTemplateParmDecl) {
|
|
135
|
+
let templateType;
|
|
136
|
+
if (innerNode.type.qualType === 'auto') {
|
|
137
|
+
templateType = new Type_2.CxxNonType(innerNode.name, Type_2.AutoType.getInstance());
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const nonType = cxxNode2Type(innerNode, arkInstance, sourceFile);
|
|
141
|
+
templateType = new Type_2.CxxNonType(innerNode.name, nonType);
|
|
142
|
+
}
|
|
143
|
+
templateType.setIndex(++index);
|
|
144
|
+
genericTypes.push(templateType);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return genericTypes;
|
|
148
|
+
}
|
|
149
|
+
exports.buildTypeParameters = buildTypeParameters;
|
|
150
|
+
function buildParameters(params, arkInstance, sourceFile) {
|
|
151
|
+
let parameters = [];
|
|
152
|
+
if (!params || params.length === 0) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
params.forEach((parameter) => {
|
|
156
|
+
let methodParameter = new ArkMethodBuilder_1.MethodParameter();
|
|
157
|
+
// name
|
|
158
|
+
if (parameter.name) {
|
|
159
|
+
methodParameter.setName(parameter.name.toString());
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
methodParameter.setName('');
|
|
163
|
+
}
|
|
164
|
+
// Is it optional,If there are default parameters, they should be set as optional parameters
|
|
165
|
+
if (parameter.inner.length > 0 && parameter.inner[parameter.inner.length - 1].kind !== 'TypeRef') {
|
|
166
|
+
methodParameter.setOptional(true);
|
|
167
|
+
}
|
|
168
|
+
// type
|
|
169
|
+
if (parameter.type) {
|
|
170
|
+
methodParameter.setType((0, builderUtils_1.buildGenericType)(cxxNode2Type(parameter, arkInstance, sourceFile, parameter), arkInstance));
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
methodParameter.setType(Type_1.UnknownType.getInstance());
|
|
174
|
+
}
|
|
175
|
+
parameters.push(methodParameter);
|
|
176
|
+
});
|
|
177
|
+
return parameters;
|
|
178
|
+
}
|
|
179
|
+
exports.buildParameters = buildParameters;
|
|
180
|
+
function buildReturnType(mtdNode, sourceFile, method) {
|
|
181
|
+
let nodeType = mtdNode.type;
|
|
182
|
+
if (nodeType) {
|
|
183
|
+
if (nodeType === null || nodeType === void 0 ? void 0 : nodeType.qualType) {
|
|
184
|
+
const qualType = nodeType.qualType;
|
|
185
|
+
if (qualType.includes('noexcept') && !qualType.includes('noexcept(false)')) {
|
|
186
|
+
method.addModifier((0, ArkBaseModel_1.modifierKind2CxxEnum)('noexcept'));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
let isLambdaFunc = nodeType.qualType.startsWith('(lambda at');
|
|
190
|
+
if (!isLambdaFunc) {
|
|
191
|
+
// Retrieve the function return value portion from the function signature
|
|
192
|
+
mtdNode.type.qualType = nodeType.qualType.split('(')[0].trim();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Lambda function without return value
|
|
196
|
+
return Type_1.UnknownType.getInstance();
|
|
197
|
+
}
|
|
198
|
+
return cxxNode2Type(mtdNode, method, sourceFile);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
return Type_1.UnknownType.getInstance();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
exports.buildReturnType = buildReturnType;
|
|
205
|
+
function isCxxFunctionPointer(type) {
|
|
206
|
+
return FUNC_PTR_REGEX.test(type);
|
|
207
|
+
}
|
|
208
|
+
exports.isCxxFunctionPointer = isCxxFunctionPointer;
|
|
209
|
+
function buildFuncPtrType(funcPtrNode, arkMtd, sourceFile) {
|
|
210
|
+
const anonymousMethod = new ArkMethod_1.ArkMethod();
|
|
211
|
+
const declaringClass = arkMtd.getDeclaringArkClass();
|
|
212
|
+
(0, ArkMethodBuilder_2.buildArkMethodFromArkClass)(funcPtrNode, declaringClass, anonymousMethod, sourceFile);
|
|
213
|
+
const funcType = new Type_1.FunctionType(anonymousMethod.getSignature());
|
|
214
|
+
return new Type_2.PointerType(funcType, 1);
|
|
215
|
+
}
|
|
216
|
+
exports.buildFuncPtrType = buildFuncPtrType;
|
|
217
|
+
/**
|
|
218
|
+
*Convert C++AST node to Type
|
|
219
|
+
*@ param nodeQualType - type information of C++AST node or string type
|
|
220
|
+
*@ param arkInstance - Ark instance (method, class or field) that may contain generic information
|
|
221
|
+
*@ param sourceFile - optional source file node
|
|
222
|
+
*@ returns Type after conversion
|
|
223
|
+
*/
|
|
224
|
+
function cxxNode2Type(nodeQualType, arkInstance, sourceFile, currNode, defaultArg) {
|
|
225
|
+
if (defaultArg) {
|
|
226
|
+
return buildTypeFromPreStr(defaultArg.type.qualType, nodeQualType, arkInstance);
|
|
227
|
+
}
|
|
228
|
+
// Handle function pointer type
|
|
229
|
+
if (currNode && arkInstance instanceof ArkMethod_1.ArkMethod && isCxxFunctionPointer(currNode.type.qualType)) {
|
|
230
|
+
return buildFuncPtrType(currNode, arkInstance, sourceFile);
|
|
231
|
+
}
|
|
232
|
+
// Default processing
|
|
233
|
+
let typeString = getTrueTypeString(nodeQualType);
|
|
234
|
+
if (typeString === '') {
|
|
235
|
+
return Type_1.UnknownType.getInstance();
|
|
236
|
+
}
|
|
237
|
+
if (nodeQualType.kind === 'InitListExpr' && typeString === 'void') {
|
|
238
|
+
let multipleTypePara = [];
|
|
239
|
+
nodeQualType.inner.forEach((item) => {
|
|
240
|
+
multipleTypePara.push(cxxNode2Type(item, arkInstance, sourceFile));
|
|
241
|
+
});
|
|
242
|
+
return new Type_1.UnionType(multipleTypePara);
|
|
243
|
+
}
|
|
244
|
+
return buildTypeFromPreStr(typeString, nodeQualType, arkInstance);
|
|
245
|
+
}
|
|
246
|
+
exports.cxxNode2Type = cxxNode2Type;
|
|
247
|
+
function getTrueTypeString(nodeQualType) {
|
|
248
|
+
var _a, _b, _c;
|
|
249
|
+
if (nodeQualType.kind === 'CXXTypeidExpr' && nodeQualType.typeArg) {
|
|
250
|
+
return (_a = nodeQualType.typeArg.desugaredQualType) !== null && _a !== void 0 ? _a : nodeQualType.typeArg.qualType;
|
|
251
|
+
}
|
|
252
|
+
else if (['TemplateTypeParmDecl', 'TemplateTypeParmVarDecl'].includes(nodeQualType.kind) && nodeQualType.defaultArg) {
|
|
253
|
+
return (_b = nodeQualType.defaultArg.type.desugaredQualType) !== null && _b !== void 0 ? _b : nodeQualType.defaultArg.type.qualType;
|
|
254
|
+
}
|
|
255
|
+
else if (nodeQualType.type) {
|
|
256
|
+
return (_c = nodeQualType.type.desugaredQualType) !== null && _c !== void 0 ? _c : nodeQualType.type.qualType;
|
|
257
|
+
}
|
|
258
|
+
return '';
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
*The corresponding Type object is constructed according to the pre type string and the optional Ark instance.
|
|
262
|
+
*
|
|
263
|
+
*The main processing flow of this function includes:
|
|
264
|
+
*1 Remove modifiers (such as const, static, mutable);
|
|
265
|
+
*2 Judge whether it is a function pointer, and handle pointers and references;
|
|
266
|
+
*3 Type inference to generate basic types;
|
|
267
|
+
*4 Wrap the final Type object according to the pointer level and the number of references.
|
|
268
|
+
*
|
|
269
|
+
*@ param preStr The original pre type string, such as "const int *" or "std:: vector<int>&"
|
|
270
|
+
*@ param arkInstance The optional ArkMethod, ArkClass or ArkField instances are used to assist type construction
|
|
271
|
+
*@ returns Type object constructed
|
|
272
|
+
*/
|
|
273
|
+
function buildTypeFromPreStr(preStr, node, arkInstance) {
|
|
274
|
+
var _a, _b;
|
|
275
|
+
// 1. Remove modifiers such as const/static/mutable
|
|
276
|
+
preStr = preStr.replace(/\b(const|static|mutable)\s*\b/g, '');
|
|
277
|
+
// 2. One traversal simultaneously counts the number of references and pointers, and constructs a base string without references
|
|
278
|
+
let referenceCount = 0;
|
|
279
|
+
let pointerLevel = 0;
|
|
280
|
+
let baseStr = '';
|
|
281
|
+
for (let i = 0; i < preStr.length; i++) {
|
|
282
|
+
const char = preStr[i];
|
|
283
|
+
if (char === '&') {
|
|
284
|
+
referenceCount++;
|
|
285
|
+
}
|
|
286
|
+
else if (char === '*') {
|
|
287
|
+
pointerLevel++;
|
|
288
|
+
baseStr += char; // Keep * characters
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
baseStr += char; // Keep other characters
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
baseStr = baseStr.trim(); // Remove the leading and trailing spaces
|
|
295
|
+
// 3. Handling reference types
|
|
296
|
+
if (referenceCount > 0) {
|
|
297
|
+
return buildReferenceType(baseStr, referenceCount, node, arkInstance);
|
|
298
|
+
}
|
|
299
|
+
// 4. Array judgment
|
|
300
|
+
if (baseStr.includes('[') && baseStr.includes(']')) {
|
|
301
|
+
return buildArrayType(baseStr, node, arkInstance);
|
|
302
|
+
}
|
|
303
|
+
// 5. Handling pointer types
|
|
304
|
+
if (pointerLevel > 0) {
|
|
305
|
+
baseStr = baseStr.replace(/\*/g, '').trim();
|
|
306
|
+
return buildPointerType(baseStr, pointerLevel, node, arkInstance);
|
|
307
|
+
}
|
|
308
|
+
// 6. template
|
|
309
|
+
let templateTypes;
|
|
310
|
+
if (arkInstance instanceof ArkMethod_1.ArkMethod) {
|
|
311
|
+
templateTypes = (_a = arkInstance.getGenericTypes()) !== null && _a !== void 0 ? _a : (_b = arkInstance.getDeclaringArkClass()) === null || _b === void 0 ? void 0 : _b.getGenericsTypes();
|
|
312
|
+
}
|
|
313
|
+
else if (arkInstance instanceof ArkClass_1.ArkClass) {
|
|
314
|
+
templateTypes = arkInstance.getGenericsTypes();
|
|
315
|
+
}
|
|
316
|
+
if (templateTypes) {
|
|
317
|
+
for (const t of templateTypes) {
|
|
318
|
+
if (preStr === t.getName()) {
|
|
319
|
+
return t;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// 7. Base type
|
|
324
|
+
const baseTypeStr = convertDataType(baseStr);
|
|
325
|
+
if (baseTypeStr !== 'unsupported') {
|
|
326
|
+
return TypeInference_1.TypeInference.buildTypeFromStr(baseTypeStr, baseStr);
|
|
327
|
+
}
|
|
328
|
+
// 8.STL Type and custom type
|
|
329
|
+
return buildTypeFromDerivedType(baseStr, node, arkInstance);
|
|
330
|
+
}
|
|
331
|
+
exports.buildTypeFromPreStr = buildTypeFromPreStr;
|
|
332
|
+
function buildArrayType(qualType, node, arkInstance) {
|
|
333
|
+
var _a, _b, _c;
|
|
334
|
+
const count = (_b = (_a = qualType.match(/\[/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
335
|
+
let baseType = buildTypeFromPreStr(qualType.slice(0, qualType.indexOf('[')) +
|
|
336
|
+
qualType.slice(qualType.lastIndexOf(']') + 1), node, arkInstance);
|
|
337
|
+
let dimensionSizes = [];
|
|
338
|
+
const dimensionMatches = qualType.match(/\[(\d*)\]/g);
|
|
339
|
+
if (dimensionMatches) {
|
|
340
|
+
dimensionSizes = dimensionMatches.map(dim => {
|
|
341
|
+
var _a;
|
|
342
|
+
const numStr = (_a = dim.match(/\d+/)) === null || _a === void 0 ? void 0 : _a[0];
|
|
343
|
+
return numStr ? parseInt(numStr, 10) : 0;
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
// If dimensions cannot be extracted from the string, try getting them from node-INNER
|
|
348
|
+
try {
|
|
349
|
+
for (let i = 0; i < count; i++) {
|
|
350
|
+
dimensionSizes.push((_c = Number(node.inner[i].value)) !== null && _c !== void 0 ? _c : 0);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
catch (e) {
|
|
354
|
+
// When a node is of reference type, the processing strategy is to parse the type as much as possible,
|
|
355
|
+
// so it is not directly parsed according to Unclear Reference.
|
|
356
|
+
// At this time, the type field cannot obtain array length information.
|
|
357
|
+
logger.warn(node + 'this node case is unexpect');
|
|
358
|
+
return TypeInference_1.TypeInference.buildTypeFromStr(qualType);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (baseType instanceof Type_1.UnclearReferenceType) {
|
|
362
|
+
return new Type_2.CxxArrayType(new Type_1.UnclearReferenceType(qualType.slice(0, qualType.indexOf('['))), count);
|
|
363
|
+
}
|
|
364
|
+
return new Type_2.CxxArrayType(baseType, count, dimensionSizes);
|
|
365
|
+
}
|
|
366
|
+
exports.buildArrayType = buildArrayType;
|
|
367
|
+
function buildPointerType(preStr, pointerLevel, node, arkInstance) {
|
|
368
|
+
let baseType = buildTypeFromPreStr(preStr, node, arkInstance);
|
|
369
|
+
const pointerType = new Type_2.PointerType(baseType, pointerLevel);
|
|
370
|
+
let oriStr = node.type.qualType;
|
|
371
|
+
const starIndex = oriStr.indexOf('*');
|
|
372
|
+
if (starIndex === -1) {
|
|
373
|
+
return pointerType;
|
|
374
|
+
}
|
|
375
|
+
// Analyze the const keywords to the left and right of the asterisk
|
|
376
|
+
const leftPart = oriStr.substring(0, starIndex);
|
|
377
|
+
const rightPart = oriStr.substring(starIndex + 1);
|
|
378
|
+
pointerType.setIsPointerToVolatileType(/\bvolatile\b/.test(leftPart));
|
|
379
|
+
pointerType.setIsVolatilePointer(/\bvolatile\b/.test(rightPart));
|
|
380
|
+
pointerType.setIsPointerToConst(/\bconst\b/.test(leftPart));
|
|
381
|
+
pointerType.setIsConstPointer(/\bconst\b/.test(rightPart));
|
|
382
|
+
return pointerType;
|
|
383
|
+
}
|
|
384
|
+
exports.buildPointerType = buildPointerType;
|
|
385
|
+
function buildReferenceType(preStr, referenceCount, node, arkInstance) {
|
|
386
|
+
let referCategory = referenceCount % 2 === 1 ? Type_2.ReferCategory.LVALUE_REF : Type_2.ReferCategory.RVALUE_REF;
|
|
387
|
+
// cxxTodo: this need to confirm;
|
|
388
|
+
preStr = preStr.replace(/(\(\))+$/g, '');
|
|
389
|
+
let baseType = buildTypeFromPreStr(preStr, node, arkInstance);
|
|
390
|
+
if (baseType instanceof Type_1.GenericType && referenceCount % 2 === 0) {
|
|
391
|
+
referCategory = Type_2.ReferCategory.UNIVERSAL_REF;
|
|
392
|
+
}
|
|
393
|
+
return new Type_2.ReferenceType(baseType, referCategory);
|
|
394
|
+
}
|
|
395
|
+
exports.buildReferenceType = buildReferenceType;
|
|
396
|
+
function isCXXSTLContainer(qualType) {
|
|
397
|
+
let STLContainerPtn = /(set|map|vector|queue|deque|stack|list|pair)<[^>]*>/g;
|
|
398
|
+
return STLContainerPtn.test(qualType);
|
|
399
|
+
}
|
|
400
|
+
exports.isCXXSTLContainer = isCXXSTLContainer;
|
|
401
|
+
function isFuncInClassOrNamespace(callNode) {
|
|
402
|
+
return callNode.kind === 'DeclRefExpr' && callNode.inner.length === 0 &&
|
|
403
|
+
callNode.code.includes('::') && !callNode.code.startsWith(Builtin_1.BuiltinCxx.CXXSTDREF);
|
|
404
|
+
}
|
|
405
|
+
exports.isFuncInClassOrNamespace = isFuncInClassOrNamespace;
|
|
406
|
+
function isCxxBasicString(qualType) {
|
|
407
|
+
const preType = qualType.replace(/\b(const|static|mutable)\s*\b/g, '');
|
|
408
|
+
return convertDataType(preType) === 'string';
|
|
409
|
+
}
|
|
410
|
+
exports.isCxxBasicString = isCxxBasicString;
|
|
411
|
+
function buildTypeFromDerivedType(preStr, node, arkInstance) {
|
|
412
|
+
var _a, _b, _c, _d, _e, _f;
|
|
413
|
+
const outerPartMatch = preStr.match(/^([^<]+)/);
|
|
414
|
+
const outerPart = outerPartMatch ? outerPartMatch[1] : null;
|
|
415
|
+
let typeStr;
|
|
416
|
+
let firstSpaceIndex;
|
|
417
|
+
if (outerPart === null) {
|
|
418
|
+
firstSpaceIndex = preStr.indexOf(' ');
|
|
419
|
+
typeStr = firstSpaceIndex === -1 ? preStr : preStr.substring(firstSpaceIndex + 1);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
firstSpaceIndex = outerPart.indexOf(' ');
|
|
423
|
+
typeStr = firstSpaceIndex === -1 ? outerPart : outerPart.substring(firstSpaceIndex + 1);
|
|
424
|
+
}
|
|
425
|
+
const innerPartMatch = preStr.match(/<([^>]+)>/);
|
|
426
|
+
const innerPart = innerPartMatch ? innerPartMatch[1] : null;
|
|
427
|
+
let innerType = innerPart === null ? [] : [buildTypeFromPreStr(innerPart, node, arkInstance)];
|
|
428
|
+
if (arkInstance instanceof ArkMethod_1.ArkMethod) {
|
|
429
|
+
// Obtain the use of alias types
|
|
430
|
+
let aliasType = (_a = arkInstance.getBody()) === null || _a === void 0 ? void 0 : _a.getAliasTypeByName(typeStr);
|
|
431
|
+
if (aliasType) {
|
|
432
|
+
return aliasType;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
let arkClass = null;
|
|
436
|
+
if (arkInstance instanceof ArkMethod_1.ArkMethod || arkInstance instanceof ArkClass_1.ArkClass) {
|
|
437
|
+
const file = (_b = arkInstance.getDeclaringArkFile) === null || _b === void 0 ? void 0 : _b.call(arkInstance);
|
|
438
|
+
arkClass = (_d = (_c = file === null || file === void 0 ? void 0 : file.getClassWithName) === null || _c === void 0 ? void 0 : _c.call(file, typeStr)) !== null && _d !== void 0 ? _d : ModelUtils_1.CxxModelUtils.getClassFromAnonymousNamespaceByName(typeStr, file);
|
|
439
|
+
// Obtain the use of alias types
|
|
440
|
+
let aliasType = (_f = (_e = file === null || file === void 0 ? void 0 : file.getDefaultClass().getDefaultArkMethod()) === null || _e === void 0 ? void 0 : _e.getBody()) === null || _f === void 0 ? void 0 : _f.getAliasTypeByName(typeStr);
|
|
441
|
+
if (aliasType) {
|
|
442
|
+
return aliasType;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (arkClass) {
|
|
446
|
+
return new Type_1.ClassType(arkClass.getSignature(), innerType);
|
|
447
|
+
}
|
|
448
|
+
return TypeInference_1.TypeInference.buildTypeFromStr(preStr);
|
|
449
|
+
}
|
|
450
|
+
exports.buildTypeFromDerivedType = buildTypeFromDerivedType;
|
|
451
|
+
const typeMap = {
|
|
452
|
+
bool: 'boolean',
|
|
453
|
+
// String
|
|
454
|
+
string: 'string',
|
|
455
|
+
'std::string': 'string',
|
|
456
|
+
char: 'string',
|
|
457
|
+
'signed char': 'string',
|
|
458
|
+
'unsigned char': 'string',
|
|
459
|
+
'unsignedchar': 'string',
|
|
460
|
+
wchar_t: 'string',
|
|
461
|
+
char16_t: 'string',
|
|
462
|
+
char32_t: 'string',
|
|
463
|
+
'std::basic_string<char>': 'string',
|
|
464
|
+
'basic_string<char>': 'string',
|
|
465
|
+
// Number
|
|
466
|
+
short: 'number',
|
|
467
|
+
'unsigned short': 'number',
|
|
468
|
+
'unsigned int': 'number',
|
|
469
|
+
int: 'number',
|
|
470
|
+
long: 'number',
|
|
471
|
+
'unsigned long': 'number',
|
|
472
|
+
'long long': 'number',
|
|
473
|
+
'unsigned long long': 'number',
|
|
474
|
+
float: 'number',
|
|
475
|
+
double: 'number',
|
|
476
|
+
'long double': 'number',
|
|
477
|
+
uint8_t: 'number',
|
|
478
|
+
uint16_t: 'number',
|
|
479
|
+
uint32_t: 'number',
|
|
480
|
+
uint64_t: 'number',
|
|
481
|
+
int8_t: 'number',
|
|
482
|
+
int16_t: 'number',
|
|
483
|
+
int32_t: 'number',
|
|
484
|
+
int64_t: 'number',
|
|
485
|
+
size_t: 'number',
|
|
486
|
+
intptr_t: 'number',
|
|
487
|
+
uintptr_t: 'number',
|
|
488
|
+
// void
|
|
489
|
+
void: 'void',
|
|
490
|
+
'std::type_info': 'type_info',
|
|
491
|
+
'type_info': 'type_info',
|
|
492
|
+
auto: 'auto',
|
|
493
|
+
};
|
|
494
|
+
function convertDataType(typeName) {
|
|
495
|
+
var _a;
|
|
496
|
+
const formattedTypeName = typeName.replace(Builtin_1.BuiltinCxx.CXXSTDREF, '');
|
|
497
|
+
return (_a = typeMap[formattedTypeName]) !== null && _a !== void 0 ? _a : 'unsupported';
|
|
498
|
+
}
|
|
499
|
+
exports.convertDataType = convertDataType;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare class CmakeUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Scan the CMakeLists.txt files in the directory and obtain all dependent header file directories.
|
|
4
|
+
* @param dir - the target project directory.
|
|
5
|
+
* @returns - include directories set by CMakeLists.txt
|
|
6
|
+
*/
|
|
7
|
+
static scanCMakeIncludeDirsOnly(dir: string): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Get the variable and definition in the set statements, e.g. set(VAR value)
|
|
10
|
+
* @param line - The line content in CMakeLists.
|
|
11
|
+
* @returns - an array containing variable names and set values, or null
|
|
12
|
+
*/
|
|
13
|
+
private static extractSetVar;
|
|
14
|
+
/**
|
|
15
|
+
* Recursively parse variables in current CMakeLists.
|
|
16
|
+
* @param val - the definition of variables. e.g. set(VAR value)
|
|
17
|
+
* @param varTable - variable definition record
|
|
18
|
+
* @param depth - current recursive depth
|
|
19
|
+
* @returns - include directory set by Set statement.
|
|
20
|
+
*/
|
|
21
|
+
private static resolveCMakeVar;
|
|
22
|
+
/**
|
|
23
|
+
* Determine whether the current line is the start of include_directories or target_include_directories,
|
|
24
|
+
* If so, enter the collection state and handle scenarios where a single line is immediately closed.
|
|
25
|
+
* @param line - The line content in CMakeLists.
|
|
26
|
+
* @param results - Include directories.
|
|
27
|
+
* @returns new collecting state, funcType, buffer(supporting multi-line parameters).
|
|
28
|
+
*/
|
|
29
|
+
private static tryStartCollectingIncludeDirs;
|
|
30
|
+
/**
|
|
31
|
+
* Extract all include directories from CMakeLists.
|
|
32
|
+
* @param lines - All lines in CMakeLists.
|
|
33
|
+
* @returns - include Directories.
|
|
34
|
+
*/
|
|
35
|
+
private static extractAllIncludeDirs;
|
|
36
|
+
/**
|
|
37
|
+
* Parse parameters in line buffer.
|
|
38
|
+
* @param buffer - line buffer.
|
|
39
|
+
* @param isTarget - is it a target variable name
|
|
40
|
+
* @returns - parameters.
|
|
41
|
+
*/
|
|
42
|
+
private static parseCMakeArgs;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=cmakeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmakeUtils.d.ts","sourceRoot":"","sources":["../../../../src/frontend/cppFrontend/utils/cmakeUtils.ts"],"names":[],"mappings":"AAkBA,qBAAa,UAAU;IAEnB;;;;OAIG;WACW,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAyD7D;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAS5B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAa9B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAmC5C;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IA2BpC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;CAwDhC"}
|