-
Notifications
You must be signed in to change notification settings - Fork 7
/
modify-semantic-analysis.js
59 lines (51 loc) · 1.55 KB
/
modify-semantic-analysis.js
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
var path = require('path');
var fs = require('fs');
var file = path.resolve(
__dirname,
'./packages/language-support/src/syntaxValidation/semanticAnalysis.js',
);
fs.readFile(file, 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
let result = data.replace(
` $rt_startThread(() => {
f.call(null, javaArgs);
}, callback);`,
` $rt_startThread(() => {
return f.call(null, javaArgs);
}, callback);`,
);
result = result.replace(
` cnsa_Main_$callClinit();
var$1 = var$1.data;
cnsa_Main_updateSignatureResolver(null);
cnsa_Main_analyzeQuery(var$1[0]);
cnsa_Main_updateSignatureResolver(null);
cnsa_Main_analyzeQuery(var$1[0]);`,
` cnsa_Main_$callClinit();`,
);
result = result.replace(
` cnsa_Main_$callClinit();
var$1 = var$1.data;
cnsa_Main_updateSignatureResolver(null);
cnsa_Main_analyzeQuery(var$1[0]);
cnsa_Main_updateSignatureResolver(null);
cnsa_Main_analyzeQuery(var$1[0]);`,
` cnsa_Main_$callClinit();`,
);
result = result.replace(
`$rt_exports.main = $rt_export_main;`,
`
$rt_exports.main = $rt_export_main;
// Initialize everything
$rt_exports.main([]);
// Export the signature registry updater
$rt_exports.updateSignatureResolver = cnsa_Main_updateSignatureResolver;
// Export the analyze function as well
$rt_exports.semanticAnalysis = $rt_mainStarter(($args) => cnsa_Main_analyzeQuery($args.data[0]));`,
);
fs.writeFile(file, result, 'utf8', function (err) {
if (err) return console.log(err);
});
});