forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperftc.ts
30 lines (27 loc) · 1.31 KB
/
perftc.ts
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
/// <reference path="perfsys.ts"/>
/// <reference path="..\src\compiler\tc.ts"/>
// resolve all files used in this compilation
if (perftest.hasLogIOFlag()) {
perftest.interceptIO();
var compilerHost: ts.CompilerHost = {
getSourceFile: (s, v) => {
var content = perftest.readFile(s);
return content !== undefined ? ts.createSourceFile(s, content, v) : undefined;
},
getDefaultLibFilename: () => ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(perftest.getExecutingFilePath())), "lib.d.ts"),
writeFile: (f: string, content: string) => { throw new Error("Unexpected operation: writeFile"); },
getCurrentDirectory: () => perftest.getCurrentDirectory(),
getCanonicalFileName: getCanonicalFileName,
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames
};
var commandLine = ts.parseCommandLine(perftest.getArgsWithoutLogIOFlag());
var program = ts.createProgram(commandLine.filenames, commandLine.options, compilerHost);
var fileNames = program.getSourceFiles().map(f => f.filename);
perftest.writeIOLog(fileNames);
}
else {
var io = perftest.prepare();
ts.executeCommandLine(perftest.getArgsWithoutIOLogFile());
perftest.write(io.getOut());
perftest.writeErr(io.getErr());
}