arkanalyzer 1.0.94 → 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.js +1 -1
- 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 +455 -265
- 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 +181 -53
- 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 +116 -71
- 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/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
|
@@ -45,8 +45,9 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
45
45
|
const ArkNamespace_1 = require("./ArkNamespace");
|
|
46
46
|
const ArkSignature_1 = require("./ArkSignature");
|
|
47
47
|
const TSConst_1 = require("../common/TSConst");
|
|
48
|
-
const
|
|
48
|
+
const StringUtils_1 = require("../common/StringUtils");
|
|
49
49
|
const SdkUtils_1 = require("../common/SdkUtils");
|
|
50
|
+
const SignatureCanonicalizerRegistry_1 = require("../common/SignatureCanonicalizerRegistry");
|
|
50
51
|
const logger_1 = __importStar(require("../../utils/logger"));
|
|
51
52
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkFile');
|
|
52
53
|
exports.notStmtOrExprKind = [
|
|
@@ -81,20 +82,56 @@ var Language;
|
|
|
81
82
|
* @category core/model
|
|
82
83
|
*/
|
|
83
84
|
class ArkFile {
|
|
85
|
+
/** @internal Get the Registry singleton. */
|
|
86
|
+
get registry() {
|
|
87
|
+
return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance();
|
|
88
|
+
}
|
|
84
89
|
constructor(language) {
|
|
85
90
|
this.absoluteFilePath = '';
|
|
86
91
|
this.projectDir = '';
|
|
87
|
-
|
|
88
|
-
this.
|
|
89
|
-
|
|
92
|
+
/** @internal Formal FileSigID of this file. 0 = DEFAULT (not yet set). */
|
|
93
|
+
this.fileSigID = 0;
|
|
94
|
+
/** @internal Formal ClassSigID for the default class. -1 = not yet interned. */
|
|
95
|
+
this.defaultClassID = -1;
|
|
96
|
+
/** @internal Whether this file belongs to the current project (true) or is external (SDK/BuiltIn/library, false). */
|
|
97
|
+
this.projectFile = false;
|
|
98
|
+
this.topNamespaceCount = 0;
|
|
90
99
|
this.importInfoMap = new Map();
|
|
91
100
|
this.exportInfoMap = new Map();
|
|
92
|
-
this.fileSignature = ArkSignature_1.FileSignature.DEFAULT;
|
|
93
101
|
this.anonymousClassNumber = 0;
|
|
94
102
|
this.anonymousNamespaceNumber = 0;
|
|
95
103
|
this.ast = null;
|
|
96
104
|
this.language = language;
|
|
97
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Returns the file signature of this file. A file signature consists of project's name and file's name.
|
|
108
|
+
* @returns The file signature of this file.
|
|
109
|
+
*/
|
|
110
|
+
getFileSignature() {
|
|
111
|
+
return this.registry.fileSigCanonicalizer.get(this.fileSigID);
|
|
112
|
+
}
|
|
113
|
+
/** @internal */
|
|
114
|
+
setFileSignature(fileSignature) {
|
|
115
|
+
// 三态处理(与 ArkClass.setSignature 对齐):
|
|
116
|
+
// 新值首建 → 注册;驱逐态恢复 → 补注册;已有别的 model 持有该签名 → 不覆盖(防"后 setFileSignature 者顶替"写穿)。
|
|
117
|
+
const existing = this.registry.fileSigCanonicalizer.getExistingId(fileSignature);
|
|
118
|
+
this.fileSigID = existing >= 0 ? existing : this.registry.fileSigCanonicalizer.getOrCreateId(fileSignature);
|
|
119
|
+
if (existing < 0 || this.registry.fileSigCanonicalizer.getModel(existing) === undefined) {
|
|
120
|
+
this.registry.registerFile(this);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** @internal Get the formal FileSigID of this file. */
|
|
124
|
+
getFileSigID() {
|
|
125
|
+
return this.fileSigID;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Returns the unique ID of this model — the FileSigID in the canonicalizer.
|
|
129
|
+
* The signature table and the model table share one dense ID space, so this ID
|
|
130
|
+
* resolves both the signature and the model.
|
|
131
|
+
*/
|
|
132
|
+
getId() {
|
|
133
|
+
return this.fileSigID;
|
|
134
|
+
}
|
|
98
135
|
/**
|
|
99
136
|
* Returns the program language of the file.
|
|
100
137
|
*/
|
|
@@ -109,7 +146,7 @@ class ArkFile {
|
|
|
109
146
|
* @returns The file's name (also means its relative path).
|
|
110
147
|
*/
|
|
111
148
|
getName() {
|
|
112
|
-
return this.
|
|
149
|
+
return this.getFileSignature().getFileName();
|
|
113
150
|
}
|
|
114
151
|
setScene(scene) {
|
|
115
152
|
this.scene = scene;
|
|
@@ -159,6 +196,7 @@ class ArkFile {
|
|
|
159
196
|
}
|
|
160
197
|
setCode(code) {
|
|
161
198
|
this.sourceCode = code;
|
|
199
|
+
this.lineStarts = undefined;
|
|
162
200
|
}
|
|
163
201
|
/**
|
|
164
202
|
* Returns the codes of file as a **string.**
|
|
@@ -172,6 +210,7 @@ class ArkFile {
|
|
|
172
210
|
try {
|
|
173
211
|
const sourceText = fs_1.default.readFileSync(this.absoluteFilePath, 'utf8');
|
|
174
212
|
this.sourceCode = sourceText;
|
|
213
|
+
this.lineStarts = undefined;
|
|
175
214
|
return this.sourceCode;
|
|
176
215
|
}
|
|
177
216
|
catch (error) {
|
|
@@ -179,46 +218,182 @@ class ArkFile {
|
|
|
179
218
|
return '';
|
|
180
219
|
}
|
|
181
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Returns cached absolute offsets of each line start in {@link getCode}.
|
|
223
|
+
* Built once per source text and reused by position-based source extraction.
|
|
224
|
+
*/
|
|
225
|
+
getLineStarts() {
|
|
226
|
+
if (this.lineStarts === undefined) {
|
|
227
|
+
this.lineStarts = (0, StringUtils_1.buildLineStarts)(this.getCode());
|
|
228
|
+
}
|
|
229
|
+
return this.lineStarts;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Extracts a source slice by full position using the cached {@link getLineStarts} map.
|
|
233
|
+
*/
|
|
234
|
+
getSourceTextByFullPosition(position) {
|
|
235
|
+
return (0, StringUtils_1.extractSourceTextByFullPosition)(this.getCode(), position, this.getLineStarts());
|
|
236
|
+
}
|
|
182
237
|
/**
|
|
183
238
|
* Clears the cached source text, forcing re-read from file system on next getCode call.
|
|
184
239
|
*/
|
|
185
240
|
clearSourceCode() {
|
|
186
241
|
this.sourceCode = undefined;
|
|
242
|
+
this.lineStarts = undefined;
|
|
187
243
|
}
|
|
188
|
-
addArkClass(arkClass
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
this.classes.set(name, arkClass);
|
|
244
|
+
addArkClass(arkClass) {
|
|
245
|
+
const existing = this.getTopClassByID(arkClass.getClassSigID());
|
|
246
|
+
if (existing) {
|
|
247
|
+
SdkUtils_1.SdkUtils.copyMembers(arkClass, existing);
|
|
193
248
|
}
|
|
194
249
|
else {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (!originName && !arkClass.isAnonymousClass()) {
|
|
198
|
-
const index = name.indexOf(Const_1.NAME_DELIMITER);
|
|
199
|
-
if (index > 0) {
|
|
200
|
-
const originName = name.substring(0, index);
|
|
201
|
-
if (!this.classes.has(originName)) {
|
|
202
|
-
this.addArkClass(arkClass, originName);
|
|
203
|
-
}
|
|
250
|
+
if (!this.topClassSigIDSet) {
|
|
251
|
+
this.topClassSigIDSet = new Set();
|
|
204
252
|
}
|
|
253
|
+
this.topClassSigIDSet.add(arkClass.getClassSigID());
|
|
205
254
|
}
|
|
206
255
|
}
|
|
207
256
|
getDefaultClass() {
|
|
208
|
-
|
|
257
|
+
if (this.defaultClassID !== -1) {
|
|
258
|
+
return this.registry.classSigCanonicalizer.getModel(this.defaultClassID);
|
|
259
|
+
}
|
|
260
|
+
return undefined;
|
|
209
261
|
}
|
|
210
262
|
setDefaultClass(defaultClass) {
|
|
211
|
-
this.
|
|
263
|
+
this.defaultClassID = defaultClass.getClassSigID();
|
|
264
|
+
}
|
|
265
|
+
/** @internal Get the formal ClassSigID of the default class. Returns -1 if not interned. */
|
|
266
|
+
getDefaultClassID() {
|
|
267
|
+
return this.defaultClassID;
|
|
268
|
+
}
|
|
269
|
+
/** @internal Set the formal ClassSigID of the default class directly. */
|
|
270
|
+
setDefaultClassID(classID) {
|
|
271
|
+
this.defaultClassID = classID;
|
|
272
|
+
}
|
|
273
|
+
/** @internal Whether this file belongs to the current project. */
|
|
274
|
+
isProjectFile() {
|
|
275
|
+
return this.projectFile;
|
|
276
|
+
}
|
|
277
|
+
/** @internal Set whether this file belongs to the current project. */
|
|
278
|
+
setProjectFile(isProject) {
|
|
279
|
+
this.projectFile = isProject;
|
|
212
280
|
}
|
|
213
281
|
getNamespace(namespaceSignature) {
|
|
214
|
-
|
|
215
|
-
|
|
282
|
+
var _a;
|
|
283
|
+
// O(1) 归属初筛:签名的 declaringFileSigID 直比本 file 的 SigID。
|
|
284
|
+
if (namespaceSignature.getDeclaringFileSigID() !== this.fileSigID) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
const id = this.registry.namespaceSigCanonicalizer.getExistingId(namespaceSignature);
|
|
288
|
+
if (id !== -1 && this.hasTopNamespaceWithID(id)) {
|
|
289
|
+
return (_a = this.registry.namespaceSigCanonicalizer.getModel(id)) !== null && _a !== void 0 ? _a : null;
|
|
290
|
+
}
|
|
291
|
+
return null;
|
|
216
292
|
}
|
|
217
293
|
getNamespaceWithName(namespaceName) {
|
|
218
|
-
|
|
294
|
+
// 精确匹配:拼本文件归属签名直查(复用 canonicalizer 值索引,O(1),对齐getClassWithName);
|
|
295
|
+
// miss 即 null——签名归属是唯一真相,不做线性扫描兜底。
|
|
296
|
+
if (this.fileSigID >= 0) {
|
|
297
|
+
return this.getNamespace(new ArkSignature_1.NamespaceSignature(namespaceName, this.fileSigID));
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
219
300
|
}
|
|
220
301
|
getNamespaces() {
|
|
221
|
-
|
|
302
|
+
const arr = this.topNamespaceSigIDs;
|
|
303
|
+
if (!arr) {
|
|
304
|
+
return [];
|
|
305
|
+
}
|
|
306
|
+
const reg = this.registry;
|
|
307
|
+
const result = [];
|
|
308
|
+
for (let i = 0; i < this.topNamespaceCount; i++) {
|
|
309
|
+
const ns = reg.namespaceSigCanonicalizer.getModel(arr[i]);
|
|
310
|
+
if (ns) {
|
|
311
|
+
result.push(ns);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
/** @internal Returns the SigIDs of direct child namespaces, or null if no namespaces exist. */
|
|
317
|
+
getTopNamespaceSigIDs() {
|
|
318
|
+
var _a, _b;
|
|
319
|
+
return (_b = (_a = this.topNamespaceSigIDs) === null || _a === void 0 ? void 0 : _a.subarray(0, this.topNamespaceCount)) !== null && _b !== void 0 ? _b : null;
|
|
320
|
+
}
|
|
321
|
+
/** @internal Returns the number of direct child namespaces. */
|
|
322
|
+
getTopNamespaceCount() {
|
|
323
|
+
return this.topNamespaceCount;
|
|
324
|
+
}
|
|
325
|
+
/** @internal Checks whether a namespace with the given SigID is a direct child of this file. */
|
|
326
|
+
hasTopNamespaceWithID(id) {
|
|
327
|
+
const arr = this.topNamespaceSigIDs;
|
|
328
|
+
if (!arr) {
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
for (let i = 0; i < this.topNamespaceCount; i++) {
|
|
332
|
+
if (arr[i] === id) {
|
|
333
|
+
return true;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
/** @internal Returns the direct child namespace with the given SigID, or undefined. */
|
|
339
|
+
getTopNamespaceByID(id) {
|
|
340
|
+
if (this.hasTopNamespaceWithID(id)) {
|
|
341
|
+
return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().getNamespaceById(id);
|
|
342
|
+
}
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
/** @internal Ensures the Int32Array has at least minCapacity slots. */
|
|
346
|
+
ensureTopNamespaceCapacity(minCapacity) {
|
|
347
|
+
if (!this.topNamespaceSigIDs) {
|
|
348
|
+
this.topNamespaceSigIDs = new Int32Array(Math.max(minCapacity, 8));
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (this.topNamespaceSigIDs.length < minCapacity) {
|
|
352
|
+
const newCapacity = Math.max(minCapacity, this.topNamespaceSigIDs.length * 2);
|
|
353
|
+
const newArray = new Int32Array(newCapacity);
|
|
354
|
+
newArray.set(this.topNamespaceSigIDs.subarray(0, this.topNamespaceCount));
|
|
355
|
+
this.topNamespaceSigIDs = newArray;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/** @internal Appends a namespace SigID to the index. */
|
|
359
|
+
addTopNamespaceSigID(id) {
|
|
360
|
+
this.ensureTopNamespaceCapacity(this.topNamespaceCount + 1);
|
|
361
|
+
this.topNamespaceSigIDs[this.topNamespaceCount++] = id;
|
|
362
|
+
}
|
|
363
|
+
/** @internal Removes a namespace SigID from the index (swap-remove). */
|
|
364
|
+
removeTopNamespaceSigID(id) {
|
|
365
|
+
const arr = this.topNamespaceSigIDs;
|
|
366
|
+
if (!arr) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
for (let i = 0; i < this.topNamespaceCount; i++) {
|
|
370
|
+
if (arr[i] === id) {
|
|
371
|
+
arr[i] = arr[--this.topNamespaceCount];
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/** @internal Returns the SigIDs of direct child classes, or null if no classes exist. */
|
|
377
|
+
getTopClassSigIDs() {
|
|
378
|
+
var _a;
|
|
379
|
+
return (_a = this.topClassSigIDSet) !== null && _a !== void 0 ? _a : null;
|
|
380
|
+
}
|
|
381
|
+
/** @internal Returns the number of direct child classes (deduplicated by sigID). */
|
|
382
|
+
getTopClassCount() {
|
|
383
|
+
var _a, _b;
|
|
384
|
+
return (_b = (_a = this.topClassSigIDSet) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0;
|
|
385
|
+
}
|
|
386
|
+
/** @internal Checks whether a class with the given SigID is a direct child of this file. */
|
|
387
|
+
hasTopClassWithID(id) {
|
|
388
|
+
var _a, _b;
|
|
389
|
+
return (_b = (_a = this.topClassSigIDSet) === null || _a === void 0 ? void 0 : _a.has(id)) !== null && _b !== void 0 ? _b : false;
|
|
390
|
+
}
|
|
391
|
+
/** @internal Returns the direct child class with the given SigID, or undefined. */
|
|
392
|
+
getTopClassByID(id) {
|
|
393
|
+
if (this.hasTopClassWithID(id)) {
|
|
394
|
+
return SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().getClassById(id);
|
|
395
|
+
}
|
|
396
|
+
return undefined;
|
|
222
397
|
}
|
|
223
398
|
/**
|
|
224
399
|
* Returns the class based on its class signature. If the class could not be found, **null** will be returned.
|
|
@@ -226,18 +401,32 @@ class ArkFile {
|
|
|
226
401
|
* @returns A class. If there is no class, the return will be a **null**.
|
|
227
402
|
*/
|
|
228
403
|
getClass(classSignature) {
|
|
229
|
-
|
|
230
|
-
|
|
404
|
+
var _a;
|
|
405
|
+
// O(1) 归属初筛:签名的 declaringFileSigID 直比本 file 的 SigID。
|
|
406
|
+
if (classSignature.getDeclaringFileSigID() !== this.fileSigID) {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
const id = this.registry.classSigCanonicalizer.getExistingId(classSignature);
|
|
410
|
+
if (id !== -1 && this.hasTopClassWithID(id)) {
|
|
411
|
+
return (_a = this.registry.classSigCanonicalizer.getModel(id)) !== null && _a !== void 0 ? _a : null;
|
|
412
|
+
}
|
|
413
|
+
return null;
|
|
231
414
|
}
|
|
232
415
|
getClassWithName(className) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
416
|
+
if (this.fileSigID >= 0) {
|
|
417
|
+
const top = this.getClass(ArkSignature_1.ClassSignature.probe(className, this.fileSigID));
|
|
418
|
+
if (top) {
|
|
419
|
+
return top;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const nsIds = this.topNamespaceSigIDs;
|
|
423
|
+
if (nsIds === undefined || nsIds === null) {
|
|
424
|
+
return null;
|
|
237
425
|
}
|
|
238
|
-
|
|
239
|
-
for (
|
|
240
|
-
|
|
426
|
+
const reg = this.registry;
|
|
427
|
+
for (let i = 0; i < this.topNamespaceCount; i++) {
|
|
428
|
+
const ns = reg.namespaceSigCanonicalizer.getModel(nsIds[i]);
|
|
429
|
+
const cls = ns ? this.findClassInNamespace(ns, className) : undefined;
|
|
241
430
|
if (cls) {
|
|
242
431
|
return cls;
|
|
243
432
|
}
|
|
@@ -258,10 +447,28 @@ class ArkFile {
|
|
|
258
447
|
return null;
|
|
259
448
|
}
|
|
260
449
|
getClasses() {
|
|
261
|
-
|
|
450
|
+
const set = this.topClassSigIDSet;
|
|
451
|
+
if (!set) {
|
|
452
|
+
return [];
|
|
453
|
+
}
|
|
454
|
+
const result = [];
|
|
455
|
+
for (const sigID of set) {
|
|
456
|
+
const cls = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().getClassById(sigID);
|
|
457
|
+
if (cls) {
|
|
458
|
+
result.push(cls);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return result;
|
|
262
462
|
}
|
|
263
463
|
addNamespace(namespace) {
|
|
264
|
-
this.
|
|
464
|
+
const existing = this.getNamespace(namespace.getSignature());
|
|
465
|
+
if (existing) {
|
|
466
|
+
// Merge content of namespaces with the same name
|
|
467
|
+
namespace.getClasses().forEach(cls => existing.addArkClass(cls));
|
|
468
|
+
namespace.getNamespaces().forEach(ns => existing.addNamespace(ns));
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
this.addTopNamespaceSigID(namespace.getNamespaceSigID());
|
|
265
472
|
}
|
|
266
473
|
/**
|
|
267
474
|
* Returns an **array** of import information.
|
|
@@ -293,22 +500,34 @@ class ArkFile {
|
|
|
293
500
|
return this.importInfoMap.delete(importInfo.getImportClauseName());
|
|
294
501
|
}
|
|
295
502
|
removeNamespace(namespace) {
|
|
296
|
-
|
|
297
|
-
|
|
503
|
+
const id = namespace.getNamespaceSigID();
|
|
504
|
+
const rtn = this.hasTopNamespaceWithID(id);
|
|
505
|
+
if (rtn) {
|
|
506
|
+
this.removeTopNamespaceSigID(id);
|
|
507
|
+
this.registry.removeNamespace(namespace);
|
|
508
|
+
}
|
|
298
509
|
return rtn;
|
|
299
510
|
}
|
|
300
511
|
removeArkClass(arkClass) {
|
|
301
|
-
|
|
302
|
-
|
|
512
|
+
const id = arkClass.getClassSigID();
|
|
513
|
+
const rtn = this.hasTopClassWithID(id);
|
|
514
|
+
if (rtn) {
|
|
515
|
+
this.topClassSigIDSet.delete(id);
|
|
516
|
+
this.registry.removeClass(arkClass);
|
|
517
|
+
}
|
|
303
518
|
return rtn;
|
|
304
519
|
}
|
|
305
520
|
getExportInfos() {
|
|
306
|
-
const exportInfos =
|
|
521
|
+
const exportInfos = new Array(this.exportInfoMap.size);
|
|
522
|
+
let writeIdx = 0;
|
|
307
523
|
this.exportInfoMap.forEach((value, key) => {
|
|
308
524
|
if (key !== TSConst_1.ALL || value.getFrom()) {
|
|
309
|
-
exportInfos
|
|
525
|
+
exportInfos[writeIdx++] = value;
|
|
310
526
|
}
|
|
311
527
|
});
|
|
528
|
+
if (writeIdx < exportInfos.length) {
|
|
529
|
+
exportInfos.length = writeIdx;
|
|
530
|
+
}
|
|
312
531
|
return exportInfos;
|
|
313
532
|
}
|
|
314
533
|
/**
|
|
@@ -372,7 +591,7 @@ class ArkFile {
|
|
|
372
591
|
this.exportInfoMap.delete(exportInfo.getExportClauseName());
|
|
373
592
|
}
|
|
374
593
|
getProjectName() {
|
|
375
|
-
return this.
|
|
594
|
+
return this.getFileSignature().getProjectName();
|
|
376
595
|
}
|
|
377
596
|
getModuleName() {
|
|
378
597
|
var _a;
|
|
@@ -384,23 +603,13 @@ class ArkFile {
|
|
|
384
603
|
getOhPackageJson5Path() {
|
|
385
604
|
return this.ohPackageJson5Path;
|
|
386
605
|
}
|
|
387
|
-
/**
|
|
388
|
-
* Returns the file signature of this file. A file signature consists of project's name and file's name.
|
|
389
|
-
* @returns The file signature of this file.
|
|
390
|
-
*/
|
|
391
|
-
getFileSignature() {
|
|
392
|
-
return this.fileSignature;
|
|
393
|
-
}
|
|
394
|
-
setFileSignature(fileSignature) {
|
|
395
|
-
this.fileSignature = fileSignature;
|
|
396
|
-
}
|
|
397
606
|
getAllNamespacesUnderThisFile() {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
return
|
|
607
|
+
const result = [];
|
|
608
|
+
for (const ns of this.getNamespaces()) {
|
|
609
|
+
result.push(ns);
|
|
610
|
+
result.push(...ns.getAllNamespacesUnderThisNamespace());
|
|
611
|
+
}
|
|
612
|
+
return result;
|
|
404
613
|
}
|
|
405
614
|
getAnonymousClassNumber() {
|
|
406
615
|
return this.anonymousClassNumber++;
|
|
@@ -415,10 +624,10 @@ class ArkFile {
|
|
|
415
624
|
this.ast = value;
|
|
416
625
|
}
|
|
417
626
|
clearAllReferences() {
|
|
418
|
-
for (const cls of this.
|
|
627
|
+
for (const cls of this.getClasses()) {
|
|
419
628
|
cls.clearAllReferences();
|
|
420
629
|
}
|
|
421
|
-
for (const ns of this.
|
|
630
|
+
for (const ns of this.getNamespaces()) {
|
|
422
631
|
ns.clearAllReferences();
|
|
423
632
|
}
|
|
424
633
|
for (const exp of this.exportInfoMap.values()) {
|
|
@@ -427,11 +636,12 @@ class ArkFile {
|
|
|
427
636
|
for (const imp of this.importInfoMap.values()) {
|
|
428
637
|
imp.clearAllReferences();
|
|
429
638
|
}
|
|
430
|
-
this.
|
|
431
|
-
this.
|
|
639
|
+
this.topClassSigIDSet = undefined;
|
|
640
|
+
this.topNamespaceSigIDs = undefined;
|
|
641
|
+
this.topNamespaceCount = 0;
|
|
432
642
|
this.importInfoMap.clear();
|
|
433
643
|
this.exportInfoMap.clear();
|
|
434
|
-
this.
|
|
644
|
+
this.defaultClassID = -1;
|
|
435
645
|
this.scene = undefined;
|
|
436
646
|
this.moduleScene = undefined;
|
|
437
647
|
this.arkModule = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkImport.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkImport.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,YAAY,EAA4B,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArkImport.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkImport.ts"],"names":[],"mappings":"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"}
|
|
@@ -20,7 +20,6 @@ const Position_1 = require("../base/Position");
|
|
|
20
20
|
const ModelUtils_1 = require("../common/ModelUtils");
|
|
21
21
|
const ModelUtils_2 = require("../../frontend/cppFrontend/common/ModelUtils");
|
|
22
22
|
const ArkBaseModel_1 = require("./ArkBaseModel");
|
|
23
|
-
const StringUtils_1 = require("../common/StringUtils");
|
|
24
23
|
/**
|
|
25
24
|
* Shift amount for import type encoding in ImportInfo tags field.
|
|
26
25
|
* Uses CLASS_SPECIFIC_TAG_SHIFT as the base offset for class-specific properties.
|
|
@@ -263,7 +262,7 @@ class ImportInfo extends ArkBaseModel_1.ArkBaseModel {
|
|
|
263
262
|
if (this.sourceCode !== undefined) {
|
|
264
263
|
return this.sourceCode;
|
|
265
264
|
}
|
|
266
|
-
const code =
|
|
265
|
+
const code = this.getDeclaringArkFile().getSourceTextByFullPosition(this.originFullPosition);
|
|
267
266
|
if (code !== undefined) {
|
|
268
267
|
this.sourceCode = code;
|
|
269
268
|
return code;
|