Skip to content

Commit 076d65e

Browse files
committed
addressed PR feedback
1 parent 7d65b5b commit 076d65e

3 files changed

Lines changed: 18 additions & 24 deletions

File tree

src/harness/compilerRunner.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,11 @@ class CompilerBaselineRunner extends RunnerBase {
250250
// These types are equivalent, but depend on what order the compiler observed
251251
// certain parts of the program.
252252

253-
const allFiles = toBeCompiled.concat(otherFiles).filter(file => !!result.program.getSourceFile(file.unitName));
253+
const program = result.program;
254+
const allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName));
254255

255-
const fullWalker = new TypeWriterWalker(result.program, /*fullTypeCheck*/ true);
256-
const pullWalker = new TypeWriterWalker(result.program, /*fullTypeCheck*/ false);
256+
const fullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ true);
257+
const pullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ false);
257258

258259
const fullResults: ts.Map<TypeWriterResult[]> = {};
259260
const pullResults: ts.Map<TypeWriterResult[]> = {};

src/harness/harness.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -767,9 +767,9 @@ namespace Harness {
767767
}
768768

769769
namespace Harness {
770-
const tcServicesFileName = "built/local/typescriptServices.js";
771770
export const libFolder = "built/local/";
772-
export let tcServicesFile = IO.readFile(tcServicesFileName);
771+
const tcServicesFileName = ts.combinePaths(libFolder, "typescriptServices.js");
772+
export const tcServicesFile = IO.readFile(tcServicesFileName);
773773

774774
export interface SourceMapEmitterCallback {
775775
(emittedFile: string, emittedLine: number, emittedColumn: number, sourceFile: string, sourceLine: number, sourceColumn: number, sourceName: string): void;
@@ -990,7 +990,6 @@ namespace Harness {
990990
options.noErrorTruncation = true;
991991
options.skipDefaultLibCheck = true;
992992

993-
const newLine = "\r\n";
994993
currentDirectory = currentDirectory || Harness.IO.getCurrentDirectory();
995994

996995
// Parse settings
@@ -1002,27 +1001,30 @@ namespace Harness {
10021001
useCaseSensitiveFileNames = options.useCaseSensitiveFileNames;
10031002
}
10041003

1004+
const programFiles: TestFile[] = inputFiles.slice();
10051005
// Files from built\local that are requested by test "@includeBuiltFiles" to be in the context.
10061006
// Treat them as library files, so include them in build, but not in baselines.
1007-
const includeBuiltFiles: TestFile[] = [];
10081007
if (options.includeBuiltFile) {
1009-
const builtFileName = libFolder + options.includeBuiltFile;
1008+
const builtFileName = ts.combinePaths(libFolder, options.includeBuiltFile);
10101009
const builtFile: TestFile = {
10111010
unitName: builtFileName,
1012-
content: normalizeLineEndings(IO.readFile(builtFileName), newLine),
1011+
content: normalizeLineEndings(IO.readFile(builtFileName), Harness.IO.newLine()),
10131012
};
1014-
includeBuiltFiles.push(builtFile);
1013+
programFiles.push(builtFile);
10151014
}
10161015

10171016
const fileOutputs: GeneratedFile[] = [];
10181017

1019-
const programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
1018+
const programFileNames = programFiles.map(file => file.unitName);
10201019

10211020
const compilerHost = createCompilerHost(
1022-
inputFiles.concat(includeBuiltFiles).concat(otherFiles),
1021+
programFiles.concat(otherFiles),
10231022
(fileName, code, writeByteOrderMark) => fileOutputs.push({ fileName, code, writeByteOrderMark }),
1024-
options.target, useCaseSensitiveFileNames, currentDirectory, options.newLine);
1025-
const program = ts.createProgram(programFiles, options, compilerHost);
1023+
options.target,
1024+
useCaseSensitiveFileNames,
1025+
currentDirectory,
1026+
options.newLine);
1027+
const program = ts.createProgram(programFileNames, options, compilerHost);
10261028

10271029
const emitResult = program.emit();
10281030

tests/cases/fourslash/fourslash.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ declare module ts {
5555
}
5656
}
5757

58-
declare module FourSlashInterface {
58+
declare namespace FourSlashInterface {
5959
interface Marker {
6060
fileName: string;
6161
position: number;
@@ -331,15 +331,6 @@ declare module FourSlashInterface {
331331
};
332332
}
333333
}
334-
declare module fs {
335-
var test: FourSlashInterface.test_;
336-
var goTo: FourSlashInterface.goTo;
337-
var verify: FourSlashInterface.verify;
338-
var edit: FourSlashInterface.edit;
339-
var debug: FourSlashInterface.debug;
340-
var format: FourSlashInterface.format;
341-
var cancellation: FourSlashInterface.cancellation;
342-
}
343334
declare function verifyOperationIsCancelled(f: any): void;
344335
declare var test: FourSlashInterface.test_;
345336
declare var goTo: FourSlashInterface.goTo;

0 commit comments

Comments
 (0)