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
package/lib/core/base/Type.js
CHANGED
|
@@ -13,15 +13,71 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
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
|
+
};
|
|
16
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.EnumValueType = exports.LexicalEnvType = exports.AnnotationTypeQueryType = exports.AnnotationNamespaceType = exports.AnnotationType = exports.GenericType = exports.AliasType = exports.TupleType = exports.ArrayType = exports.ClassType = exports.ClosureType = exports.FunctionType = exports.NeverType = exports.VoidType = exports.IntersectionType = exports.UnionType = exports.LiteralType = exports.UndefinedType = exports.NullType = exports.StringType = exports.BigIntType = exports.NumberType = exports.BooleanType = exports.PrimitiveType = exports.UnclearReferenceType = exports.UnknownType = exports.AnyType = exports.Type = void 0;
|
|
40
|
+
exports.EnumValueType = exports.LexicalEnvType = exports.AnnotationTypeQueryType = exports.AnnotationNamespaceType = exports.AnnotationType = exports.GenericType = exports.AliasType = exports.TupleType = exports.ArrayType = exports.ClassType = exports.ClosureType = exports.FunctionType = exports.NeverType = exports.VoidType = exports.IntersectionType = exports.UnionType = exports.LiteralType = exports.UndefinedType = exports.NullType = exports.StringType = exports.BigIntType = exports.NumberType = exports.BooleanType = exports.PrimitiveType = exports.UnclearReferenceType = exports.UnknownType = exports.AnyType = exports.Type = exports.ArrayUnclearVisited = void 0;
|
|
18
41
|
const ArkSignature_1 = require("../model/ArkSignature");
|
|
19
42
|
const ArkExport_1 = require("../model/ArkExport");
|
|
20
43
|
const ArkBaseModel_1 = require("../model/ArkBaseModel");
|
|
21
44
|
const TSConst_1 = require("../common/TSConst");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
45
|
+
const SignatureCanonicalizerRegistry_1 = require("../common/SignatureCanonicalizerRegistry");
|
|
46
|
+
const logger_1 = __importStar(require("../../utils/logger"));
|
|
47
|
+
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'Type');
|
|
48
|
+
class ArrayUnclearVisited {
|
|
49
|
+
constructor() {
|
|
50
|
+
this.items = [];
|
|
51
|
+
this.base = 0;
|
|
52
|
+
this.top = 0;
|
|
53
|
+
}
|
|
54
|
+
enter() {
|
|
55
|
+
const prev = this.base;
|
|
56
|
+
this.base = this.top;
|
|
57
|
+
return prev;
|
|
58
|
+
}
|
|
59
|
+
has(type) {
|
|
60
|
+
for (let i = this.base; i < this.top; i++) {
|
|
61
|
+
if (this.items[i] === type) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
add(type) {
|
|
68
|
+
this.items[this.top++] = type;
|
|
69
|
+
}
|
|
70
|
+
leave(prevBase) {
|
|
71
|
+
const nullType = null;
|
|
72
|
+
for (let i = this.base; i < this.top; i++) {
|
|
73
|
+
this.items[i] = nullType;
|
|
74
|
+
}
|
|
75
|
+
this.top = this.base;
|
|
76
|
+
this.base = prevBase;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.ArrayUnclearVisited = ArrayUnclearVisited;
|
|
80
|
+
const unclearVisited = new ArrayUnclearVisited();
|
|
25
81
|
class Type {
|
|
26
82
|
/** True if this type can contain other types and thus participate in cycles */
|
|
27
83
|
canParticipateInCycle() {
|
|
@@ -64,6 +120,15 @@ class Type {
|
|
|
64
120
|
}
|
|
65
121
|
}
|
|
66
122
|
}
|
|
123
|
+
isUnclear() {
|
|
124
|
+
const prevBase = unclearVisited.enter();
|
|
125
|
+
try {
|
|
126
|
+
return this.isUnclearWithVisited(unclearVisited);
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
unclearVisited.leave(prevBase);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
67
132
|
}
|
|
68
133
|
exports.Type = Type;
|
|
69
134
|
/**
|
|
@@ -77,6 +142,9 @@ class AnyType extends Type {
|
|
|
77
142
|
constructor() {
|
|
78
143
|
super();
|
|
79
144
|
}
|
|
145
|
+
isUnclearWithVisited(_visited) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
80
148
|
getTypeString(_visited) {
|
|
81
149
|
return TSConst_1.ANY_KEYWORD;
|
|
82
150
|
}
|
|
@@ -94,6 +162,9 @@ class UnknownType extends Type {
|
|
|
94
162
|
constructor() {
|
|
95
163
|
super();
|
|
96
164
|
}
|
|
165
|
+
isUnclearWithVisited(_visited) {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
97
168
|
getTypeString(_visited) {
|
|
98
169
|
return TSConst_1.UNKNOWN_KEYWORD;
|
|
99
170
|
}
|
|
@@ -122,6 +193,9 @@ class UnclearReferenceType extends Type {
|
|
|
122
193
|
getGenericTypes() {
|
|
123
194
|
return this.genericTypes;
|
|
124
195
|
}
|
|
196
|
+
isUnclearWithVisited(_visited) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
125
199
|
getTypeString(visited = new Set()) {
|
|
126
200
|
let str = this.name;
|
|
127
201
|
if (this.genericTypes.length > 0) {
|
|
@@ -143,6 +217,11 @@ class PrimitiveType extends Type {
|
|
|
143
217
|
getName() {
|
|
144
218
|
return this.name;
|
|
145
219
|
}
|
|
220
|
+
// Transit implementation: concrete primitives are never unclear;
|
|
221
|
+
// only the inherently unclear leaves (see NullType/UndefinedType notes) override isUnclearWithVisited.
|
|
222
|
+
isUnclearWithVisited(_visited) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
146
225
|
getTypeString(_visited) {
|
|
147
226
|
return this.name;
|
|
148
227
|
}
|
|
@@ -207,6 +286,10 @@ class NullType extends PrimitiveType {
|
|
|
207
286
|
constructor() {
|
|
208
287
|
super(TSConst_1.NULL_KEYWORD);
|
|
209
288
|
}
|
|
289
|
+
isUnclearWithVisited(_visited) {
|
|
290
|
+
// UNIFY-EXP: null as concrete
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
210
293
|
}
|
|
211
294
|
exports.NullType = NullType;
|
|
212
295
|
NullType.INSTANCE = new NullType();
|
|
@@ -221,6 +304,10 @@ class UndefinedType extends PrimitiveType {
|
|
|
221
304
|
constructor() {
|
|
222
305
|
super(TSConst_1.UNDEFINED_KEYWORD);
|
|
223
306
|
}
|
|
307
|
+
isUnclearWithVisited(_visited) {
|
|
308
|
+
// UNIFY-EXP: undefined as concrete
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
224
311
|
}
|
|
225
312
|
exports.UndefinedType = UndefinedType;
|
|
226
313
|
UndefinedType.INSTANCE = new UndefinedType();
|
|
@@ -265,6 +352,20 @@ class UnionType extends Type {
|
|
|
265
352
|
setCurrType(newType) {
|
|
266
353
|
this.currType = newType;
|
|
267
354
|
}
|
|
355
|
+
isUnclearWithVisited(visited) {
|
|
356
|
+
if (visited.has(this)) {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
visited.add(this);
|
|
360
|
+
// Unified full semantics: a union is unclear iff any member is unclear.
|
|
361
|
+
const memberTypes = this.getTypes();
|
|
362
|
+
for (let i = 0; i < memberTypes.length; i++) {
|
|
363
|
+
if (memberTypes[i].isUnclearWithVisited(visited)) {
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
268
369
|
getTypeString(visited = new Set()) {
|
|
269
370
|
const typesString = [];
|
|
270
371
|
this.getTypes().forEach(t => {
|
|
@@ -307,6 +408,20 @@ class IntersectionType extends Type {
|
|
|
307
408
|
getTypes() {
|
|
308
409
|
return this.types;
|
|
309
410
|
}
|
|
411
|
+
isUnclearWithVisited(visited) {
|
|
412
|
+
if (visited.has(this)) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
visited.add(this);
|
|
416
|
+
// Unified full semantics (see UnionType).
|
|
417
|
+
const memberTypes = this.getTypes();
|
|
418
|
+
for (let i = 0; i < memberTypes.length; i++) {
|
|
419
|
+
if (memberTypes[i].isUnclearWithVisited(visited)) {
|
|
420
|
+
return true;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
310
425
|
getTypeString(visited = new Set()) {
|
|
311
426
|
const typesString = [];
|
|
312
427
|
this.getTypes().forEach(t => {
|
|
@@ -332,6 +447,9 @@ class VoidType extends Type {
|
|
|
332
447
|
constructor() {
|
|
333
448
|
super();
|
|
334
449
|
}
|
|
450
|
+
isUnclearWithVisited(_visited) {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
335
453
|
getTypeString(_visited) {
|
|
336
454
|
return TSConst_1.VOID_KEYWORD;
|
|
337
455
|
}
|
|
@@ -349,6 +467,9 @@ class NeverType extends Type {
|
|
|
349
467
|
constructor() {
|
|
350
468
|
super();
|
|
351
469
|
}
|
|
470
|
+
isUnclearWithVisited(_visited) {
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
352
473
|
getTypeString(_visited) {
|
|
353
474
|
return TSConst_1.NEVER_KEYWORD;
|
|
354
475
|
}
|
|
@@ -365,20 +486,74 @@ class FunctionType extends Type {
|
|
|
365
486
|
}
|
|
366
487
|
constructor(methodSignature, realGenericTypes) {
|
|
367
488
|
super();
|
|
368
|
-
|
|
489
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
490
|
+
if (methodSignature.isUnclear()) {
|
|
491
|
+
this.methodSigID = -1;
|
|
492
|
+
this.tempSigID = reg.tempMethodSigCanonicalizer.register(methodSignature);
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
const existingId = reg.methodSigCanonicalizer.getExistingId(methodSignature);
|
|
496
|
+
if (existingId !== -1) {
|
|
497
|
+
this.methodSigID = existingId;
|
|
498
|
+
this.tempSigID = undefined;
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
logger.error(`FunctionType: clear MethodSignature not interned — routing to temp defensively: ${methodSignature.toString()}`);
|
|
502
|
+
this.methodSigID = -1;
|
|
503
|
+
this.tempSigID = reg.tempMethodSigCanonicalizer.register(methodSignature);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
369
506
|
this.realGenericTypes = realGenericTypes;
|
|
370
507
|
}
|
|
371
508
|
getMethodSignature() {
|
|
372
|
-
|
|
509
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
510
|
+
if (this.methodSigID >= 0) {
|
|
511
|
+
return reg.methodSigCanonicalizer.get(this.methodSigID);
|
|
512
|
+
}
|
|
513
|
+
if (this.tempSigID !== undefined) {
|
|
514
|
+
const sig = reg.tempMethodSigCanonicalizer.get(this.tempSigID);
|
|
515
|
+
if (sig !== undefined) {
|
|
516
|
+
return sig;
|
|
517
|
+
}
|
|
518
|
+
// 惰性物化:已迁移 → 替换记录直达 formal(tempSigID 保留作痕迹)。
|
|
519
|
+
const formalId = reg.tempMethodSigCanonicalizer.getReplacement(this.tempSigID);
|
|
520
|
+
if (formalId !== -1) {
|
|
521
|
+
const formalSig = reg.methodSigCanonicalizer.get(formalId);
|
|
522
|
+
if (formalSig !== undefined) {
|
|
523
|
+
this.methodSigID = formalId;
|
|
524
|
+
return formalSig;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
throw new Error('FunctionType has no signature');
|
|
529
|
+
}
|
|
530
|
+
/** @internal Get the formal MethodSigID. */
|
|
531
|
+
getMethodSigID() {
|
|
532
|
+
return this.methodSigID;
|
|
533
|
+
}
|
|
534
|
+
/** @internal Get the temp sigID for the unresolved-signature registration. */
|
|
535
|
+
getTempSigID() {
|
|
536
|
+
return this.tempSigID;
|
|
373
537
|
}
|
|
374
538
|
getRealGenericTypes() {
|
|
375
539
|
return this.realGenericTypes;
|
|
376
540
|
}
|
|
541
|
+
isUnclearWithVisited(_visited) {
|
|
542
|
+
// 恒为 false,三层理由:
|
|
543
|
+
// 1. 语义层:FunctionType 表示函数类型本身(结构描述:参数列表+返回类型),不是对函数实体的引用——"引用可解析性"的判定职责由 ClassType 承担。
|
|
544
|
+
// "该签名对应哪个真实方法"的解析在消费点有专门机制(canonicalizer 值查找 + fallback 遍历),从不依赖本判定。
|
|
545
|
+
// 2. 结构层:ClassType 的检查项(%unk stub 文件、PROMISE 无泛型)各对应一种真实残缺形态(temp 兜底、未定型泛型);
|
|
546
|
+
// 而 MethodSignature 永远是完整值——即使声明方 unclear,签名作为值(名字+参数+返回类型)仍然完整,构造时总能 intern。函数类型没有"残缺形态"需要暴露。
|
|
547
|
+
// 3. 实证:泛型实参传播版(Fn<Unclear> 判 true)曾被全量回归否决(keyof-typeof 推导链退化),勿再尝试。
|
|
548
|
+
// 函数内容的不确定性(参数/返回/泛型实参)由消费点按需处理,类型层传播已被实证会破坏推导链。
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
377
551
|
getTypeString(visited = new Set()) {
|
|
378
|
-
const sig = this.
|
|
379
|
-
const classStr = this.
|
|
380
|
-
const paramStrs = sig
|
|
381
|
-
.
|
|
552
|
+
const sig = this.getMethodSignature().getMethodSubSignature();
|
|
553
|
+
const classStr = this.getMethodSignature().getDeclaringClassSignature().toString();
|
|
554
|
+
const paramStrs = sig
|
|
555
|
+
.getParameterTypes()
|
|
556
|
+
.map(t => (t ? t.toStringWithVisited(visited) : UnknownType.getInstance().toString()))
|
|
382
557
|
.join(', ');
|
|
383
558
|
const methodPart = (sig.isStatic() ? '[static]' : '') + sig.getMethodName() + '(' + paramStrs + ')';
|
|
384
559
|
return classStr + '.' + methodPart;
|
|
@@ -411,18 +586,78 @@ class ClassType extends Type {
|
|
|
411
586
|
return true;
|
|
412
587
|
}
|
|
413
588
|
getDisplayNameForCycle() {
|
|
414
|
-
return this.
|
|
589
|
+
return this.getClassSignature().toString();
|
|
415
590
|
}
|
|
416
591
|
constructor(classSignature, realGenericTypes) {
|
|
417
592
|
super();
|
|
418
|
-
|
|
593
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
594
|
+
if (classSignature.isUnclear()) {
|
|
595
|
+
this.classSigID = -1;
|
|
596
|
+
this.tempSigID = reg.tempClassSigCanonicalizer.register(classSignature);
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
const existingId = reg.classSigCanonicalizer.getExistingId(classSignature);
|
|
600
|
+
if (existingId !== -1) {
|
|
601
|
+
this.classSigID = existingId;
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
logger.error(`ClassType: clear ClassSignature not interned — routing to temp defensively: ${classSignature.toString()}`);
|
|
605
|
+
this.classSigID = -1;
|
|
606
|
+
this.tempSigID = reg.tempClassSigCanonicalizer.register(classSignature);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
419
609
|
this.realGenericTypes = realGenericTypes;
|
|
420
610
|
}
|
|
421
611
|
getClassSignature() {
|
|
422
|
-
|
|
612
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
613
|
+
if (this.classSigID >= 0) {
|
|
614
|
+
return reg.classSigCanonicalizer.get(this.classSigID);
|
|
615
|
+
}
|
|
616
|
+
if (this.tempSigID !== undefined) {
|
|
617
|
+
const sig = reg.tempClassSigCanonicalizer.get(this.tempSigID);
|
|
618
|
+
if (sig !== undefined) {
|
|
619
|
+
return sig;
|
|
620
|
+
}
|
|
621
|
+
// 惰性物化:已迁移(slot 置空)→ 替换记录直达 formal("下一处直接使用 formal ID");tempSigID 保留作"曾 temp"审计痕迹。
|
|
622
|
+
const formalId = reg.tempClassSigCanonicalizer.getReplacement(this.tempSigID);
|
|
623
|
+
if (formalId !== -1) {
|
|
624
|
+
const formalSig = reg.classSigCanonicalizer.get(formalId);
|
|
625
|
+
if (formalSig !== undefined) {
|
|
626
|
+
this.classSigID = formalId;
|
|
627
|
+
return formalSig;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
throw new Error('ClassType has no signature');
|
|
423
632
|
}
|
|
424
633
|
setClassSignature(newClassSignature) {
|
|
425
|
-
|
|
634
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
635
|
+
if (newClassSignature.isUnclear()) {
|
|
636
|
+
this.classSigID = -1;
|
|
637
|
+
this.tempSigID = reg.tempClassSigCanonicalizer.register(newClassSignature);
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
const existingId = reg.classSigCanonicalizer.getExistingId(newClassSignature);
|
|
641
|
+
if (existingId !== -1) {
|
|
642
|
+
if (this.tempSigID !== undefined) {
|
|
643
|
+
reg.tempClassSigCanonicalizer.retireWithReplacement(this.tempSigID, existingId);
|
|
644
|
+
}
|
|
645
|
+
this.classSigID = existingId;
|
|
646
|
+
this.tempSigID = undefined;
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
logger.error(`ClassType: clear ClassSignature not interned (setClassSignature) — routing to temp defensively: ${newClassSignature.toString()}`);
|
|
650
|
+
this.classSigID = -1;
|
|
651
|
+
this.tempSigID = reg.tempClassSigCanonicalizer.register(newClassSignature);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
/** @internal Get the formal ClassSigID. */
|
|
655
|
+
getClassSigID() {
|
|
656
|
+
return this.classSigID;
|
|
657
|
+
}
|
|
658
|
+
/** @internal Get the temp sigID for the unresolved-signature registration. */
|
|
659
|
+
getTempSigID() {
|
|
660
|
+
return this.tempSigID;
|
|
426
661
|
}
|
|
427
662
|
getRealGenericTypes() {
|
|
428
663
|
return this.realGenericTypes;
|
|
@@ -430,8 +665,15 @@ class ClassType extends Type {
|
|
|
430
665
|
setRealGenericTypes(types) {
|
|
431
666
|
this.realGenericTypes = types;
|
|
432
667
|
}
|
|
668
|
+
isUnclearWithVisited(_visited) {
|
|
669
|
+
const classSignature = this.getClassSignature();
|
|
670
|
+
if (classSignature.getDeclaringFileSigID() === 0) {
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
return classSignature.getClassName() === TSConst_1.PROMISE && !this.getRealGenericTypes();
|
|
674
|
+
}
|
|
433
675
|
getTypeString(visited = new Set()) {
|
|
434
|
-
let temp = this.
|
|
676
|
+
let temp = this.getClassSignature().toString();
|
|
435
677
|
if (this.realGenericTypes && this.realGenericTypes.length > 0) {
|
|
436
678
|
temp += `<${this.realGenericTypes.map(t => t.toStringWithVisited(visited)).join(',')}>`;
|
|
437
679
|
}
|
|
@@ -480,6 +722,14 @@ class ArrayType extends Type {
|
|
|
480
722
|
getReadonlyFlag() {
|
|
481
723
|
return this.readonlyFlag;
|
|
482
724
|
}
|
|
725
|
+
isUnclearWithVisited(visited) {
|
|
726
|
+
if (visited.has(this)) {
|
|
727
|
+
return false;
|
|
728
|
+
}
|
|
729
|
+
visited.add(this);
|
|
730
|
+
// Unified full semantics: the array is unclear iff its base type is unclear.
|
|
731
|
+
return this.getBaseType().isUnclearWithVisited(visited);
|
|
732
|
+
}
|
|
483
733
|
getTypeString(visited = new Set()) {
|
|
484
734
|
const strs = [];
|
|
485
735
|
if (this.getReadonlyFlag()) {
|
|
@@ -530,6 +780,20 @@ class TupleType extends Type {
|
|
|
530
780
|
getReadonlyFlag() {
|
|
531
781
|
return this.readonlyFlag;
|
|
532
782
|
}
|
|
783
|
+
isUnclearWithVisited(visited) {
|
|
784
|
+
if (visited.has(this)) {
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
visited.add(this);
|
|
788
|
+
// Unified full semantics (see UnionType).
|
|
789
|
+
const memberTypes = this.getTypes();
|
|
790
|
+
for (let i = 0; i < memberTypes.length; i++) {
|
|
791
|
+
if (memberTypes[i].isUnclearWithVisited(visited)) {
|
|
792
|
+
return true;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return false;
|
|
796
|
+
}
|
|
533
797
|
getTypeString(visited = new Set()) {
|
|
534
798
|
const typesStr = this.types.map(t => t.toStringWithVisited(visited)).join(', ');
|
|
535
799
|
if (this.getReadonlyFlag()) {
|
|
@@ -580,6 +844,14 @@ class AliasType extends Type {
|
|
|
580
844
|
getOriginalType() {
|
|
581
845
|
return this.originalType;
|
|
582
846
|
}
|
|
847
|
+
isUnclearWithVisited(visited) {
|
|
848
|
+
if (visited.has(this)) {
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
visited.add(this);
|
|
852
|
+
// The alias propagates the unclear semantics of its original type.
|
|
853
|
+
return this.getOriginalType().isUnclearWithVisited(visited);
|
|
854
|
+
}
|
|
583
855
|
getTypeString(visited = new Set()) {
|
|
584
856
|
let res = this.getSignature().toString(visited);
|
|
585
857
|
const realGeneric = this.getRealGenericTypes();
|
|
@@ -674,6 +946,9 @@ class GenericType extends Type {
|
|
|
674
946
|
var _a;
|
|
675
947
|
return (_a = this.index) !== null && _a !== void 0 ? _a : 0;
|
|
676
948
|
}
|
|
949
|
+
isUnclearWithVisited(_visited) {
|
|
950
|
+
return true;
|
|
951
|
+
}
|
|
677
952
|
getTypeString(visited = new Set()) {
|
|
678
953
|
let str = this.name;
|
|
679
954
|
if (this.constraint) {
|
|
@@ -694,6 +969,10 @@ class AnnotationType extends Type {
|
|
|
694
969
|
getOriginType() {
|
|
695
970
|
return this.originType;
|
|
696
971
|
}
|
|
972
|
+
// Transit implementation: annotation types are concrete leaf types
|
|
973
|
+
isUnclearWithVisited(_visited) {
|
|
974
|
+
return false;
|
|
975
|
+
}
|
|
697
976
|
getTypeString(_visited) {
|
|
698
977
|
return this.originType;
|
|
699
978
|
}
|
|
@@ -729,11 +1008,54 @@ exports.AnnotationTypeQueryType = AnnotationTypeQueryType;
|
|
|
729
1008
|
class LexicalEnvType extends Type {
|
|
730
1009
|
constructor(nestedMethod, closures) {
|
|
731
1010
|
super();
|
|
732
|
-
|
|
1011
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
1012
|
+
if (nestedMethod.isUnclear()) {
|
|
1013
|
+
this.nestedMethodSigID = -1;
|
|
1014
|
+
this.tempSigID = reg.tempMethodSigCanonicalizer.register(nestedMethod);
|
|
1015
|
+
}
|
|
1016
|
+
else {
|
|
1017
|
+
const existingId = reg.methodSigCanonicalizer.getExistingId(nestedMethod);
|
|
1018
|
+
if (existingId !== -1) {
|
|
1019
|
+
this.nestedMethodSigID = existingId;
|
|
1020
|
+
this.tempSigID = undefined;
|
|
1021
|
+
}
|
|
1022
|
+
else {
|
|
1023
|
+
logger.error(`LexicalEnvType: clear MethodSignature not interned — routing to temp defensively: ${nestedMethod.toString()}`);
|
|
1024
|
+
this.nestedMethodSigID = -1;
|
|
1025
|
+
this.tempSigID = reg.tempMethodSigCanonicalizer.register(nestedMethod);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
733
1028
|
this.closures = closures !== null && closures !== void 0 ? closures : [];
|
|
734
1029
|
}
|
|
735
1030
|
getNestedMethod() {
|
|
736
|
-
|
|
1031
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
1032
|
+
if (this.nestedMethodSigID >= 0) {
|
|
1033
|
+
return reg.methodSigCanonicalizer.get(this.nestedMethodSigID);
|
|
1034
|
+
}
|
|
1035
|
+
if (this.tempSigID !== undefined) {
|
|
1036
|
+
const sig = reg.tempMethodSigCanonicalizer.get(this.tempSigID);
|
|
1037
|
+
if (sig !== undefined) {
|
|
1038
|
+
return sig;
|
|
1039
|
+
}
|
|
1040
|
+
// 惰性物化:已迁移 → 替换记录直达 formal(tempSigID 保留作痕迹)。
|
|
1041
|
+
const formalId = reg.tempMethodSigCanonicalizer.getReplacement(this.tempSigID);
|
|
1042
|
+
if (formalId !== -1) {
|
|
1043
|
+
const formalSig = reg.methodSigCanonicalizer.get(formalId);
|
|
1044
|
+
if (formalSig !== undefined) {
|
|
1045
|
+
this.nestedMethodSigID = formalId;
|
|
1046
|
+
return formalSig;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
throw new Error('LexicalEnvType has no signature');
|
|
1051
|
+
}
|
|
1052
|
+
/** @internal Get the formal MethodSigID. */
|
|
1053
|
+
getMethodSigID() {
|
|
1054
|
+
return this.nestedMethodSigID;
|
|
1055
|
+
}
|
|
1056
|
+
/** @internal Get the temp sigID for the unresolved-signature registration. */
|
|
1057
|
+
getTempSigID() {
|
|
1058
|
+
return this.tempSigID;
|
|
737
1059
|
}
|
|
738
1060
|
getClosures() {
|
|
739
1061
|
return this.closures;
|
|
@@ -741,6 +1063,9 @@ class LexicalEnvType extends Type {
|
|
|
741
1063
|
addClosure(closure) {
|
|
742
1064
|
this.closures.push(closure);
|
|
743
1065
|
}
|
|
1066
|
+
isUnclearWithVisited(_visited) {
|
|
1067
|
+
return false;
|
|
1068
|
+
}
|
|
744
1069
|
getTypeString(_visited) {
|
|
745
1070
|
return `[${this.getClosures().join(', ')}]`;
|
|
746
1071
|
}
|
|
@@ -749,17 +1074,63 @@ exports.LexicalEnvType = LexicalEnvType;
|
|
|
749
1074
|
class EnumValueType extends Type {
|
|
750
1075
|
constructor(signature, constant) {
|
|
751
1076
|
super();
|
|
752
|
-
|
|
1077
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
1078
|
+
if (signature.isUnclear()) {
|
|
1079
|
+
this.fieldSigID = -1;
|
|
1080
|
+
this.tempSigID = reg.tempFieldSigCanonicalizer.register(signature);
|
|
1081
|
+
}
|
|
1082
|
+
else {
|
|
1083
|
+
const existingId = reg.fieldSigCanonicalizer.getExistingId(signature);
|
|
1084
|
+
if (existingId !== -1) {
|
|
1085
|
+
this.fieldSigID = existingId;
|
|
1086
|
+
this.tempSigID = undefined;
|
|
1087
|
+
}
|
|
1088
|
+
else {
|
|
1089
|
+
logger.error(`EnumValueType: clear FieldSignature not interned — routing to temp defensively: ${signature.toString()}`);
|
|
1090
|
+
this.fieldSigID = -1;
|
|
1091
|
+
this.tempSigID = reg.tempFieldSigCanonicalizer.register(signature);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
753
1094
|
this.constant = constant;
|
|
754
1095
|
}
|
|
755
1096
|
getFieldSignature() {
|
|
756
|
-
|
|
1097
|
+
const reg = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
1098
|
+
if (this.fieldSigID >= 0) {
|
|
1099
|
+
return reg.fieldSigCanonicalizer.get(this.fieldSigID);
|
|
1100
|
+
}
|
|
1101
|
+
if (this.tempSigID !== undefined) {
|
|
1102
|
+
const sig = reg.tempFieldSigCanonicalizer.get(this.tempSigID);
|
|
1103
|
+
if (sig !== undefined) {
|
|
1104
|
+
return sig;
|
|
1105
|
+
}
|
|
1106
|
+
// 惰性物化:已迁移 → 替换记录直达 formal(tempSigID 保留作痕迹)。
|
|
1107
|
+
const formalId = reg.tempFieldSigCanonicalizer.getReplacement(this.tempSigID);
|
|
1108
|
+
if (formalId !== -1) {
|
|
1109
|
+
const formalSig = reg.fieldSigCanonicalizer.get(formalId);
|
|
1110
|
+
if (formalSig !== undefined) {
|
|
1111
|
+
this.fieldSigID = formalId;
|
|
1112
|
+
return formalSig;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
throw new Error('EnumValueType has no signature');
|
|
1117
|
+
}
|
|
1118
|
+
/** @internal Get the formal FieldSigID. */
|
|
1119
|
+
getFieldSigID() {
|
|
1120
|
+
return this.fieldSigID;
|
|
1121
|
+
}
|
|
1122
|
+
/** @internal Get the temp sigID for the unresolved-signature registration. */
|
|
1123
|
+
getTempSigID() {
|
|
1124
|
+
return this.tempSigID;
|
|
757
1125
|
}
|
|
758
1126
|
getConstant() {
|
|
759
1127
|
return this.constant;
|
|
760
1128
|
}
|
|
1129
|
+
isUnclearWithVisited(_visited) {
|
|
1130
|
+
return false;
|
|
1131
|
+
}
|
|
761
1132
|
getTypeString(_visited) {
|
|
762
|
-
return this.
|
|
1133
|
+
return this.getFieldSignature().toString();
|
|
763
1134
|
}
|
|
764
1135
|
}
|
|
765
1136
|
exports.EnumValueType = EnumValueType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Value } from './Value';
|
|
2
2
|
import { ArkMethod } from '../model/ArkMethod';
|
|
3
|
-
import { Type } from './Type';
|
|
3
|
+
import { Type, UnclearVisited } from './Type';
|
|
4
4
|
import { ArkBaseModel } from '../model/ArkBaseModel';
|
|
5
5
|
/**
|
|
6
6
|
* abstract type expr represents the type operations of types or values.
|
|
@@ -15,7 +15,7 @@ import { ArkBaseModel } from '../model/ArkBaseModel';
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export declare abstract class AbstractTypeExpr extends Type {
|
|
18
|
-
abstract getUses(): Value[];
|
|
18
|
+
abstract getUses(acc?: Value[]): Value[];
|
|
19
19
|
abstract getType(): Type;
|
|
20
20
|
inferType(arkMethod: ArkMethod): void;
|
|
21
21
|
}
|
|
@@ -38,8 +38,9 @@ export declare class TypeQueryExpr extends AbstractTypeExpr {
|
|
|
38
38
|
getOpValue(): Value | ArkBaseModel;
|
|
39
39
|
setGenerateTypes(types: Type[]): void;
|
|
40
40
|
getGenerateTypes(): Type[] | undefined;
|
|
41
|
+
isUnclearWithVisited(visited: UnclearVisited): boolean;
|
|
41
42
|
addGenericType(gType: Type): void;
|
|
42
|
-
getUses(): Value[];
|
|
43
|
+
getUses(acc?: Value[]): Value[];
|
|
43
44
|
getType(): Type;
|
|
44
45
|
getTypeString(): string;
|
|
45
46
|
inferType(arkMethod: ArkMethod): void;
|
|
@@ -64,7 +65,8 @@ export declare class KeyofTypeExpr extends AbstractTypeExpr {
|
|
|
64
65
|
constructor(opType: Type);
|
|
65
66
|
getOpType(): Type;
|
|
66
67
|
setOpType(opType: Type): void;
|
|
67
|
-
|
|
68
|
+
isUnclearWithVisited(visited: UnclearVisited): boolean;
|
|
69
|
+
getUses(acc?: Value[]): Value[];
|
|
68
70
|
getType(): Type;
|
|
69
71
|
getTypeString(): string;
|
|
70
72
|
inferType(arkMethod: ArkMethod): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeExpr.d.ts","sourceRoot":"","sources":["../../../src/core/base/TypeExpr.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAoB,IAAI,EAA0B,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"TypeExpr.d.ts","sourceRoot":"","sources":["../../../src/core/base/TypeExpr.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAoB,IAAI,EAAE,cAAc,EAA0B,MAAM,QAAQ,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAMrD;;;;;;;;;;;GAWG;AACH,8BAAsB,gBAAiB,SAAQ,IAAI;IAC/C,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE;IAExC,QAAQ,CAAC,OAAO,IAAI,IAAI;IAEjB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;CAG/C;AAED;;;;;;;;;;GAUG;AAEH,qBAAa,aAAc,SAAQ,gBAAgB;IAC/C,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,YAAY,CAAC,CAAS;gBAElB,OAAO,EAAE,KAAK,GAAG,YAAY,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE;IAM1D,UAAU,CAAC,OAAO,EAAE,KAAK,GAAG,YAAY,GAAG,IAAI;IAI/C,UAAU,IAAI,KAAK,GAAG,YAAY;IAIlC,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAIrC,gBAAgB,IAAI,IAAI,EAAE,GAAG,SAAS;IAItC,oBAAoB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;IAoBtD,cAAc,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI;IAOjC,OAAO,CAAC,GAAG,GAAE,KAAK,EAAO,GAAG,KAAK,EAAE;IAUnC,OAAO,IAAI,IAAI;IAQf,aAAa,IAAI,MAAM;IAavB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;CAG/C;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,aAAc,SAAQ,gBAAgB;IAC/C,OAAO,CAAC,MAAM,CAAO;gBAET,MAAM,EAAE,IAAI;IAKjB,SAAS,IAAI,IAAI;IAIjB,SAAS,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI;IAI7B,oBAAoB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;IAQtD,OAAO,CAAC,GAAG,GAAE,KAAK,EAAO,GAAG,KAAK,EAAE;IAOnC,OAAO,IAAI,IAAI;IAIf,aAAa,IAAI,MAAM;IAOvB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;CAG/C"}
|