From 4c7891ce09a7e959bb461a8a9f0577ce886e9363 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 9 Mar 2015 15:10:47 -0700 Subject: [PATCH 1/3] Fix file path resolution in RWC --- src/harness/compilerRunner.ts | 2 +- src/harness/harness.ts | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index e4979f7a3c4..e920cfe3aca 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -152,7 +152,7 @@ class CompilerBaselineRunner extends RunnerBase { if (this.errors) { Harness.Baseline.runBaseline('Correct errors for ' + fileName, justName.replace(/\.ts$/, '.errors.txt'), (): string => { if (result.errors.length === 0) return null; - + debugger; return getErrorBaseline(toBeCompiled, otherFiles, result); }); } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 8cbc48d9dce..90ffcef07ff 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -835,7 +835,7 @@ module Harness { // Register input files function register(file: { unitName: string; content: string; }) { if (file.content !== undefined) { - var fileName = ts.normalizeSlashes(file.unitName); + var fileName = ts.normalizePath(file.unitName); filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, scriptTarget); } }; @@ -844,6 +844,7 @@ module Harness { return { getCurrentDirectory, getSourceFile: (fn, languageVersion) => { + fn = ts.normalizePath(fn); if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) { return filemap[getCanonicalFileName(fn)]; } @@ -1078,16 +1079,6 @@ module Harness { } }); - var filemap: { [name: string]: ts.SourceFile; } = {}; - var register = (file: { unitName: string; content: string; }) => { - if (file.content !== undefined) { - var fileName = ts.normalizeSlashes(file.unitName); - filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, options.target, assertInvariants); - } - }; - inputFiles.forEach(register); - otherFiles.forEach(register); - var fileOutputs: GeneratedFile[] = []; var programFiles = inputFiles.map(file => file.unitName); From 725577e32863f45b56a9385c27e041125424e67e Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 9 Mar 2015 15:14:08 -0700 Subject: [PATCH 2/3] Remove deubgger statement --- src/harness/compilerRunner.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index e920cfe3aca..d4dd8e31258 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -152,7 +152,6 @@ class CompilerBaselineRunner extends RunnerBase { if (this.errors) { Harness.Baseline.runBaseline('Correct errors for ' + fileName, justName.replace(/\.ts$/, '.errors.txt'), (): string => { if (result.errors.length === 0) return null; - debugger; return getErrorBaseline(toBeCompiled, otherFiles, result); }); } From aa96475f73bcc619f63dea84e0c391ce0b6ceb43 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 9 Mar 2015 15:50:40 -0700 Subject: [PATCH 3/3] CR feedback. --- src/compiler/emitter.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index df6a68bae02..2b5eb62bef9 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3033,6 +3033,9 @@ module ts { return false; } + // Returns 'true' if the code was actually indented, false otherwise. + // If the code is not indented, an optional valueToWriteWhenNotIndenting will be + // emitted instead. function indentIfOnDifferentLines(parent: Node, node1: Node, node2: Node, valueToWriteWhenNotIndenting?: string) { var realNodesAreOnDifferentLines = preserveNewLines && !nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); @@ -3321,6 +3324,10 @@ module ts { decreaseIndentIf(indentedBeforeColon, indentedAfterColon); } + // Helper function to decrease the indent if we previously indented. Allows multiple + // previous indent values to be considered at a time. This also allows caller to just + // call this once, passing in all their appropriate indent values, instead of needing + // to call this helper function multiple times. function decreaseIndentIf(value1: boolean, value2?: boolean) { if (value1) { decreaseIndent();