Skip to content

Commit e9f098b

Browse files
committed
Fix jake perftsc task
Added ts module prefix andd depend on types.ts (for ts.Map<string>)
1 parent 87bcdff commit e9f098b

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

tests/perfsys.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/// <reference path="..\src\compiler\sys.ts"/>
2+
/// <reference path="..\src\compiler\types.ts"/>
3+
24
module perftest {
35

46
interface IOLog {
@@ -10,24 +12,24 @@ module perftest {
1012
getOut(): string;
1113
}
1214

13-
export var readFile = sys.readFile;
14-
var writeFile = sys.writeFile;
15-
export var write = sys.write;
16-
var resolvePath = sys.resolvePath;
17-
export var getExecutingFilePath = sys.getExecutingFilePath;
18-
export var getCurrentDirectory = sys.getCurrentDirectory;
19-
var exit = sys.exit;
15+
export var readFile = ts.sys.readFile;
16+
var writeFile = ts.sys.writeFile;
17+
export var write = ts.sys.write;
18+
var resolvePath = ts.sys.resolvePath;
19+
export var getExecutingFilePath = ts.sys.getExecutingFilePath;
20+
export var getCurrentDirectory = ts.sys.getCurrentDirectory;
21+
var exit = ts.sys.exit;
2022

21-
var args = sys.args;
23+
var args = ts.sys.args;
2224

2325
// augment sys so first ts.executeCommandLine call will be finish silently
24-
sys.write = (s: string) => { };
25-
sys.exit = (code: number) => { };
26-
sys.args = []
26+
ts.sys.write = (s: string) => { };
27+
ts.sys.exit = (code: number) => { };
28+
ts.sys.args = []
2729

2830
export function restoreSys() {
29-
sys.args = args;
30-
sys.write = write;
31+
ts.sys.args = args;
32+
ts.sys.write = write;
3133
}
3234

3335
export function hasLogIOFlag() {
@@ -45,7 +47,7 @@ module perftest {
4547
var resolvePathLog: ts.Map<string> = {};
4648

4749
export function interceptIO() {
48-
sys.resolvePath = (s) => {
50+
ts.sys.resolvePath = (s) => {
4951
var result = resolvePath(s);
5052
resolvePathLog[s] = result;
5153
return result;
@@ -68,33 +70,33 @@ module perftest {
6870
var files: ts.Map<string> = {};
6971
log.fileNames.forEach(f => { files[f] = readFile(f); })
7072

71-
sys.createDirectory = (s: string) => { };
72-
sys.directoryExists = (s: string) => true;
73-
sys.fileExists = (s: string) => true;
73+
ts.sys.createDirectory = (s: string) => { };
74+
ts.sys.directoryExists = (s: string) => true;
75+
ts.sys.fileExists = (s: string) => true;
7476

75-
var currentDirectory = sys.getCurrentDirectory();
76-
sys.getCurrentDirectory = () => currentDirectory;
77+
var currentDirectory = ts.sys.getCurrentDirectory();
78+
ts.sys.getCurrentDirectory = () => currentDirectory;
7779

78-
var executingFilePath = sys.getExecutingFilePath();
79-
sys.getExecutingFilePath = () => executingFilePath;
80+
var executingFilePath = ts.sys.getExecutingFilePath();
81+
ts.sys.getExecutingFilePath = () => executingFilePath;
8082

81-
sys.readFile = (s: string) => {
83+
ts.sys.readFile = (s: string) => {
8284
return files[s];
8385
}
8486

85-
sys.resolvePath = (s: string) => {
87+
ts.sys.resolvePath = (s: string) => {
8688
var path = log.resolvePath[s];
8789
if (!path) {
8890
throw new Error("Unexpected path '" + s + "'");
8991
}
9092
return path
9193
}
9294

93-
sys.writeFile = (path: string, data: string) => { };
95+
ts.sys.writeFile = (path: string, data: string) => { };
9496

9597
var out: string = "";
9698

97-
sys.write = (s: string) => { out += s; };
99+
ts.sys.write = (s: string) => { out += s; };
98100

99101
return {
100102
getOut: () => out,

tests/perftsc.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ if (perftest.hasLogIOFlag()) {
1313
getDefaultLibFilename: () => ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(perftest.getExecutingFilePath())), "lib.d.ts"),
1414
writeFile: (f: string, content: string) => { throw new Error("Unexpected operation: writeFile"); },
1515
getCurrentDirectory: () => perftest.getCurrentDirectory(),
16-
getCanonicalFileName: ts.getCanonicalFileName,
17-
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
18-
getNewLine: () => sys.newLine
16+
getCanonicalFileName: (f: string) => ts.sys.useCaseSensitiveFileNames ? f : f.toLowerCase(),
17+
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
18+
getNewLine: () => ts.sys.newLine
1919
};
2020

2121
var commandLine = ts.parseCommandLine(perftest.getArgsWithoutLogIOFlag());

0 commit comments

Comments
 (0)