arkanalyzer 1.0.93 → 2.0.0-beta1
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/lib/Config.d.ts +7 -0
- package/lib/Config.d.ts.map +1 -1
- package/lib/Scene.d.ts +134 -170
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +412 -976
- package/lib/callgraph/algorithm/AbstractAnalysis.js +3 -2
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +2 -3
- package/lib/callgraph/model/CallGraph.js +1 -1
- package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts +1 -3
- package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PTAUtils.js +17 -7
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.js +4 -14
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +2 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +1 -2
- package/lib/callgraph/pointerAnalysis/plugins/WorkerPlugin.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/plugins/WorkerPlugin.js +0 -1
- package/lib/cli/commands/cg.d.ts +1 -0
- package/lib/cli/commands/cg.d.ts.map +1 -1
- package/lib/cli/commands/cg.js +22 -18
- package/lib/cli/commands/ir.d.ts +1 -0
- package/lib/cli/commands/ir.d.ts.map +1 -1
- package/lib/cli/commands/ir.js +5 -2
- package/lib/core/base/Constant.d.ts +5 -5
- package/lib/core/base/Constant.d.ts.map +1 -1
- package/lib/core/base/Constant.js +12 -9
- package/lib/core/base/Expr.d.ts +36 -20
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +206 -94
- package/lib/core/base/Local.d.ts +10 -20
- package/lib/core/base/Local.d.ts.map +1 -1
- package/lib/core/base/Local.js +25 -28
- package/lib/core/base/Position.d.ts +6 -0
- package/lib/core/base/Position.d.ts.map +1 -1
- package/lib/core/base/Position.js +37 -11
- package/lib/core/base/Ref.d.ts +45 -33
- package/lib/core/base/Ref.d.ts.map +1 -1
- package/lib/core/base/Ref.js +225 -51
- package/lib/core/base/Stmt.d.ts +19 -9
- package/lib/core/base/Stmt.d.ts.map +1 -1
- package/lib/core/base/Stmt.js +135 -52
- package/lib/core/base/Type.d.ts +67 -4
- package/lib/core/base/Type.d.ts.map +1 -1
- package/lib/core/base/Type.js +391 -20
- package/lib/core/base/TypeExpr.d.ts +6 -4
- package/lib/core/base/TypeExpr.d.ts.map +1 -1
- package/lib/core/base/TypeExpr.js +34 -10
- package/lib/core/base/Value.d.ts +20 -2
- package/lib/core/base/Value.d.ts.map +1 -1
- package/lib/core/base/Value.js +12 -0
- package/lib/core/common/ArkIRTransformer.d.ts +18 -0
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +94 -75
- package/lib/core/common/ArkValueTransformer.d.ts +21 -3
- package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkValueTransformer.js +458 -266
- package/lib/core/common/Builtin.d.ts +48 -24
- package/lib/core/common/Builtin.d.ts.map +1 -1
- package/lib/core/common/Builtin.js +90 -52
- package/lib/core/common/CanonicalizerValidator.d.ts +308 -0
- package/lib/core/common/CanonicalizerValidator.d.ts.map +1 -0
- package/lib/core/common/CanonicalizerValidator.js +888 -0
- package/lib/core/common/Const.d.ts +3 -3
- package/lib/core/common/Const.d.ts.map +1 -1
- package/lib/core/common/Const.js +3 -3
- package/lib/core/common/DummyMainCreater.d.ts +2 -21
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
- package/lib/core/common/DummyMainCreater.js +8 -105
- package/lib/core/common/IRInference.d.ts +55 -3
- package/lib/core/common/IRInference.d.ts.map +1 -1
- package/lib/core/common/IRInference.js +407 -126
- package/lib/core/common/IRUtils.d.ts +1 -0
- package/lib/core/common/IRUtils.d.ts.map +1 -1
- package/lib/core/common/IRUtils.js +44 -13
- package/lib/core/common/ModelUtils.d.ts +44 -20
- package/lib/core/common/ModelUtils.d.ts.map +1 -1
- package/lib/core/common/ModelUtils.js +378 -208
- package/lib/core/common/SdkUtils.d.ts +35 -5
- package/lib/core/common/SdkUtils.d.ts.map +1 -1
- package/lib/core/common/SdkUtils.js +203 -59
- package/lib/core/common/SignatureCanonicalizer.d.ts +95 -0
- package/lib/core/common/SignatureCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/SignatureCanonicalizer.js +116 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.d.ts +176 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.d.ts.map +1 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.js +343 -0
- package/lib/core/common/SignatureModelCanonicalizer.d.ts +69 -0
- package/lib/core/common/SignatureModelCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/SignatureModelCanonicalizer.js +109 -0
- package/lib/core/common/StmtUseReplacer.d.ts +1 -0
- package/lib/core/common/StmtUseReplacer.d.ts.map +1 -1
- package/lib/core/common/StmtUseReplacer.js +9 -0
- package/lib/core/common/StringUtils.d.ts +12 -1
- package/lib/core/common/StringUtils.d.ts.map +1 -1
- package/lib/core/common/StringUtils.js +36 -17
- package/lib/core/common/TempSignatureCanonicalizer.d.ts +82 -0
- package/lib/core/common/TempSignatureCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/TempSignatureCanonicalizer.js +177 -0
- package/lib/core/common/TypeInference.d.ts +24 -6
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +243 -117
- package/lib/core/common/ValueUtil.d.ts +2 -1
- package/lib/core/common/ValueUtil.d.ts.map +1 -1
- package/lib/core/common/ValueUtil.js +4 -1
- package/lib/core/graph/Cfg.d.ts.map +1 -1
- package/lib/core/graph/Cfg.js +21 -6
- package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/CfgBuilder.js +46 -33
- package/lib/core/graph/builder/IfBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/IfBuilder.js +6 -2
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/ViewTreeBuilder.js +6 -2
- package/lib/core/inference/ModelInference.d.ts +24 -4
- package/lib/core/inference/ModelInference.d.ts.map +1 -1
- package/lib/core/inference/ModelInference.js +273 -79
- 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 +90 -40
- package/lib/core/inference/abc/AbcInference.d.ts.map +1 -1
- package/lib/core/inference/abc/AbcInference.js +28 -15
- package/lib/core/inference/arkts/ArkTsInference.d.ts +9 -3
- package/lib/core/inference/arkts/ArkTsInference.d.ts.map +1 -1
- package/lib/core/inference/arkts/ArkTsInference.js +54 -16
- package/lib/core/model/ArkClass.d.ts +192 -18
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +852 -122
- package/lib/core/model/ArkExport.d.ts.map +1 -1
- package/lib/core/model/ArkExport.js +1 -2
- package/lib/core/model/ArkField.d.ts +34 -2
- package/lib/core/model/ArkField.d.ts.map +1 -1
- package/lib/core/model/ArkField.js +89 -14
- package/lib/core/model/ArkFile.d.ts +72 -12
- package/lib/core/model/ArkFile.d.ts.map +1 -1
- package/lib/core/model/ArkFile.js +275 -65
- package/lib/core/model/ArkImport.d.ts.map +1 -1
- package/lib/core/model/ArkImport.js +1 -2
- package/lib/core/model/ArkMethod.d.ts +101 -15
- package/lib/core/model/ArkMethod.d.ts.map +1 -1
- package/lib/core/model/ArkMethod.js +252 -39
- package/lib/core/model/ArkModule.d.ts +1 -1
- package/lib/core/model/ArkModule.js +1 -1
- package/lib/core/model/ArkNamespace.d.ts +80 -10
- package/lib/core/model/ArkNamespace.d.ts.map +1 -1
- package/lib/core/model/ArkNamespace.js +309 -76
- package/lib/core/model/ArkSignature.d.ts +242 -18
- package/lib/core/model/ArkSignature.d.ts.map +1 -1
- package/lib/core/model/ArkSignature.js +725 -95
- package/lib/core/model/builder/ArkClassBuilder.d.ts +6 -3
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +119 -73
- package/lib/core/model/builder/ArkExportBuilder.d.ts +1 -1
- package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkExportBuilder.js +1 -1
- package/lib/core/model/builder/ArkFieldBuilder.d.ts +0 -2
- package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkFieldBuilder.js +9 -43
- package/lib/core/model/builder/ArkFileBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkFileBuilder.js +32 -33
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +10 -3
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +40 -26
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts +3 -2
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkNamespaceBuilder.js +45 -77
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts +9 -0
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkSignatureBuilder.js +26 -3
- package/lib/core/model/builder/BodyBuilder.d.ts +1 -0
- package/lib/core/model/builder/BodyBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/BodyBuilder.js +37 -11
- package/lib/core/model/builder/builderUtils.d.ts +11 -1
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.js +124 -90
- package/lib/frontend/FrontendBuilder.d.ts +10 -6
- package/lib/frontend/FrontendBuilder.d.ts.map +1 -1
- package/lib/frontend/FrontendBuilder.js +19 -45
- package/lib/frontend/ModuleScene.d.ts +43 -0
- package/lib/frontend/ModuleScene.d.ts.map +1 -0
- package/lib/frontend/ModuleScene.js +143 -0
- package/lib/frontend/SceneBuildStage.d.ts +15 -0
- package/lib/frontend/SceneBuildStage.d.ts.map +1 -0
- package/lib/frontend/SceneBuildStage.js +32 -0
- package/lib/frontend/SceneBuilder.d.ts +153 -0
- package/lib/frontend/SceneBuilder.d.ts.map +1 -0
- package/lib/frontend/SceneBuilder.js +859 -0
- package/lib/frontend/arktsFrontend/ArktsFrontend.d.ts +0 -2
- package/lib/frontend/arktsFrontend/ArktsFrontend.d.ts.map +1 -1
- package/lib/frontend/arktsFrontend/ArktsFrontend.js +0 -18
- package/lib/frontend/arktsFrontend/FileBodyRemount.d.ts +17 -0
- package/lib/frontend/arktsFrontend/FileBodyRemount.d.ts.map +1 -0
- package/lib/frontend/arktsFrontend/FileBodyRemount.js +187 -0
- package/lib/frontend/common/ModuleBuilder.d.ts +4 -2
- package/lib/frontend/common/ModuleBuilder.d.ts.map +1 -1
- package/lib/frontend/common/ModuleBuilder.js +19 -9
- package/lib/frontend/cppFrontend/CppFrontend.d.ts +0 -6
- package/lib/frontend/cppFrontend/CppFrontend.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/CppFrontend.js +0 -56
- package/lib/frontend/cppFrontend/base/Type.d.ts +7 -0
- package/lib/frontend/cppFrontend/base/Type.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/base/Type.js +29 -0
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.js +56 -56
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts +1 -1
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.js +124 -113
- package/lib/frontend/cppFrontend/common/Builtin.d.ts +29 -19
- package/lib/frontend/cppFrontend/common/Builtin.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/Builtin.js +56 -35
- package/lib/frontend/cppFrontend/common/IRInference.d.ts +7 -2
- package/lib/frontend/cppFrontend/common/IRInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/IRInference.js +61 -28
- package/lib/frontend/cppFrontend/common/IRUtils.d.ts +1 -0
- package/lib/frontend/cppFrontend/common/IRUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/IRUtils.js +22 -10
- package/lib/frontend/cppFrontend/common/ModelUtils.d.ts +19 -0
- package/lib/frontend/cppFrontend/common/ModelUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ModelUtils.js +84 -3
- package/lib/frontend/cppFrontend/common/TypeInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/TypeInference.js +44 -54
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.js +2 -1
- package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts +1 -1
- package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/inference/CxxValueInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/inference/CxxValueInference.js +41 -5
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.js +18 -28
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.js +2 -3
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts +2 -2
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.js +31 -24
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.js +10 -16
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts +0 -2
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.js +19 -37
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts +1 -0
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.js +30 -3
- package/lib/frontend/cppFrontend/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/builderUtils.js +8 -4
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -2
- package/lib/save/json/JsonSerialization.js +2 -2
- package/lib/save/source/SourceStmt.js +1 -1
- package/lib/save/source/SourceTransformer.d.ts.map +1 -1
- package/lib/save/source/SourceTransformer.js +0 -9
- package/lib/statistics/StageStatistics.d.ts +195 -0
- package/lib/statistics/StageStatistics.d.ts.map +1 -0
- package/lib/statistics/StageStatistics.js +346 -0
- package/lib/statistics/StageStatisticsReporter.d.ts +58 -0
- package/lib/statistics/StageStatisticsReporter.d.ts.map +1 -0
- package/lib/statistics/StageStatisticsReporter.js +255 -0
- package/lib/utils/Canonicalizer.d.ts +9 -2
- package/lib/utils/Canonicalizer.d.ts.map +1 -1
- package/lib/utils/Canonicalizer.js +19 -2
- package/lib/utils/CxxSceneUtils.d.ts +7 -0
- package/lib/utils/CxxSceneUtils.d.ts.map +1 -1
- package/lib/utils/CxxSceneUtils.js +10 -1
- package/lib/utils/FileUtils.d.ts +0 -1
- package/lib/utils/FileUtils.d.ts.map +1 -1
- package/lib/utils/FileUtils.js +1 -9
- package/lib/utils/HashUtils.d.ts +9 -0
- package/lib/utils/HashUtils.d.ts.map +1 -0
- package/lib/utils/HashUtils.js +65 -0
- package/lib/utils/ModuleUtils.d.ts.map +1 -1
- package/lib/utils/ModuleUtils.js +24 -5
- package/lib/utils/VisitedSegment.d.ts +23 -0
- package/lib/utils/VisitedSegment.d.ts.map +1 -0
- package/lib/utils/VisitedSegment.js +64 -0
- package/lib/utils/callGraphUtils.d.ts.map +1 -1
- package/lib/utils/callGraphUtils.js +7 -7
- package/lib/utils/getAllFiles.d.ts.map +1 -1
- package/lib/utils/getAllFiles.js +11 -8
- package/lib/utils/logger.d.ts +4 -0
- package/lib/utils/logger.d.ts.map +1 -1
- package/lib/utils/logger.js +16 -0
- package/lib/utils/parseArkSourceFile.d.ts +33 -0
- package/lib/utils/parseArkSourceFile.d.ts.map +1 -0
- package/lib/utils/parseArkSourceFile.js +131 -0
- package/package.json +1 -1
- package/lib/node_modules/ohos-typescript/README.OpenSource +0 -11
- package/lib/node_modules/ohos-typescript/README.md +0 -81
- package/lib/node_modules/ohos-typescript/SECURITY.md +0 -41
- package/lib/node_modules/ohos-typescript/ThirdPartyNoticeText.txt +0 -193
- package/lib/node_modules/ohos-typescript/bin/tsc +0 -2
- package/lib/node_modules/ohos-typescript/bin/tsserver +0 -2
- package/lib/node_modules/ohos-typescript/lib/README.md +0 -5
- package/lib/node_modules/ohos-typescript/lib/cancellationToken.js +0 -86
- package/lib/node_modules/ohos-typescript/lib/cs/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/de/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/es/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/fr/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/it/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ja/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ko/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/lib.dom.d.ts +0 -18505
- package/lib/node_modules/ohos-typescript/lib/lib.dom.iterable.d.ts +0 -341
- package/lib/node_modules/ohos-typescript/lib/lib.scripthost.d.ts +0 -327
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.d.ts +0 -6192
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.importscripts.d.ts +0 -26
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.iterable.d.ts +0 -175
- package/lib/node_modules/ohos-typescript/lib/pl/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/pt-br/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ru/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/tr/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/tsc.js +0 -114551
- package/lib/node_modules/ohos-typescript/lib/tsserver.js +0 -179691
- package/lib/node_modules/ohos-typescript/lib/tsserverlibrary.d.ts +0 -13648
- package/lib/node_modules/ohos-typescript/lib/tsserverlibrary.js +0 -178688
- package/lib/node_modules/ohos-typescript/lib/typesMap.json +0 -497
- package/lib/node_modules/ohos-typescript/lib/typingsInstaller.js +0 -39871
- package/lib/node_modules/ohos-typescript/lib/watchGuard.js +0 -49
- package/lib/node_modules/ohos-typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -1880
- package/lib/utils/DependenciesSort.d.ts +0 -3
- package/lib/utils/DependenciesSort.d.ts.map +0 -1
- package/lib/utils/DependenciesSort.js +0 -72
- package/lib/utils/crypto_utils.d.ts +0 -6
- package/lib/utils/crypto_utils.d.ts.map +0 -1
- package/lib/utils/crypto_utils.js +0 -57
|
@@ -43,7 +43,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
43
43
|
exports.FrontendBuilder = void 0;
|
|
44
44
|
const path_1 = __importDefault(require("path"));
|
|
45
45
|
const ArkFile_1 = require("../core/model/ArkFile");
|
|
46
|
-
const
|
|
46
|
+
const SceneBuildStage_1 = require("./SceneBuildStage");
|
|
47
47
|
const ArktsFrontend_1 = require("./arktsFrontend/ArktsFrontend");
|
|
48
48
|
const CppFrontend_1 = require("./cppFrontend/CppFrontend");
|
|
49
49
|
const ArkFile_2 = require("../core/model/ArkFile");
|
|
@@ -64,49 +64,6 @@ const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER,
|
|
|
64
64
|
* vs the C++ builder.
|
|
65
65
|
*/
|
|
66
66
|
class FrontendBuilder {
|
|
67
|
-
static partitionFilePaths(scene, filePaths) {
|
|
68
|
-
const cppFiles = [];
|
|
69
|
-
const arktsFiles = [];
|
|
70
|
-
for (const filePath of filePaths) {
|
|
71
|
-
if (FileUtils_1.FileUtils.getFileLanguage(filePath, scene.getFileLanguages()) === ArkFile_1.Language.CXX) {
|
|
72
|
-
cppFiles.push(filePath);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
arktsFiles.push(filePath);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return { cppFiles, arktsFiles };
|
|
79
|
-
}
|
|
80
|
-
static collectFailedFilePaths(scene, failedFiles) {
|
|
81
|
-
for (const failed of failedFiles) {
|
|
82
|
-
logger.error('Error parsing file:', failed.filePath, failed.reason);
|
|
83
|
-
scene.addUnhandledFilePath(failed.filePath);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
static buildFilesIntoArkFiles(scene, filePaths) {
|
|
87
|
-
const { cppFiles, arktsFiles } = this.partitionFilePaths(scene, filePaths);
|
|
88
|
-
const arktsFrontend = new ArktsFrontend_1.ArktsFrontend();
|
|
89
|
-
const cppFrontend = new CppFrontend_1.CppFrontend();
|
|
90
|
-
const arktsResult = arktsFrontend.buildProjectFiles(scene, arktsFiles);
|
|
91
|
-
const cppResult = cppFrontend.buildProjectFiles(scene, cppFiles);
|
|
92
|
-
arktsResult.arkFiles.forEach(file => scene.setFile(file));
|
|
93
|
-
cppResult.arkFiles.forEach(file => scene.setFile(file));
|
|
94
|
-
this.collectFailedFilePaths(scene, [...arktsResult.failedFiles, ...cppResult.failedFiles]);
|
|
95
|
-
}
|
|
96
|
-
static buildModuleFilesIntoArkFiles(moduleScene, filePaths) {
|
|
97
|
-
const scene = moduleScene.getProjectScene();
|
|
98
|
-
const { cppFiles, arktsFiles } = this.partitionFilePaths(scene, filePaths);
|
|
99
|
-
const arktsFrontend = new ArktsFrontend_1.ArktsFrontend();
|
|
100
|
-
const cppFrontend = new CppFrontend_1.CppFrontend();
|
|
101
|
-
const arktsResult = arktsFrontend.buildProjectFiles(scene, arktsFiles);
|
|
102
|
-
const cppResult = cppFrontend.buildProjectFiles(scene, cppFiles);
|
|
103
|
-
[...arktsResult.arkFiles, ...cppResult.arkFiles].forEach(file => {
|
|
104
|
-
file.setModuleScene(moduleScene);
|
|
105
|
-
moduleScene.addArkFile(file);
|
|
106
|
-
scene.setFile(file);
|
|
107
|
-
});
|
|
108
|
-
this.collectFailedFilePaths(scene, [...arktsResult.failedFiles, ...cppResult.failedFiles]);
|
|
109
|
-
}
|
|
110
67
|
/**
|
|
111
68
|
* Builds a single project file into a pre-allocated {@link ArkFile} (the former `if (CXX) … else …` in `Scene`).
|
|
112
69
|
*/
|
|
@@ -263,6 +220,23 @@ class FrontendBuilder {
|
|
|
263
220
|
method.freeBodyBuilder();
|
|
264
221
|
}
|
|
265
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Build the body of every class's default method (%dflt) in the file and free its builder.
|
|
225
|
+
* %dflt methods hold the file-level (or namespace-level) top-level statements and their
|
|
226
|
+
* builder is mounted on a node that a re-parse cannot address by position (the file or
|
|
227
|
+
* namespace node itself), so they are built while the signature round's AST is still mounted.
|
|
228
|
+
* All other method builders are untouched.
|
|
229
|
+
*/
|
|
230
|
+
static buildDefaultMethodBodies(arkFile) {
|
|
231
|
+
for (const cls of ModelUtils_1.ModelUtils.getAllClassesInFile(arkFile)) {
|
|
232
|
+
const defaultMethod = cls.getDefaultArkMethod();
|
|
233
|
+
if (!defaultMethod) {
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
defaultMethod.buildBody();
|
|
237
|
+
defaultMethod.freeBodyBuilder();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
266
240
|
/**
|
|
267
241
|
* Release the BodyBuilders mounted during signature building so the ArkFile retains only
|
|
268
242
|
* signatures (no ArkBody/CFG) and does not retain AST/build context in memory. Mirrors the
|
|
@@ -304,7 +278,7 @@ class FrontendBuilder {
|
|
|
304
278
|
static buildModuleMethodBody(module) {
|
|
305
279
|
const scene = module.getScene();
|
|
306
280
|
const prevStage = scene.getStage();
|
|
307
|
-
scene.setBuildStage(
|
|
281
|
+
scene.setBuildStage(SceneBuildStage_1.SceneBuildStage.CLASS_DONE);
|
|
308
282
|
try {
|
|
309
283
|
// Phase 2a: build method bodies for all methods in the module's files.
|
|
310
284
|
const methods = [];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ArkFile } from '../core/model/ArkFile';
|
|
2
|
+
import type { Scene } from '../Scene';
|
|
3
|
+
/**
|
|
4
|
+
* Module-scoped view over a harmony project module (extracted from Scene.ts during the
|
|
5
|
+
* build-machinery migration into frontend; Scene.ts re-exports it for compatibility).
|
|
6
|
+
*
|
|
7
|
+
* Holds the module's name/path, its oh-package.json5 content, and its files
|
|
8
|
+
* (keyed by FileSigID). File building itself delegates to the project Scene's DFS
|
|
9
|
+
* ({@link Scene.getDependencyFilesDeeply}); the module association of each file is
|
|
10
|
+
* performed inside that DFS via addArkFile2ModuleScene — therefore a ModuleScene
|
|
11
|
+
* instance must be registered in the Scene's moduleScenesMap *before* its files
|
|
12
|
+
* are built.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ModuleScene {
|
|
15
|
+
private projectScene;
|
|
16
|
+
private moduleName;
|
|
17
|
+
private modulePath;
|
|
18
|
+
private moduleFileMap;
|
|
19
|
+
private moduleOhPkgFilePath;
|
|
20
|
+
private ohPkgContent;
|
|
21
|
+
constructor(projectScene: Scene);
|
|
22
|
+
getProjectScene(): Scene;
|
|
23
|
+
ModuleSceneBuilder(moduleName: string, modulePath: string, supportFileExts: string[], recursively?: boolean): void;
|
|
24
|
+
ModuleScenePartiallyBuilder(moduleName: string, modulePath: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* get oh-package.json5
|
|
27
|
+
*/
|
|
28
|
+
private getModuleOhPkgFilePath;
|
|
29
|
+
/**
|
|
30
|
+
* get nodule name
|
|
31
|
+
* @returns return module name
|
|
32
|
+
*/
|
|
33
|
+
getModuleName(): string;
|
|
34
|
+
getModulePath(): string;
|
|
35
|
+
getOhPkgFilePath(): string;
|
|
36
|
+
getOhPkgContent(): {
|
|
37
|
+
[p: string]: unknown;
|
|
38
|
+
};
|
|
39
|
+
getModuleFilesMap(): Map<number, ArkFile>;
|
|
40
|
+
addArkFile(arkFile: ArkFile): void;
|
|
41
|
+
private genArkFiles;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ModuleScene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleScene.d.ts","sourceRoot":"","sources":["../../src/frontend/ModuleScene.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAKhD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAItC;;;;;;;;;;GAUG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,aAAa,CAAmC;IAExD,OAAO,CAAC,mBAAmB,CAAc;IACzC,OAAO,CAAC,YAAY,CAAgC;gBAExC,YAAY,EAAE,KAAK;IAIxB,eAAe,IAAI,KAAK;IAIxB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,WAAW,GAAE,OAAe,GAAG,IAAI;IAczH,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAUhF;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;;OAGG;IACI,aAAa,IAAI,MAAM;IAIvB,aAAa,IAAI,MAAM;IAIvB,gBAAgB,IAAI,MAAM;IAI1B,eAAe,IAAI;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE;IAI3C,iBAAiB,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAIzC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIzC,OAAO,CAAC,WAAW;CAetB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
40
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.ModuleScene = void 0;
|
|
44
|
+
const fs_1 = __importDefault(require("fs"));
|
|
45
|
+
const path_1 = __importDefault(require("path"));
|
|
46
|
+
const EtsConst_1 = require("../core/common/EtsConst");
|
|
47
|
+
const json5parser_1 = require("../utils/json5parser");
|
|
48
|
+
const getAllFiles_1 = require("../utils/getAllFiles");
|
|
49
|
+
const logger_1 = __importStar(require("../utils/logger"));
|
|
50
|
+
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ModuleScene');
|
|
51
|
+
/**
|
|
52
|
+
* Module-scoped view over a harmony project module (extracted from Scene.ts during the
|
|
53
|
+
* build-machinery migration into frontend; Scene.ts re-exports it for compatibility).
|
|
54
|
+
*
|
|
55
|
+
* Holds the module's name/path, its oh-package.json5 content, and its files
|
|
56
|
+
* (keyed by FileSigID). File building itself delegates to the project Scene's DFS
|
|
57
|
+
* ({@link Scene.getDependencyFilesDeeply}); the module association of each file is
|
|
58
|
+
* performed inside that DFS via addArkFile2ModuleScene — therefore a ModuleScene
|
|
59
|
+
* instance must be registered in the Scene's moduleScenesMap *before* its files
|
|
60
|
+
* are built.
|
|
61
|
+
*/
|
|
62
|
+
class ModuleScene {
|
|
63
|
+
constructor(projectScene) {
|
|
64
|
+
this.moduleName = '';
|
|
65
|
+
this.modulePath = '';
|
|
66
|
+
this.moduleFileMap = new Map();
|
|
67
|
+
this.moduleOhPkgFilePath = '';
|
|
68
|
+
this.ohPkgContent = {};
|
|
69
|
+
this.projectScene = projectScene;
|
|
70
|
+
}
|
|
71
|
+
getProjectScene() {
|
|
72
|
+
return this.projectScene;
|
|
73
|
+
}
|
|
74
|
+
ModuleSceneBuilder(moduleName, modulePath, supportFileExts, recursively = false) {
|
|
75
|
+
this.moduleName = moduleName;
|
|
76
|
+
this.modulePath = modulePath;
|
|
77
|
+
this.getModuleOhPkgFilePath();
|
|
78
|
+
if (this.moduleOhPkgFilePath) {
|
|
79
|
+
this.ohPkgContent = (0, json5parser_1.fetchDependenciesFromFile)(this.moduleOhPkgFilePath);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
logger.warn('This module has no oh-package.json5!');
|
|
83
|
+
}
|
|
84
|
+
this.genArkFiles(supportFileExts);
|
|
85
|
+
}
|
|
86
|
+
ModuleScenePartiallyBuilder(moduleName, modulePath) {
|
|
87
|
+
this.moduleName = moduleName;
|
|
88
|
+
this.modulePath = modulePath;
|
|
89
|
+
if (this.moduleOhPkgFilePath) {
|
|
90
|
+
this.ohPkgContent = (0, json5parser_1.fetchDependenciesFromFile)(this.moduleOhPkgFilePath);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
logger.warn('This module has no oh-package.json5!');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* get oh-package.json5
|
|
98
|
+
*/
|
|
99
|
+
getModuleOhPkgFilePath() {
|
|
100
|
+
const moduleOhPkgFilePath = path_1.default.resolve(this.projectScene.getRealProjectDir(), path_1.default.join(this.modulePath, EtsConst_1.OH_PACKAGE_JSON5));
|
|
101
|
+
if (fs_1.default.existsSync(moduleOhPkgFilePath)) {
|
|
102
|
+
this.moduleOhPkgFilePath = moduleOhPkgFilePath;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* get nodule name
|
|
107
|
+
* @returns return module name
|
|
108
|
+
*/
|
|
109
|
+
getModuleName() {
|
|
110
|
+
return this.moduleName;
|
|
111
|
+
}
|
|
112
|
+
getModulePath() {
|
|
113
|
+
return this.modulePath;
|
|
114
|
+
}
|
|
115
|
+
getOhPkgFilePath() {
|
|
116
|
+
return this.moduleOhPkgFilePath;
|
|
117
|
+
}
|
|
118
|
+
getOhPkgContent() {
|
|
119
|
+
return this.ohPkgContent;
|
|
120
|
+
}
|
|
121
|
+
getModuleFilesMap() {
|
|
122
|
+
return this.moduleFileMap;
|
|
123
|
+
}
|
|
124
|
+
addArkFile(arkFile) {
|
|
125
|
+
this.moduleFileMap.set(arkFile.getFileSigID(), arkFile);
|
|
126
|
+
}
|
|
127
|
+
genArkFiles(supportFileExts) {
|
|
128
|
+
const filePaths = (0, getAllFiles_1.getAllFiles)(this.modulePath, supportFileExts, this.projectScene.getOptions().ignoreFileNames);
|
|
129
|
+
// 统一走 projectScene 的构建期上下文(SceneBuilder DFS,反拓扑 ID 编号的
|
|
130
|
+
// 唯一排序执行方法);本模块文件的归属由 DFS 内 addArkFile2ModuleScene 依据
|
|
131
|
+
// moduleScenesMap 完成,因此本 ModuleScene 实例必须已注册(见
|
|
132
|
+
// buildScene4HarmonyProject / buildModuleScene)。
|
|
133
|
+
const builder = this.projectScene.getActiveSceneBuilder();
|
|
134
|
+
if (!builder) {
|
|
135
|
+
logger.warn(`ModuleScene ${this.moduleName}: no active SceneBuilder (call buildBasicInfo first); skip ${filePaths.length} files`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
for (const filePath of filePaths) {
|
|
139
|
+
builder.getDependencyFilesDeeply(filePath);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.ModuleScene = ModuleScene;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build stages of a {@link Scene}. Extracted from Scene.ts so the frontend layer can
|
|
3
|
+
* value-import it without pulling in the whole Scene module (avoids Scene ↔ frontend
|
|
4
|
+
* import cycles during the build-machinery migration into frontend).
|
|
5
|
+
*
|
|
6
|
+
* Scene.ts re-exports this enum for backward compatibility.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum SceneBuildStage {
|
|
9
|
+
BUILD_INIT = 0,
|
|
10
|
+
SDK_INFERRED = 1,
|
|
11
|
+
CLASS_DONE = 2,
|
|
12
|
+
METHOD_DONE = 3,
|
|
13
|
+
TYPE_INFERRED = 4
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=SceneBuildStage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneBuildStage.d.ts","sourceRoot":"","sources":["../../src/frontend/SceneBuildStage.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,oBAAY,eAAe;IACvB,UAAU,IAAA;IACV,YAAY,IAAA;IACZ,UAAU,IAAA;IACV,WAAW,IAAA;IACX,aAAa,IAAA;CAChB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.SceneBuildStage = void 0;
|
|
18
|
+
/**
|
|
19
|
+
* Build stages of a {@link Scene}. Extracted from Scene.ts so the frontend layer can
|
|
20
|
+
* value-import it without pulling in the whole Scene module (avoids Scene ↔ frontend
|
|
21
|
+
* import cycles during the build-machinery migration into frontend).
|
|
22
|
+
*
|
|
23
|
+
* Scene.ts re-exports this enum for backward compatibility.
|
|
24
|
+
*/
|
|
25
|
+
var SceneBuildStage;
|
|
26
|
+
(function (SceneBuildStage) {
|
|
27
|
+
SceneBuildStage[SceneBuildStage["BUILD_INIT"] = 0] = "BUILD_INIT";
|
|
28
|
+
SceneBuildStage[SceneBuildStage["SDK_INFERRED"] = 1] = "SDK_INFERRED";
|
|
29
|
+
SceneBuildStage[SceneBuildStage["CLASS_DONE"] = 2] = "CLASS_DONE";
|
|
30
|
+
SceneBuildStage[SceneBuildStage["METHOD_DONE"] = 3] = "METHOD_DONE";
|
|
31
|
+
SceneBuildStage[SceneBuildStage["TYPE_INFERRED"] = 4] = "TYPE_INFERRED";
|
|
32
|
+
})(SceneBuildStage = exports.SceneBuildStage || (exports.SceneBuildStage = {}));
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { SceneConfig } from '../Config';
|
|
2
|
+
import { Scene } from '../Scene';
|
|
3
|
+
/**
|
|
4
|
+
* 完整构建路径的一次性构建上下文(BuildContext)。
|
|
5
|
+
*
|
|
6
|
+
* 承接构建机械与构建期工作态:配置解析族(build-profile / oh-package / tsconfig)与 project 文件 DFS 族(getDependencyFilesDeeply 及全部
|
|
7
|
+
* 依赖发现辅助)。
|
|
8
|
+
*
|
|
9
|
+
* 生命周期:由 Scene 在构建入口创建并持有(scene.activeBuilder),构建结束由入口方法释放(置 undefined)——工作态随本实例被 GC 回收,不驻留
|
|
10
|
+
* Scene。Scene 仅保留构建产物(builtFileOrder / moduleScenesMap / overRides / 失败文件摘要等)与查询侧状态。
|
|
11
|
+
*
|
|
12
|
+
* 注意:本类不承载模块化增量路径(analyseByModule/loadModule 走 ModuleBuilder,其构建态常驻 Scene,不受本上下文生命周期影响)。
|
|
13
|
+
*/
|
|
14
|
+
export declare class SceneBuilder {
|
|
15
|
+
private readonly scene;
|
|
16
|
+
private readonly sceneConfig;
|
|
17
|
+
private readonly registry;
|
|
18
|
+
/** oh-package.json5 内容表(绝对路径 → 内容),依赖解析(parseFrom 族)的输入。 */
|
|
19
|
+
private ohPkgContentMap;
|
|
20
|
+
private ohPkgFilePath;
|
|
21
|
+
private ohPkgContent;
|
|
22
|
+
/** tsconfig paths 映射(import 名 → 候选路径),DFS 的 tsconfig 依赖发现输入。 */
|
|
23
|
+
private globalModule2PathMapping?;
|
|
24
|
+
private baseUrl?;
|
|
25
|
+
/**
|
|
26
|
+
* 构建失败/进行中文件集。直接复用 Scene 的集合引用(同一 Set):
|
|
27
|
+
* DFS 期间作防环工作集(成功文件 delete、失败文件残留),构建结束后
|
|
28
|
+
* Scene.getUnhandledFilePaths() 恰好暴露失败文件摘要。
|
|
29
|
+
*/
|
|
30
|
+
private readonly unhandledFilePaths;
|
|
31
|
+
/**
|
|
32
|
+
* from → 直接解析出的物理文件路径列表(性能缓存)。key 精确对齐
|
|
33
|
+
* {@link getOriginPath} 的解析语义:相对形式(`./`、`../`)带声明文件
|
|
34
|
+
* 所在目录前缀(`dirname + '\x00' + from`——同目录文件的相同相对 from 才允许共享);模块名形式(`@ohos/xxx`、裸名)用 from 本身(解析只走
|
|
35
|
+
* ohPkgContentMap / projectDir / tsconfig 全局映射,与声明文件位置无关)。空数组也缓存(负缓存——避免失败 from 重复走全部分支)。
|
|
36
|
+
* **只缓存纯函数结果(from → paths),绝不缓存"文件要不要构建"的决策**——
|
|
37
|
+
* 后者依赖 filesMap/unhandledFilePaths 等可变状态,命中后必须逐个经
|
|
38
|
+
* {@link getDependencyFilesDeeply} 的三重防重入入口重新仲裁。
|
|
39
|
+
*/
|
|
40
|
+
private fromResolutionCache;
|
|
41
|
+
/**
|
|
42
|
+
* 解析产出收集栈(嵌套隔离):parseFrom 未命中时 push 新槽,嵌套递归构建
|
|
43
|
+
* 触发的 parseFrom 各归各的槽;pop 时整槽写入 fromResolutionCache——
|
|
44
|
+
* 条目只含该 from 的"直接"产出,不含递归依赖自身的解析结果。
|
|
45
|
+
*/
|
|
46
|
+
private fromResolutionStack;
|
|
47
|
+
/**
|
|
48
|
+
* inner oh-package 内容缓存(兜底):不同 from 首次解析触达同一 inner
|
|
49
|
+
* oh-package 的残余重复读盘。独立于 ohPkgContentMap——后者正被
|
|
50
|
+
* for...of 遍历,遍历中插入 key 会改变迭代行为(JS Map 迭代可见新增项)。
|
|
51
|
+
*/
|
|
52
|
+
private resolvedOhPkgCache;
|
|
53
|
+
constructor(scene: Scene, sceneConfig: SceneConfig);
|
|
54
|
+
/**
|
|
55
|
+
* 解析项目配置:build-profile.json5(ES 版本 + 模块表)、oh-package.json5
|
|
56
|
+
* (含 overrides)、tsconfig(paths/baseUrl,extends 链递归)、模块 oh-package 表,
|
|
57
|
+
* 最后生成模块映射(ModuleUtils.generateModuleMap)。
|
|
58
|
+
*/
|
|
59
|
+
parseProjectConfigs(): void;
|
|
60
|
+
/** @internal 供 Scene.buildBasicInfo 的 SDK 阶段读取(P3 迁移后内化)。 */
|
|
61
|
+
getOhPkgContentMap(): Map<string, {
|
|
62
|
+
[k: string]: unknown;
|
|
63
|
+
}>;
|
|
64
|
+
/** @internal 追加模块 oh-package 内容(Scene.buildModuleScene 的依赖解析输入,P3 迁移后内化)。 */
|
|
65
|
+
addOhPkgContent(ohPkgFilePath: string, content: {
|
|
66
|
+
[k: string]: unknown;
|
|
67
|
+
}): void;
|
|
68
|
+
/** @internal tsconfig baseUrl(构建期值;仅在活跃构建上下文中可查)。 */
|
|
69
|
+
getBaseUrl(): string | undefined;
|
|
70
|
+
private parseBuildProfile;
|
|
71
|
+
private parseOhPackage;
|
|
72
|
+
private findTsConfigInfoDeeply;
|
|
73
|
+
private addTsConfigInfo;
|
|
74
|
+
private buildOhPkgContentMap;
|
|
75
|
+
/**
|
|
76
|
+
* 对每个 projectFile 执行 {@link getDependencyFilesDeeply}(DFS):
|
|
77
|
+
* 完整构建自己(intern FileSigID)→ 递归拉入 import/export 依赖 → 全部依赖
|
|
78
|
+
* 完成后 setFile。**setFile 后序 = 严格拓扑序**(被依赖者在前),由 Scene 的
|
|
79
|
+
* builtFileOrder 记录,推断期按其正序遍历即零排序。
|
|
80
|
+
*/
|
|
81
|
+
buildProjectFiles(): void;
|
|
82
|
+
getDependencyFilesDeeply(projectFile: string): void;
|
|
83
|
+
private isRepeatBuildFile;
|
|
84
|
+
private addArkFile2ModuleScene;
|
|
85
|
+
private findDependencyFiles;
|
|
86
|
+
private parseFrom;
|
|
87
|
+
private findDependenciesByTsConfig;
|
|
88
|
+
private parseTsConfigParms;
|
|
89
|
+
private processFuzzyMapping;
|
|
90
|
+
private findDependenciesByRule;
|
|
91
|
+
private findFilesByPathArray;
|
|
92
|
+
private findFilesByExtNameArray;
|
|
93
|
+
private findRelativeDependenciesByOhPkg;
|
|
94
|
+
private findDependenciesByOhPkg;
|
|
95
|
+
private getDependenciesMapping;
|
|
96
|
+
private getOriginPath;
|
|
97
|
+
private addFileNode2DependencyGrap;
|
|
98
|
+
/**
|
|
99
|
+
* SDK 阶段:注册/构建全部 SDK 源、SDK 推断 + global API 合并、记录语言表、extendArkUI、标记 project/SDK ID 边界。
|
|
100
|
+
* 顺序语义:fileLanguages 在 SDK 构建之后才生效。
|
|
101
|
+
*/
|
|
102
|
+
buildSdkStage(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Loads SDK sources into the scene. C++ SDK files are intentionally skipped: they are not parsed or registered
|
|
105
|
+
* here (only non-C++ SDK sources are processed).
|
|
106
|
+
*
|
|
107
|
+
* When {@link createDefaultConstructor} is set, default constructors are ensured for every
|
|
108
|
+
* class registered by this SDK batch right here — before the SDK/project ID boundary is
|
|
109
|
+
* marked — so their method formal IDs stay on the SDK side of the (future class/method-level)
|
|
110
|
+
* boundary invariant. The built-in lib (var-side XxxConstructor pattern + interface-only
|
|
111
|
+
* classes) is excluded by the caller for that reason; library classes must NOT receive
|
|
112
|
+
* models after the boundary (the project-stage batch pass keeps the isLibraryClass guard).
|
|
113
|
+
*/
|
|
114
|
+
private buildSdk;
|
|
115
|
+
private collectSdkFiles;
|
|
116
|
+
private parseAndRegisterSdkFile;
|
|
117
|
+
/**
|
|
118
|
+
* 方法体构建段(原 genArkFiles 尾段):enableMethodBodyBuild 分支——
|
|
119
|
+
* 全量 buildBody + 默认构造器补全,或仅释放 builder。
|
|
120
|
+
*/
|
|
121
|
+
buildAllMethodBodies(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Update or add default constructors for all classes in the scene.
|
|
124
|
+
*/
|
|
125
|
+
private updateOrAddDefaultConstructors;
|
|
126
|
+
/**
|
|
127
|
+
* 遍历全部 project 文件的 ArkMethod(不含 SDK 方法),逐个回调处理。
|
|
128
|
+
*
|
|
129
|
+
* 直接平面遍历 methodSigCanonicalizer(registry 为事实源),过滤规则:
|
|
130
|
+
* ① getModel(id) 为 undefined 跳过——declare-only 方法(无 model)及
|
|
131
|
+
* BodyBuilder/JsonSerialization 重签名产生的无 model 条目;
|
|
132
|
+
* ② 非 project 文件跳过(SDK 文件,按 file 的 projectFile 标志判定);
|
|
133
|
+
* ③ !enableOhModulesBody 时,oh_modules 文件仅保留 defaultArkMethod。
|
|
134
|
+
* 处理顺序为 methodSigID 升序(buildBody 逐方法独立、无序敏感)。
|
|
135
|
+
*/
|
|
136
|
+
private forEachProjectMethod;
|
|
137
|
+
private static freeMethodBodyBuilder;
|
|
138
|
+
private buildAllMethodBody;
|
|
139
|
+
private freeAllBodyBuilders;
|
|
140
|
+
/**
|
|
141
|
+
* harmony 项目构建(原 buildScene4HarmonyProject 主体):逐模块注册
|
|
142
|
+
* ModuleScene(先注册后构建,保证 DFS 归属正确)→ 模块文件 DFS → body 构建。
|
|
143
|
+
*/
|
|
144
|
+
buildScene4HarmonyProject(): void;
|
|
145
|
+
/**
|
|
146
|
+
* 单模块构建(原 buildModuleScene 主体,增量式入口):ohpkg 依赖递归 + 模块
|
|
147
|
+
* DFS + body 构建。可能被连续调用构建多个模块——不释放构建上下文(释放交给
|
|
148
|
+
* clear / 完整构建入口)。
|
|
149
|
+
*/
|
|
150
|
+
buildModuleScene(moduleName: string, modulePath: string, supportFileExts: string[]): void;
|
|
151
|
+
private processModuleOhPkgContent;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=SceneBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/frontend/SceneBuilder.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAY,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AA4BjC;;;;;;;;;;GAUG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAI1D,4DAA4D;IAC5D,OAAO,CAAC,eAAe,CAAoD;IAC3E,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,YAAY,CAAgC;IACpD,gEAAgE;IAChE,OAAO,CAAC,wBAAwB,CAAC,CAA4B;IAC7D,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAc;IACjD;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB,CAAoC;IAC/D;;;;OAIG;IACH,OAAO,CAAC,mBAAmB,CAAkB;IAC7C;;;;OAIG;IACH,OAAO,CAAC,kBAAkB,CAAoD;gBAElE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW;IASlD;;;;OAIG;IACI,mBAAmB,IAAI,IAAI;IAmBlC,6DAA6D;IACtD,kBAAkB,IAAI,GAAG,CAAC,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAIlE,6EAA6E;IACtE,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI;IAItF,qDAAqD;IAC9C,UAAU,IAAI,MAAM,GAAG,SAAS;IAIvC,OAAO,CAAC,iBAAiB;IAuBzB,OAAO,CAAC,cAAc;IA2BtB,OAAO,CAAC,sBAAsB;IAc9B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,oBAAoB;IAY5B;;;;;OAKG;IACI,iBAAiB,IAAI,IAAI;IASzB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IA4D1D,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,sBAAsB;IAiB9B,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,SAAS;IAwCjB,OAAO,CAAC,0BAA0B;IAOlC,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,+BAA+B;IAoBvC,OAAO,CAAC,uBAAuB;IA6B/B,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,0BAA0B;IAclC;;;OAGG;IACI,aAAa,IAAI,IAAI;IAsD5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,QAAQ;IAoBhB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,uBAAuB;IA+B/B;;;OAGG;IACI,oBAAoB,IAAI,IAAI;IAanC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAmBtC;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IASpC,OAAO,CAAC,kBAAkB;IAkC1B,OAAO,CAAC,mBAAmB;IAQ3B;;;OAGG;IACI,yBAAyB,IAAI,IAAI;IAgBxC;;;;OAIG;IACI,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI;IAkChG,OAAO,CAAC,yBAAyB;CAmBpC"}
|