diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 144cc9745d9..a0d9499f48b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2250,7 +2250,7 @@ module FourSlash { if (errs.length > 0) { throw new Error('Error compiling ' + fileName + ': ' + errs.map(e => e.messageText).join('\r\n')); } - checker.emitFiles(); + checker.invokeEmitter(); result = result || ''; // Might have an empty fourslash file // Compile and execute the test @@ -2284,7 +2284,7 @@ module FourSlash { // List of all the subfiles we've parsed out var files: FourSlashFile[] = []; // Global options - var opts: { [s: string]: string; } = {}; + var globalOptions: { [s: string]: string; } = {}; // Marker positions // Split up the input file by line @@ -2292,7 +2292,7 @@ module FourSlash { // we have to string-based splitting instead and try to figure out the delimiting chars var lines = contents.split('\n'); - var markerMap: MarkerMap = {}; + var markerPositions: MarkerMap = {}; var markers: Marker[] = []; var ranges: Range[] = []; @@ -2333,7 +2333,7 @@ module FourSlash { } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.filename)) { // Found an @Filename directive, if this is not the first then create a new subfile if (currentFileContent) { - var file = parseFileContent(currentFileContent, currentFileName, markerMap, markers, ranges); + var file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges); file.fileOptions = currentFileOptions; // Store result file @@ -2353,10 +2353,10 @@ module FourSlash { } } else { // Check if the match is already existed in the global options - if (opts[match[1]] !== undefined) { + if (globalOptions[match[1]] !== undefined) { throw new Error("Global Option : '" + match[1] + "' is already existed"); } - opts[match[1]] = match[2]; + globalOptions[match[1]] = match[2]; } } } else if (line == '' || lineLength === 0) { @@ -2365,7 +2365,7 @@ module FourSlash { } else { // Empty line or code line, terminate current subfile if there is one if (currentFileContent) { - var file = parseFileContent(currentFileContent, currentFileName, markerMap, markers, ranges); + var file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges); file.fileOptions = currentFileOptions; // Store result file @@ -2380,11 +2380,11 @@ module FourSlash { } return { - markerPositions: markerMap, - markers: markers, - globalOptions: opts, - files: files, - ranges: ranges + markerPositions, + markers, + globalOptions, + files, + ranges }; } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index aee0ef3c534..8f49e5ff769 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -589,8 +589,8 @@ module Harness { } }, getDefaultLibFilename: () => defaultLibFileName, - writeFile: writeFile, - getCanonicalFileName: getCanonicalFileName, + writeFile, + getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, getNewLine: ()=> sys.newLine }; @@ -806,7 +806,7 @@ module Harness { // only emit if there weren't parse errors var emitResult: ts.EmitResult; if (!isEmitBlocked) { - emitResult = checker.emitFiles(); + emitResult = checker.invokeEmitter(); } var errors: HarnessDiagnostic[] = []; @@ -845,7 +845,7 @@ module Harness { declResult = compileResult; }, settingsCallback, options); - return { declInputFiles: declInputFiles, declOtherFiles: declOtherFiles, declResult: declResult }; + return { declInputFiles, declOtherFiles, declResult }; } function addDtsFile(file: { unitName: string; content: string }, dtsFiles: { unitName: string; content: string }[]) { @@ -1169,7 +1169,7 @@ module Harness { var settings = extractCompilerSettings(code); // List of all the subfiles we've parsed out - var files: TestUnitData[] = []; + var testUnitData: TestUnitData[] = []; var lines = Utils.splitContentByNewlines(code); @@ -1205,7 +1205,7 @@ module Harness { originalFilePath: fileName, references: refs }; - files.push(newTestFile); + testUnitData.push(newTestFile); // Reset local data currentFileContent = null; @@ -1230,7 +1230,7 @@ module Harness { } // normalize the fileName for the single file case - currentFileName = files.length > 0 ? currentFileName : Path.getFileName(fileName); + currentFileName = testUnitData.length > 0 ? currentFileName : Path.getFileName(fileName); // EOF, push whatever remains var newTestFile2 = { @@ -1240,9 +1240,9 @@ module Harness { originalFilePath: fileName, references: refs }; - files.push(newTestFile2); + testUnitData.push(newTestFile2); - return { settings: settings, testUnitData: files }; + return { settings, testUnitData }; } } @@ -1338,7 +1338,7 @@ module Harness { actual = actual.replace(/\r\n?/g, '\n'); } - return { expected: expected, actual: actual }; + return { expected, actual }; } function writeComparison(expected: string, actual: string, relativeFilename: string, actualFilename: string, descriptionForDescribe: string) { diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 797bc12a42b..034f4e463c9 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -131,7 +131,7 @@ class ProjectRunner extends RunnerBase { if (!errors.length) { var checker = program.getTypeChecker(/*fullTypeCheck*/ true); errors = checker.getDiagnostics(); - var emitResult = checker.emitFiles(); + var emitResult = checker.invokeEmitter(); errors = ts.concatenate(errors, emitResult.errors); sourceMapData = emitResult.sourceMaps; @@ -148,10 +148,10 @@ class ProjectRunner extends RunnerBase { } return { - moduleKind: moduleKind, - program: program, - errors: errors, - sourceMapData: sourceMapData + moduleKind, + program, + errors, + sourceMapData }; function createCompilerOptions(): ts.CompilerOptions { @@ -183,10 +183,10 @@ class ProjectRunner extends RunnerBase { function createCompilerHost(): ts.CompilerHost { return { - getSourceFile: getSourceFile, + getSourceFile, getDefaultLibFilename: () => "lib.d.ts", - writeFile: writeFile, - getCurrentDirectory: getCurrentDirectory, + writeFile, + getCurrentDirectory, getCanonicalFileName: Harness.Compiler.getCanonicalFileName, useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, getNewLine: () => sys.newLine @@ -201,12 +201,12 @@ class ProjectRunner extends RunnerBase { var projectCompilerResult = compileProjectFiles(moduleKind, () => testCase.inputFiles, getSourceFileText, writeFile); return { - moduleKind: moduleKind, + moduleKind, program: projectCompilerResult.program, sourceMapData: projectCompilerResult.sourceMapData, - outputFiles: outputFiles, + outputFiles, errors: projectCompilerResult.errors, - nonSubfolderDiskFiles: nonSubfolderDiskFiles, + nonSubfolderDiskFiles, }; function getSourceFileText(filename: string): string { diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index bfb139fa719..606672e406f 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -117,14 +117,14 @@ module RWC { }); function getHarnessCompilerInputUnit(fileName: string) { - var resolvedPath = ts.normalizeSlashes(sys.resolvePath(fileName)); + var unitName = ts.normalizeSlashes(sys.resolvePath(fileName)); try { - var content = sys.readFile(resolvedPath); + var content = sys.readFile(unitName); } catch (e) { // Leave content undefined. } - return { unitName: resolvedPath, content: content }; + return { unitName, content }; } });