-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyzer.js
More file actions
71 lines (60 loc) · 1.81 KB
/
analyzer.js
File metadata and controls
71 lines (60 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const moduleBuilder = require('./common/model/model_builder');
const config = require('./scenery/config');
const SourseReader = require('./common/core/io/sourcereader');
const astCtrl = require("./scenery/astCtrl");
const astParserCtrl = require("./scenery/astParserCtrl");
const constantsModule = require('./common/constants');
const fs = require('fs');
// The first step of Analysis. This will initialize all Global/Scenery Objects.
async function initializeAnalyzer(configPth) {
// Initialize config
let configData = config.parseConfig(configPth);
let astParserIns = await astParserCtrl.getOrSetAstParser(configData.language);
if (configData.language == undefined) {
configData.language = constantsModule.LANG.js;
}
// Initialize Output path
if (configData.outputDir == undefined) {
configData.outputDir = "./output/tmp/";
}
if (fs.existsSync(configData.outputDir) == false) {
fs.mkdirSync(configData.outputDir, { recursive: true });
}
// Initialize ASTs
let astcontroler = astCtrl.getAstPool();
await astcontroler.constructAstDir(configData.targetDir);
CONFIG.value = configData;
return configData;
}
async function runMPTA() {
// Run MPTA, to construct the basic callsite
}
async function runBasicCG() {
// Construct basic call graph
}
async function runPTA() {
/**
**TODO : PTA
**TODO : Context-sensitive Analysis
**/
}
async function runPTAEnhancedCG() {
/**
**TODO : PTA-enhanced Call Graph
**/
}
async function analyze() {
// TODO : Dataflow Analysis
}
let CONFIG = {
value : null
};
module.exports = {
initializeAnalyzer: initializeAnalyzer,
CONFIG: CONFIG,
runMPTA: runMPTA,
runBasicCG: runBasicCG,
runPTA: runPTA,
runPTAEnhancedCG: runPTAEnhancedCG,
analyze: analyze
}