arkanalyzer 1.0.41 → 1.0.43
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/config/arkanalyzer.json +1 -2
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +52 -38
- package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts +11 -5
- package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PTAUtils.js +42 -24
- package/lib/callgraph/pointerAnalysis/Pag.d.ts +6 -11
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.js +26 -23
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +11 -63
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +72 -499
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +4 -2
- package/lib/callgraph/pointerAnalysis/plugins/ContainerPlugin.d.ts +24 -0
- package/lib/callgraph/pointerAnalysis/plugins/ContainerPlugin.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/plugins/ContainerPlugin.js +167 -0
- package/lib/callgraph/pointerAnalysis/plugins/FunctionPlugin.d.ts +26 -0
- package/lib/callgraph/pointerAnalysis/plugins/FunctionPlugin.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/plugins/FunctionPlugin.js +151 -0
- package/lib/callgraph/pointerAnalysis/plugins/IPagPlugin.d.ts +15 -0
- package/lib/callgraph/pointerAnalysis/plugins/IPagPlugin.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/plugins/IPagPlugin.js +16 -0
- package/lib/callgraph/pointerAnalysis/plugins/PluginManager.d.ts +25 -0
- package/lib/callgraph/pointerAnalysis/plugins/PluginManager.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/plugins/PluginManager.js +66 -0
- package/lib/callgraph/pointerAnalysis/plugins/SdkPlugin.d.ts +37 -0
- package/lib/callgraph/pointerAnalysis/plugins/SdkPlugin.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/plugins/SdkPlugin.js +160 -0
- package/lib/callgraph/pointerAnalysis/plugins/StoragePlugin.d.ts +68 -0
- package/lib/callgraph/pointerAnalysis/plugins/StoragePlugin.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/plugins/StoragePlugin.js +288 -0
- package/lib/core/base/Expr.d.ts +1 -0
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +9 -0
- package/lib/core/common/DummyMainCreater.js +1 -1
- package/lib/core/common/IRInference.d.ts +1 -1
- package/lib/core/common/IRInference.d.ts.map +1 -1
- package/lib/core/common/IRInference.js +7 -3
- package/lib/core/common/ModelUtils.js +1 -1
- package/lib/core/common/SdkUtils.d.ts +3 -2
- package/lib/core/common/SdkUtils.d.ts.map +1 -1
- package/lib/core/common/SdkUtils.js +30 -30
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +7 -5
- package/lib/core/dataflow/DataflowSolver.js +3 -3
- package/lib/core/dataflow/UndefinedVariable.js +2 -2
- package/lib/core/graph/BasicBlock.d.ts.map +1 -1
- package/lib/core/graph/BasicBlock.js +9 -4
- package/lib/core/graph/Cfg.d.ts.map +1 -1
- package/lib/core/graph/Cfg.js +4 -1
- package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/CfgBuilder.js +4 -4
- package/lib/core/graph/builder/ConditionBuilder.d.ts +2 -1
- package/lib/core/graph/builder/ConditionBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/ConditionBuilder.js +8 -4
- package/lib/core/graph/builder/TrapBuilder.d.ts +19 -1
- package/lib/core/graph/builder/TrapBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/TrapBuilder.js +195 -68
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +2 -1
- package/lib/core/model/ArkMethod.d.ts.map +1 -1
- package/lib/core/model/ArkMethod.js +3 -4
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +24 -20
- package/lib/core/model/builder/ArkImportBuilder.js +28 -25
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +1 -2
- package/lib/core/model/builder/BodyBuilder.js +1 -1
- package/lib/pass/Context.d.ts +47 -0
- package/lib/pass/Context.d.ts.map +1 -0
- package/lib/pass/Context.js +72 -0
- package/lib/pass/Dispatcher.d.ts +102 -0
- package/lib/pass/Dispatcher.d.ts.map +1 -0
- package/lib/pass/Dispatcher.js +202 -0
- package/lib/pass/Pass.d.ts +83 -0
- package/lib/pass/Pass.d.ts.map +1 -0
- package/lib/pass/Pass.js +95 -0
- package/lib/pass/ScenePassMgr.d.ts +73 -0
- package/lib/pass/ScenePassMgr.d.ts.map +1 -0
- package/lib/pass/ScenePassMgr.js +156 -0
- package/lib/pass/validators/Exprs.d.ts +9 -0
- package/lib/pass/validators/Exprs.d.ts.map +1 -0
- package/lib/pass/validators/Exprs.js +40 -0
- package/lib/pass/validators/Models.d.ts +14 -0
- package/lib/pass/validators/Models.d.ts.map +1 -0
- package/lib/pass/validators/Models.js +42 -0
- package/lib/pass/validators/SceneValidator.d.ts +19 -0
- package/lib/pass/validators/SceneValidator.d.ts.map +1 -0
- package/lib/pass/validators/SceneValidator.js +77 -0
- package/lib/pass/validators/Stmts.d.ts +7 -0
- package/lib/pass/validators/Stmts.d.ts.map +1 -0
- package/lib/pass/validators/Stmts.js +36 -0
- package/lib/pass/validators/Validator.d.ts +207 -0
- package/lib/pass/validators/Validator.d.ts.map +1 -0
- package/lib/pass/validators/Validator.js +343 -0
- package/lib/pass/validators/Values.d.ts +7 -0
- package/lib/pass/validators/Values.d.ts.map +1 -0
- package/lib/pass/validators/Values.js +34 -0
- package/lib/save/JsonPrinter.d.ts.map +1 -1
- package/lib/save/JsonPrinter.js +26 -102
- package/lib/save/source/SourceStmt.d.ts +1 -0
- package/lib/save/source/SourceStmt.d.ts.map +1 -1
- package/lib/save/source/SourceStmt.js +5 -8
- package/lib/utils/FileUtils.d.ts.map +1 -1
- package/lib/utils/FileUtils.js +13 -6
- package/lib/utils/ValueAsserts.d.ts +9 -0
- package/lib/utils/ValueAsserts.d.ts.map +1 -0
- package/lib/utils/ValueAsserts.js +89 -0
- package/package.json +2 -2
package/config/arkanalyzer.json
CHANGED
package/lib/Scene.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../src/Scene.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,EAAY,MAAM,UAAU,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/G,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAK1C,OAAO,EAAE,SAAS,EAA0B,MAAM,wBAAwB,CAAC;AAG3E,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAYxD,aAAK,eAAe;IAChB,UAAU,IAAA;IACV,YAAY,IAAA;IACZ,UAAU,IAAA;IACV,WAAW,IAAA;IACX,eAAe,IAAA;IACf,gBAAgB,IAAA;IAChB,aAA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{
|
|
|
107
107
|
this.buildStage = SceneBuildStage.BUILD_INIT;
|
|
108
108
|
this.fileLanguages = new Map();
|
|
109
109
|
this.indexPathArray = ['Index.ets', 'Index.ts', 'Index.d.ets', 'Index.d.ts', 'index.ets', 'index.ts', 'index.d.ets', 'index.d.ts'];
|
|
110
|
-
this.unhandledFilePaths =
|
|
110
|
+
this.unhandledFilePaths = new Set();
|
|
111
111
|
this.unhandledSdkFilePaths = [];
|
|
112
112
|
}
|
|
113
113
|
/*
|
|
@@ -205,7 +205,7 @@ class Scene {
|
|
|
205
205
|
}
|
|
206
206
|
// handle sdks
|
|
207
207
|
if (this.options.enableBuiltIn && !sceneConfig.getSdksObj().find(sdk => sdk.name === SdkUtils_1.SdkUtils.BUILT_IN_NAME)) {
|
|
208
|
-
sceneConfig.getSdksObj().unshift(SdkUtils_1.SdkUtils.
|
|
208
|
+
sceneConfig.getSdksObj().unshift(SdkUtils_1.SdkUtils.getBuiltInSdk());
|
|
209
209
|
}
|
|
210
210
|
(_a = sceneConfig.getSdksObj()) === null || _a === void 0 ? void 0 : _a.forEach(sdk => {
|
|
211
211
|
if (!sdk.moduleName) {
|
|
@@ -354,11 +354,11 @@ class Scene {
|
|
|
354
354
|
const arkFile = new ArkFile_1.ArkFile(FileUtils_1.FileUtils.getFileLanguage(file, this.fileLanguages));
|
|
355
355
|
arkFile.setScene(this);
|
|
356
356
|
(0, ArkFileBuilder_1.buildArkFileFromFile)(file, this.realProjectDir, arkFile, this.projectName);
|
|
357
|
-
this.
|
|
357
|
+
this.setFile(arkFile);
|
|
358
358
|
}
|
|
359
359
|
catch (error) {
|
|
360
360
|
logger.error('Error parsing file:', file, error);
|
|
361
|
-
this.unhandledFilePaths.
|
|
361
|
+
this.unhandledFilePaths.add(file);
|
|
362
362
|
return;
|
|
363
363
|
}
|
|
364
364
|
});
|
|
@@ -377,9 +377,11 @@ class Scene {
|
|
|
377
377
|
return;
|
|
378
378
|
}
|
|
379
379
|
const fileSignature = new ArkSignature_1.FileSignature(this.getProjectName(), path_1.default.relative(this.getRealProjectDir(), projectFile));
|
|
380
|
-
if (this.filesMap.has(fileSignature.toMapKey()) || this.isRepeatBuildFile(projectFile)) {
|
|
380
|
+
if (this.filesMap.has(fileSignature.toMapKey()) || this.isRepeatBuildFile(projectFile) || this.unhandledFilePaths.has(projectFile)) {
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
|
+
// Here use unhandledFilePaths to temporarily store current file until add it to fileMaps to avoid recursively import issue.
|
|
384
|
+
this.unhandledFilePaths.add(projectFile);
|
|
383
385
|
try {
|
|
384
386
|
const arkFile = new ArkFile_1.ArkFile(FileUtils_1.FileUtils.getFileLanguage(projectFile, this.fileLanguages));
|
|
385
387
|
arkFile.setScene(this);
|
|
@@ -390,16 +392,17 @@ class Scene {
|
|
|
390
392
|
break;
|
|
391
393
|
}
|
|
392
394
|
}
|
|
393
|
-
this.filesMap.set(arkFile.getFileSignature().toMapKey(), arkFile);
|
|
394
395
|
const importInfos = arkFile.getImportInfos();
|
|
395
396
|
const repeatFroms = [];
|
|
396
397
|
this.findDependencyFiles(importInfos, arkFile, repeatFroms);
|
|
397
398
|
const exportInfos = arkFile.getExportInfos();
|
|
398
399
|
this.findDependencyFiles(exportInfos, arkFile, repeatFroms);
|
|
400
|
+
// add currently file to files map after adding all its dependencies, and remove it from unhandledFilePaths
|
|
401
|
+
this.setFile(arkFile);
|
|
402
|
+
this.unhandledFilePaths.delete(projectFile);
|
|
399
403
|
}
|
|
400
404
|
catch (error) {
|
|
401
405
|
logger.error('Error parsing file:', projectFile, error);
|
|
402
|
-
this.unhandledFilePaths.push(projectFile);
|
|
403
406
|
return;
|
|
404
407
|
}
|
|
405
408
|
}
|
|
@@ -437,28 +440,31 @@ class Scene {
|
|
|
437
440
|
}
|
|
438
441
|
}
|
|
439
442
|
parseFrom(from, arkFile) {
|
|
440
|
-
if (/^@[a-z|\-]+?\/?/.test(from)) {
|
|
443
|
+
if (/^@[a-z|\-]+?\/?/.test(from) || /^[a-z][a-z0-9._-]*[a-z0-9]$/.test(from)) {
|
|
444
|
+
// TODO: if there are more than one modules with the same name e.g. @lib1, here may got the wrong dependency
|
|
445
|
+
// It is better to loop all oh pkg with priority rather than the map key order. But it should be very complicated.
|
|
446
|
+
// Currently it is ok because it's with low probability and order error only affects type accuracy but has no other impact.
|
|
441
447
|
for (const [ohPkgContentPath, ohPkgContent] of this.ohPkgContentMap) {
|
|
442
|
-
this.findDependenciesByOhPkg(ohPkgContentPath, ohPkgContent, from
|
|
448
|
+
this.findDependenciesByOhPkg(ohPkgContentPath, ohPkgContent, from);
|
|
443
449
|
}
|
|
444
450
|
}
|
|
445
451
|
else if (/^([^@]*\/)([^\/]*)$/.test(from) || /^[\.\./|\.\.]+$/.test(from)) {
|
|
446
452
|
this.findRelativeDependenciesByOhPkg(from, arkFile);
|
|
447
453
|
}
|
|
448
454
|
else if (/^[@a-zA-Z0-9]+(\/[a-zA-Z0-9]+)*$/.test(from)) {
|
|
449
|
-
this.findDependenciesByTsConfig(from
|
|
455
|
+
this.findDependenciesByTsConfig(from);
|
|
450
456
|
}
|
|
451
457
|
}
|
|
452
|
-
findDependenciesByTsConfig(from
|
|
458
|
+
findDependenciesByTsConfig(from) {
|
|
453
459
|
if (this.globalModule2PathMapping) {
|
|
454
460
|
const paths = this.globalModule2PathMapping;
|
|
455
|
-
Object.keys(paths).forEach(key => this.parseTsConfigParms(paths, key, from
|
|
461
|
+
Object.keys(paths).forEach(key => this.parseTsConfigParms(paths, key, from));
|
|
456
462
|
}
|
|
457
463
|
}
|
|
458
|
-
parseTsConfigParms(paths, key, from
|
|
464
|
+
parseTsConfigParms(paths, key, from) {
|
|
459
465
|
const module2pathMapping = paths[key];
|
|
460
466
|
if (key.includes(TSConst_1.ALL)) {
|
|
461
|
-
this.processFuzzyMapping(key, from, module2pathMapping
|
|
467
|
+
this.processFuzzyMapping(key, from, module2pathMapping);
|
|
462
468
|
}
|
|
463
469
|
else if (from.startsWith(key)) {
|
|
464
470
|
let tail = from.substring(key.length, from.length);
|
|
@@ -467,11 +473,11 @@ class Scene {
|
|
|
467
473
|
if (this.baseUrl) {
|
|
468
474
|
originPath = path_1.default.resolve(this.baseUrl, originPath);
|
|
469
475
|
}
|
|
470
|
-
this.findDependenciesByRule(originPath
|
|
476
|
+
this.findDependenciesByRule(originPath);
|
|
471
477
|
});
|
|
472
478
|
}
|
|
473
479
|
}
|
|
474
|
-
processFuzzyMapping(key, from, module2pathMapping
|
|
480
|
+
processFuzzyMapping(key, from, module2pathMapping) {
|
|
475
481
|
key = key.substring(0, key.indexOf(TSConst_1.ALL) - 1);
|
|
476
482
|
if (from.substring(0, key.indexOf(TSConst_1.ALL) - 1) === key) {
|
|
477
483
|
let tail = from.substring(key.indexOf(TSConst_1.ALL) - 1, from.length);
|
|
@@ -481,31 +487,31 @@ class Scene {
|
|
|
481
487
|
if (this.baseUrl) {
|
|
482
488
|
originPath = path_1.default.join(this.baseUrl, originPath);
|
|
483
489
|
}
|
|
484
|
-
this.findDependenciesByRule(originPath
|
|
490
|
+
this.findDependenciesByRule(originPath);
|
|
485
491
|
});
|
|
486
492
|
}
|
|
487
493
|
}
|
|
488
|
-
findDependenciesByRule(originPath
|
|
489
|
-
if (!this.findFilesByPathArray(originPath, this.indexPathArray
|
|
490
|
-
!this.findFilesByExtNameArray(originPath, this.options.supportFileExts
|
|
494
|
+
findDependenciesByRule(originPath) {
|
|
495
|
+
if (!this.findFilesByPathArray(originPath, this.indexPathArray) &&
|
|
496
|
+
!this.findFilesByExtNameArray(originPath, this.options.supportFileExts)) {
|
|
491
497
|
logger.trace(originPath + 'module mapperInfo is not found!');
|
|
492
498
|
}
|
|
493
499
|
}
|
|
494
|
-
findFilesByPathArray(originPath, pathArray
|
|
500
|
+
findFilesByPathArray(originPath, pathArray) {
|
|
495
501
|
for (const pathInfo of pathArray) {
|
|
496
502
|
const curPath = path_1.default.join(originPath, pathInfo);
|
|
497
503
|
if (fs_1.default.existsSync(curPath) && !this.isRepeatBuildFile(curPath)) {
|
|
498
|
-
this.addFileNode2DependencyGrap(curPath
|
|
504
|
+
this.addFileNode2DependencyGrap(curPath);
|
|
499
505
|
return true;
|
|
500
506
|
}
|
|
501
507
|
}
|
|
502
508
|
return false;
|
|
503
509
|
}
|
|
504
|
-
findFilesByExtNameArray(originPath, pathArray
|
|
510
|
+
findFilesByExtNameArray(originPath, pathArray) {
|
|
505
511
|
for (const pathInfo of pathArray) {
|
|
506
512
|
const curPath = originPath + pathInfo;
|
|
507
513
|
if (fs_1.default.existsSync(curPath) && !this.isRepeatBuildFile(curPath)) {
|
|
508
|
-
this.addFileNode2DependencyGrap(curPath
|
|
514
|
+
this.addFileNode2DependencyGrap(curPath);
|
|
509
515
|
return true;
|
|
510
516
|
}
|
|
511
517
|
}
|
|
@@ -525,12 +531,12 @@ class Scene {
|
|
|
525
531
|
let originPath = this.getOriginPath(from, arkFile);
|
|
526
532
|
if (fs_1.default.existsSync(path_1.default.join(originPath, EtsConst_1.OH_PACKAGE_JSON5))) {
|
|
527
533
|
for (const [ohPkgContentPath, ohPkgContent] of this.ohPkgContentMap) {
|
|
528
|
-
this.findDependenciesByOhPkg(ohPkgContentPath, ohPkgContent, from
|
|
534
|
+
this.findDependenciesByOhPkg(ohPkgContentPath, ohPkgContent, from);
|
|
529
535
|
}
|
|
530
536
|
}
|
|
531
|
-
this.findDependenciesByRule(originPath
|
|
537
|
+
this.findDependenciesByRule(originPath);
|
|
532
538
|
}
|
|
533
|
-
findDependenciesByOhPkg(ohPkgContentPath, ohPkgContentInfo, from
|
|
539
|
+
findDependenciesByOhPkg(ohPkgContentPath, ohPkgContentInfo, from) {
|
|
534
540
|
//module name @ohos/from
|
|
535
541
|
const ohPkgContent = ohPkgContentInfo;
|
|
536
542
|
//module main name is must be
|
|
@@ -539,22 +545,22 @@ class Scene {
|
|
|
539
545
|
if (ohPkgContent.main) {
|
|
540
546
|
originPath = path_1.default.join(ohPkgContentPath.toString().replace(EtsConst_1.OH_PACKAGE_JSON5, ''), ohPkgContent.main.toString());
|
|
541
547
|
if (ohPkgContent.dependencies) {
|
|
542
|
-
this.getDependenciesMapping(ohPkgContent.dependencies, ohPkgContentPath, from
|
|
548
|
+
this.getDependenciesMapping(ohPkgContent.dependencies, ohPkgContentPath, from);
|
|
543
549
|
}
|
|
544
550
|
else if (ohPkgContent.devDependencies) {
|
|
545
|
-
this.getDependenciesMapping(ohPkgContent.devDependencies, ohPkgContentPath, from
|
|
551
|
+
this.getDependenciesMapping(ohPkgContent.devDependencies, ohPkgContentPath, from);
|
|
546
552
|
}
|
|
547
553
|
else if (ohPkgContent.dynamicDependencies) {
|
|
548
554
|
// dynamicDependencies not support
|
|
549
555
|
}
|
|
550
|
-
this.addFileNode2DependencyGrap(originPath
|
|
556
|
+
this.addFileNode2DependencyGrap(originPath);
|
|
551
557
|
}
|
|
552
|
-
if (!this.findFilesByPathArray(originPath, this.indexPathArray
|
|
558
|
+
if (!this.findFilesByPathArray(originPath, this.indexPathArray)) {
|
|
553
559
|
logger.trace(originPath + 'module mapperInfo is not found!');
|
|
554
560
|
}
|
|
555
561
|
}
|
|
556
562
|
}
|
|
557
|
-
getDependenciesMapping(dependencies, ohPkgContentPath, from
|
|
563
|
+
getDependenciesMapping(dependencies, ohPkgContentPath, from) {
|
|
558
564
|
for (let [moduleName, modulePath] of Object.entries(dependencies)) {
|
|
559
565
|
logger.debug('dependencies:' + moduleName);
|
|
560
566
|
if (modulePath.startsWith('file:')) {
|
|
@@ -563,7 +569,7 @@ class Scene {
|
|
|
563
569
|
const innerOhpackagePath = path_1.default.join(ohPkgContentPath.replace(EtsConst_1.OH_PACKAGE_JSON5, ''), modulePath.toString(), EtsConst_1.OH_PACKAGE_JSON5);
|
|
564
570
|
if (!this.ohPkgContentMap.has(innerOhpackagePath)) {
|
|
565
571
|
const innerModuleOhPkgContent = (0, json5parser_1.fetchDependenciesFromFile)(innerOhpackagePath);
|
|
566
|
-
this.findDependenciesByOhPkg(innerOhpackagePath, innerModuleOhPkgContent, from
|
|
572
|
+
this.findDependenciesByOhPkg(innerOhpackagePath, innerModuleOhPkgContent, from);
|
|
567
573
|
}
|
|
568
574
|
}
|
|
569
575
|
}
|
|
@@ -571,13 +577,21 @@ class Scene {
|
|
|
571
577
|
const parentPath = /^\.{1,2}\//.test(from) ? path_1.default.dirname(arkFile.getFilePath()) : arkFile.getProjectDir();
|
|
572
578
|
return path_1.default.resolve(parentPath, from);
|
|
573
579
|
}
|
|
574
|
-
addFileNode2DependencyGrap(filePath
|
|
580
|
+
addFileNode2DependencyGrap(filePath) {
|
|
575
581
|
this.getDependencyFilesDeeply(filePath);
|
|
576
|
-
this.filesMap.set(arkFile.getFileSignature().toMapKey(), arkFile);
|
|
577
582
|
}
|
|
578
583
|
buildSdk(sdkName, sdkPath) {
|
|
579
|
-
|
|
580
|
-
|
|
584
|
+
var _a;
|
|
585
|
+
let allFiles;
|
|
586
|
+
if (sdkName === SdkUtils_1.SdkUtils.BUILT_IN_NAME) {
|
|
587
|
+
allFiles = SdkUtils_1.SdkUtils.fetchBuiltInFiles(sdkPath);
|
|
588
|
+
if (allFiles.length > 0) {
|
|
589
|
+
(_a = this.getOptions().sdkGlobalFolders) === null || _a === void 0 ? void 0 : _a.push(sdkPath);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
allFiles = (0, getAllFiles_1.getAllFiles)(sdkPath, this.options.supportFileExts, this.options.ignoreFileNames);
|
|
594
|
+
}
|
|
581
595
|
allFiles.forEach(file => {
|
|
582
596
|
logger.trace('=== parse sdk file:', file);
|
|
583
597
|
try {
|
|
@@ -727,7 +741,7 @@ class Scene {
|
|
|
727
741
|
* Returns the absolute file paths that cannot be handled currently.
|
|
728
742
|
*/
|
|
729
743
|
getUnhandledFilePaths() {
|
|
730
|
-
return this.unhandledFilePaths;
|
|
744
|
+
return Array.from(this.unhandledFilePaths);
|
|
731
745
|
}
|
|
732
746
|
/*
|
|
733
747
|
* Returns the absolute sdk file paths that cannot be handled currently.
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { ClassSignature, MethodSignature } from '../../core/model/ArkSignature';
|
|
1
|
+
import { ClassSignature, FieldSignature, MethodSignature } from '../../core/model/ArkSignature';
|
|
2
2
|
export declare function IsCollectionClass(classSignature: ClassSignature): boolean;
|
|
3
3
|
export declare enum BuiltApiType {
|
|
4
4
|
SetAdd = 0,
|
|
5
5
|
MapSet = 1,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
MapGet = 2,
|
|
7
|
+
ArrayPush = 3,
|
|
8
|
+
Foreach = 4,
|
|
9
|
+
FunctionCall = 5,
|
|
10
|
+
FunctionApply = 6,
|
|
11
|
+
FunctionBind = 7,
|
|
12
|
+
NotBuiltIn = 8
|
|
10
13
|
}
|
|
14
|
+
export declare const ARRAY_FIELD_SIGNATURE: FieldSignature;
|
|
15
|
+
export declare const SET_FIELD_SIGNATURE: FieldSignature;
|
|
16
|
+
export declare const MAP_FIELD_SIGNATURE: FieldSignature;
|
|
11
17
|
export declare function getBuiltInApiType(method: MethodSignature): BuiltApiType;
|
|
12
18
|
//# sourceMappingURL=PTAUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PTAUtils.d.ts","sourceRoot":"","sources":["../../../src/callgraph/pointerAnalysis/PTAUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PTAUtils.d.ts","sourceRoot":"","sources":["../../../src/callgraph/pointerAnalysis/PTAUtils.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAiB,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE/G,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAKzE;AAED,oBAAY,YAAY;IACpB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,MAAM,IAAA;IACN,SAAS,IAAA;IACT,OAAO,IAAA;IACP,YAAY,IAAA;IACZ,aAAa,IAAA;IACb,YAAY,IAAA;IACZ,UAAU,IAAA;CACb;AAED,eAAO,MAAM,qBAAqB,gBAIjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,gBAI/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,gBAI/B,CAAC;AAsBF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,YAAY,CAoBvE"}
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getBuiltInApiType = exports.BuiltApiType = exports.IsCollectionClass = void 0;
|
|
17
|
+
exports.getBuiltInApiType = exports.MAP_FIELD_SIGNATURE = exports.SET_FIELD_SIGNATURE = exports.ARRAY_FIELD_SIGNATURE = exports.BuiltApiType = exports.IsCollectionClass = void 0;
|
|
18
|
+
const Type_1 = require("../../core/base/Type");
|
|
19
|
+
const ArkSignature_1 = require("../../core/model/ArkSignature");
|
|
18
20
|
function IsCollectionClass(classSignature) {
|
|
19
21
|
if (classSignature.toString().endsWith('lib.es2015.collection.d.ts: Set') || classSignature.toString().endsWith('lib.es2015.collection.d.ts: Map')) {
|
|
20
22
|
return true;
|
|
@@ -26,33 +28,49 @@ var BuiltApiType;
|
|
|
26
28
|
(function (BuiltApiType) {
|
|
27
29
|
BuiltApiType[BuiltApiType["SetAdd"] = 0] = "SetAdd";
|
|
28
30
|
BuiltApiType[BuiltApiType["MapSet"] = 1] = "MapSet";
|
|
29
|
-
BuiltApiType[BuiltApiType["
|
|
30
|
-
BuiltApiType[BuiltApiType["
|
|
31
|
-
BuiltApiType[BuiltApiType["
|
|
32
|
-
BuiltApiType[BuiltApiType["
|
|
31
|
+
BuiltApiType[BuiltApiType["MapGet"] = 2] = "MapGet";
|
|
32
|
+
BuiltApiType[BuiltApiType["ArrayPush"] = 3] = "ArrayPush";
|
|
33
|
+
BuiltApiType[BuiltApiType["Foreach"] = 4] = "Foreach";
|
|
34
|
+
BuiltApiType[BuiltApiType["FunctionCall"] = 5] = "FunctionCall";
|
|
35
|
+
BuiltApiType[BuiltApiType["FunctionApply"] = 6] = "FunctionApply";
|
|
36
|
+
BuiltApiType[BuiltApiType["FunctionBind"] = 7] = "FunctionBind";
|
|
37
|
+
BuiltApiType[BuiltApiType["NotBuiltIn"] = 8] = "NotBuiltIn";
|
|
33
38
|
})(BuiltApiType = exports.BuiltApiType || (exports.BuiltApiType = {}));
|
|
39
|
+
exports.ARRAY_FIELD_SIGNATURE = new ArkSignature_1.FieldSignature('field', new ArkSignature_1.ClassSignature('Array', new ArkSignature_1.FileSignature('container', 'lib.es5.d.ts')), new Type_1.UnclearReferenceType(''));
|
|
40
|
+
exports.SET_FIELD_SIGNATURE = new ArkSignature_1.FieldSignature('field', new ArkSignature_1.ClassSignature('Set', new ArkSignature_1.FileSignature('container', 'lib.es2015.collection.d.ts')), new Type_1.UnclearReferenceType(''));
|
|
41
|
+
exports.MAP_FIELD_SIGNATURE = new ArkSignature_1.FieldSignature('field', new ArkSignature_1.ClassSignature('Map', new ArkSignature_1.FileSignature('container', 'lib.es2015.collection.d.ts')), new Type_1.UnclearReferenceType(''));
|
|
42
|
+
const BUILTIN_API_PATTERNS = new Map([
|
|
43
|
+
// set
|
|
44
|
+
['lib.es2015.collection.d.ts: Set.add(T)', BuiltApiType.SetAdd],
|
|
45
|
+
['lib.es2015.collection.d.ts: Set.forEach(', BuiltApiType.Foreach],
|
|
46
|
+
// map
|
|
47
|
+
['lib.es2015.collection.d.ts: Map.set(K, V)', BuiltApiType.MapSet],
|
|
48
|
+
['lib.es2015.collection.d.ts: Map.get(K)', BuiltApiType.MapGet],
|
|
49
|
+
['lib.es2015.collection.d.ts: Map.forEach(', BuiltApiType.Foreach],
|
|
50
|
+
// array
|
|
51
|
+
['lib.es5.d.ts: Array.push(T[])', BuiltApiType.ArrayPush],
|
|
52
|
+
['lib.es5.d.ts: Array.forEach(', BuiltApiType.Foreach],
|
|
53
|
+
]);
|
|
54
|
+
const FUNCTION_METHOD_REGEX = /lib\.es5\.d\.ts: Function\.(call|apply|bind)\(/;
|
|
55
|
+
const FUNCTION_METHOD_MAP = {
|
|
56
|
+
'call': BuiltApiType.FunctionCall,
|
|
57
|
+
'apply': BuiltApiType.FunctionApply,
|
|
58
|
+
'bind': BuiltApiType.FunctionBind
|
|
59
|
+
};
|
|
34
60
|
function getBuiltInApiType(method) {
|
|
35
61
|
let methodSigStr = method.toString();
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
62
|
+
for (const [pattern, apiType] of BUILTIN_API_PATTERNS.entries()) {
|
|
63
|
+
const escapedPattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
64
|
+
const regex = new RegExp(escapedPattern);
|
|
65
|
+
if (regex.test(methodSigStr)) {
|
|
66
|
+
return apiType;
|
|
67
|
+
}
|
|
42
68
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
case 'call':
|
|
49
|
-
return BuiltApiType.FunctionCall;
|
|
50
|
-
case 'apply':
|
|
51
|
-
return BuiltApiType.FunctionApply;
|
|
52
|
-
case 'bind':
|
|
53
|
-
return BuiltApiType.FunctionBind;
|
|
54
|
-
default:
|
|
55
|
-
}
|
|
69
|
+
const match = methodSigStr.match(FUNCTION_METHOD_REGEX);
|
|
70
|
+
if (match) {
|
|
71
|
+
const functionName = match[1];
|
|
72
|
+
if (functionName in FUNCTION_METHOD_MAP) {
|
|
73
|
+
return FUNCTION_METHOD_MAP[functionName];
|
|
56
74
|
}
|
|
57
75
|
}
|
|
58
76
|
return BuiltApiType.NotBuiltIn;
|
|
@@ -5,11 +5,13 @@ import { ArkAssignStmt, Stmt } from '../../core/base/Stmt';
|
|
|
5
5
|
import { AbstractExpr } from '../../core/base/Expr';
|
|
6
6
|
import { AbstractFieldRef, ArkArrayRef, ArkInstanceFieldRef, ArkParameterRef, ArkStaticFieldRef, ArkThisRef } from '../../core/base/Ref';
|
|
7
7
|
import { Local } from '../../core/base/Local';
|
|
8
|
+
import { Constant } from '../../core/base/Constant';
|
|
8
9
|
import { MethodSignature } from '../../core/model/ArkSignature';
|
|
9
10
|
import { ExportInfo } from '../../core/model/ArkExport';
|
|
10
11
|
import { BuiltApiType } from './PTAUtils';
|
|
11
12
|
import { IPtsCollection } from './PtsDS';
|
|
12
13
|
import { ContextID } from './context/Context';
|
|
14
|
+
import { StorageType } from './plugins/StoragePlugin';
|
|
13
15
|
export type PagNodeType = Value;
|
|
14
16
|
export declare enum PagEdgeKind {
|
|
15
17
|
Address = 0,
|
|
@@ -20,16 +22,6 @@ export declare enum PagEdgeKind {
|
|
|
20
22
|
Unknown = 5,
|
|
21
23
|
InterProceduralCopy = 6
|
|
22
24
|
}
|
|
23
|
-
export declare enum StorageType {
|
|
24
|
-
APP_STORAGE = 0,
|
|
25
|
-
LOCAL_STORAGE = 1,
|
|
26
|
-
Undefined = 2
|
|
27
|
-
}
|
|
28
|
-
export declare enum StorageLinkEdgeType {
|
|
29
|
-
Property2Local = 0,
|
|
30
|
-
Local2Property = 1,
|
|
31
|
-
TwoWay = 2
|
|
32
|
-
}
|
|
33
25
|
export declare class PagEdge extends BaseEdge {
|
|
34
26
|
private stmt;
|
|
35
27
|
constructor(n: PagNode, d: PagNode, k: PagEdgeKind, s?: Stmt);
|
|
@@ -155,6 +147,9 @@ export declare class PagArrayNode extends PagNode {
|
|
|
155
147
|
base: Value;
|
|
156
148
|
constructor(id: NodeID, cid: number | undefined, expr: ArkArrayRef, stmt?: Stmt);
|
|
157
149
|
}
|
|
150
|
+
export declare class PagConstantNode extends PagNode {
|
|
151
|
+
constructor(id: NodeID, cid: number | undefined, constant: Constant, stmt?: Stmt);
|
|
152
|
+
}
|
|
158
153
|
/**
|
|
159
154
|
* below is heapObj like Node
|
|
160
155
|
*/
|
|
@@ -215,7 +210,7 @@ export declare class Pag extends BaseExplicitGraph {
|
|
|
215
210
|
getCG(): CallGraph;
|
|
216
211
|
getOrClonePagNode(src: PagNode, basePt: NodeID): PagNode;
|
|
217
212
|
getOrClonePagFieldNode(src: PagInstanceFieldNode, basePt: NodeID): PagInstanceFieldNode | undefined;
|
|
218
|
-
getOrClonePagContainerFieldNode(basePt: NodeID,
|
|
213
|
+
getOrClonePagContainerFieldNode(basePt: NodeID, base: Local, className: string): PagInstanceFieldNode | undefined;
|
|
219
214
|
getOrClonePagFuncNode(basePt: NodeID): PagFuncNode | undefined;
|
|
220
215
|
addPagNode(cid: ContextID, value: PagNodeType, stmt?: Stmt, refresh?: boolean): PagNode;
|
|
221
216
|
private handleLocalNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pag.d.ts","sourceRoot":"","sources":["../../../src/callgraph/pointerAnalysis/Pag.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAiB,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAA+B,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzI,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Pag.d.ts","sourceRoot":"","sources":["../../../src/callgraph/pointerAnalysis/Pag.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EA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,MAAM,mBAAmB,GAAG;IAC9B,GAAG,EAAE,sBAAsB,CAAC;IAC5B,GAAG,EAAE,KAAK,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,qBAAa,OAAO;IAChB,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,OAAO,CAAC,gBAAgB,CAAiB;IAElC,gBAAgB,IAAI,GAAG,CAAC,mBAAmB,CAAC,GAAG,SAAS;IAIxD,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAKrC,kBAAkB,IAAI,GAAG,CAAC,QAAQ,CAAC;IAKnC,kBAAkB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI;IAKzC,mBAAmB,IAAI,GAAG,CAAC,WAAW,CAAC;IAKvC,kBAAkB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAKtC,mBAAmB,IAAI,GAAG,CAAC,QAAQ,CAAC;IAKpC,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO;CAmBvE;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,cAAc,CAA2B;;IAM1C,uBAAuB,IAAI,GAAG,CAAC,mBAAmB,CAAC;IAInD,2BAA2B,CAAC,CAAC,EAAE,mBAAmB,GAAG,IAAI;CAGnE"}
|
|
@@ -37,7 +37,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
37
37
|
return result;
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.InterFuncPag = exports.FuncPag = exports.Pag = exports.PagGlobalThisNode = exports.PagFuncNode = exports.PagParamNode = exports.PagNewContainerExprNode = exports.PagNewExprNode = exports.PagArrayNode = exports.PagThisRefNode = exports.PagStaticFieldNode = exports.PagInstanceFieldNode = exports.PagLocalNode = exports.PagNode = exports.PagNodeKind = exports.ThisPagEdge = exports.WritePagEdge = exports.LoadPagEdge = exports.CopyPagEdge = exports.AddrPagEdge = exports.PagEdge = exports.
|
|
40
|
+
exports.InterFuncPag = exports.FuncPag = exports.Pag = exports.PagGlobalThisNode = exports.PagFuncNode = exports.PagParamNode = exports.PagNewContainerExprNode = exports.PagNewExprNode = exports.PagConstantNode = exports.PagArrayNode = exports.PagThisRefNode = exports.PagStaticFieldNode = exports.PagInstanceFieldNode = exports.PagLocalNode = exports.PagNode = exports.PagNodeKind = exports.ThisPagEdge = exports.WritePagEdge = exports.LoadPagEdge = exports.CopyPagEdge = exports.AddrPagEdge = exports.PagEdge = exports.PagEdgeKind = void 0;
|
|
41
41
|
const BaseExplicitGraph_1 = require("../../core/graph/BaseExplicitGraph");
|
|
42
42
|
const Stmt_1 = require("../../core/base/Stmt");
|
|
43
43
|
const Expr_1 = require("../../core/base/Expr");
|
|
@@ -47,7 +47,6 @@ const GraphPrinter_1 = require("../../save/GraphPrinter");
|
|
|
47
47
|
const PrinterBuilder_1 = require("../../save/PrinterBuilder");
|
|
48
48
|
const Constant_1 = require("../../core/base/Constant");
|
|
49
49
|
const Type_1 = require("../../core/base/Type");
|
|
50
|
-
const ArkSignature_1 = require("../../core/model/ArkSignature");
|
|
51
50
|
const logger_1 = __importStar(require("../../utils/logger"));
|
|
52
51
|
const TSConst_1 = require("../../core/common/TSConst");
|
|
53
52
|
const ArkExport_1 = require("../../core/model/ArkExport");
|
|
@@ -67,18 +66,6 @@ var PagEdgeKind;
|
|
|
67
66
|
PagEdgeKind[PagEdgeKind["Unknown"] = 5] = "Unknown";
|
|
68
67
|
PagEdgeKind[PagEdgeKind["InterProceduralCopy"] = 6] = "InterProceduralCopy";
|
|
69
68
|
})(PagEdgeKind = exports.PagEdgeKind || (exports.PagEdgeKind = {}));
|
|
70
|
-
var StorageType;
|
|
71
|
-
(function (StorageType) {
|
|
72
|
-
StorageType[StorageType["APP_STORAGE"] = 0] = "APP_STORAGE";
|
|
73
|
-
StorageType[StorageType["LOCAL_STORAGE"] = 1] = "LOCAL_STORAGE";
|
|
74
|
-
StorageType[StorageType["Undefined"] = 2] = "Undefined";
|
|
75
|
-
})(StorageType = exports.StorageType || (exports.StorageType = {}));
|
|
76
|
-
var StorageLinkEdgeType;
|
|
77
|
-
(function (StorageLinkEdgeType) {
|
|
78
|
-
StorageLinkEdgeType[StorageLinkEdgeType["Property2Local"] = 0] = "Property2Local";
|
|
79
|
-
StorageLinkEdgeType[StorageLinkEdgeType["Local2Property"] = 1] = "Local2Property";
|
|
80
|
-
StorageLinkEdgeType[StorageLinkEdgeType["TwoWay"] = 2] = "TwoWay";
|
|
81
|
-
})(StorageLinkEdgeType = exports.StorageLinkEdgeType || (exports.StorageLinkEdgeType = {}));
|
|
82
69
|
class PagEdge extends BaseExplicitGraph_1.BaseEdge {
|
|
83
70
|
constructor(n, d, k, s) {
|
|
84
71
|
super(n, d, k);
|
|
@@ -416,6 +403,12 @@ class PagArrayNode extends PagNode {
|
|
|
416
403
|
}
|
|
417
404
|
}
|
|
418
405
|
exports.PagArrayNode = PagArrayNode;
|
|
406
|
+
class PagConstantNode extends PagNode {
|
|
407
|
+
constructor(id, cid = undefined, constant, stmt) {
|
|
408
|
+
super(id, cid, constant, PagNodeKind.LocalVar, stmt);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
exports.PagConstantNode = PagConstantNode;
|
|
419
412
|
/**
|
|
420
413
|
* below is heapObj like Node
|
|
421
414
|
*/
|
|
@@ -601,24 +594,31 @@ class Pag extends BaseExplicitGraph_1.BaseExplicitGraph {
|
|
|
601
594
|
return undefined;
|
|
602
595
|
}
|
|
603
596
|
}
|
|
604
|
-
getOrClonePagContainerFieldNode(basePt,
|
|
597
|
+
getOrClonePagContainerFieldNode(basePt, base, className) {
|
|
605
598
|
let baseNode = this.getNode(basePt);
|
|
606
599
|
if (baseNode instanceof PagNewContainerExprNode) {
|
|
607
600
|
// check if Array Ref real node has been created or not, if not: create a real Array Ref node
|
|
608
601
|
let existedNode = baseNode.getElementNode();
|
|
609
602
|
let fieldNode;
|
|
603
|
+
let fieldRef;
|
|
610
604
|
if (existedNode) {
|
|
611
605
|
return this.getNode(existedNode);
|
|
612
606
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
607
|
+
switch (className) {
|
|
608
|
+
case 'Array':
|
|
609
|
+
fieldRef = new Ref_1.ArkInstanceFieldRef(base, PTAUtils_1.ARRAY_FIELD_SIGNATURE);
|
|
610
|
+
break;
|
|
611
|
+
case 'Set':
|
|
612
|
+
fieldRef = new Ref_1.ArkInstanceFieldRef(base, PTAUtils_1.SET_FIELD_SIGNATURE);
|
|
613
|
+
break;
|
|
614
|
+
case 'Map':
|
|
615
|
+
fieldRef = new Ref_1.ArkInstanceFieldRef(base, PTAUtils_1.MAP_FIELD_SIGNATURE);
|
|
616
|
+
break;
|
|
617
|
+
default:
|
|
618
|
+
logger.error(`Error clone array field node ${className}`);
|
|
619
|
+
return undefined;
|
|
621
620
|
}
|
|
621
|
+
fieldNode = this.addPagNode(0, fieldRef);
|
|
622
622
|
baseNode.addElementNode(fieldNode.getID());
|
|
623
623
|
fieldNode.setBasePt(basePt);
|
|
624
624
|
return fieldNode;
|
|
@@ -674,6 +674,9 @@ class Pag extends BaseExplicitGraph_1.BaseExplicitGraph {
|
|
|
674
674
|
else if (value instanceof Ref_1.ArkThisRef) {
|
|
675
675
|
pagNode = new PagThisRefNode(id, cid, value);
|
|
676
676
|
}
|
|
677
|
+
else if (value instanceof Constant_1.Constant) {
|
|
678
|
+
pagNode = new PagConstantNode(id, cid, value, stmt);
|
|
679
|
+
}
|
|
677
680
|
else {
|
|
678
681
|
throw new Error('unsupported Value type ' + value.getType().toString());
|
|
679
682
|
}
|