Reverted back to using the 'assertInvariants' parameter.
This commit is contained in:
parent
68aca7ee30
commit
a3e87c92ee
2 changed files with 9 additions and 8 deletions
|
@ -809,12 +809,13 @@ module Harness {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createSourceFileAndAssertInvariants(fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, lightMode: boolean) {
|
export function createSourceFileAndAssertInvariants(fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, assertInvariants: boolean) {
|
||||||
// Only set the parent nodes if we're asserting invariants. We don't need them otherwise.
|
// Only set the parent nodes if we're asserting invariants. We don't need them otherwise.
|
||||||
var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ true);
|
var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ assertInvariants);
|
||||||
if (!lightMode) {
|
if (assertInvariants) {
|
||||||
Utils.assertInvariants(result, /*parent:*/ undefined);
|
Utils.assertInvariants(result, /*parent:*/ undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,8 +823,8 @@ module Harness {
|
||||||
const lineFeed = "\n";
|
const lineFeed = "\n";
|
||||||
|
|
||||||
export var defaultLibFileName = 'lib.d.ts';
|
export var defaultLibFileName = 'lib.d.ts';
|
||||||
export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, Harness.lightMode);
|
export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*assertInvariants*/ !Harness.lightMode);
|
||||||
export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, Harness.lightMode);
|
export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*assertInvariants*/ !Harness.lightMode);
|
||||||
|
|
||||||
// Cache these between executions so we don't have to re-parse them for every test
|
// Cache these between executions so we don't have to re-parse them for every test
|
||||||
export var fourslashFileName = 'fourslash.ts';
|
export var fourslashFileName = 'fourslash.ts';
|
||||||
|
@ -853,7 +854,7 @@ module Harness {
|
||||||
function register(file: { unitName: string; content: string; }) {
|
function register(file: { unitName: string; content: string; }) {
|
||||||
if (file.content !== undefined) {
|
if (file.content !== undefined) {
|
||||||
var fileName = ts.normalizePath(file.unitName);
|
var fileName = ts.normalizePath(file.unitName);
|
||||||
filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, scriptTarget, Harness.lightMode);
|
filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, scriptTarget, /*assertInvariants*/ !Harness.lightMode);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
inputFiles.forEach(register);
|
inputFiles.forEach(register);
|
||||||
|
@ -876,7 +877,7 @@ module Harness {
|
||||||
}
|
}
|
||||||
else if (fn === fourslashFileName) {
|
else if (fn === fourslashFileName) {
|
||||||
var tsFn = 'tests/cases/fourslash/' + fourslashFileName;
|
var tsFn = 'tests/cases/fourslash/' + fourslashFileName;
|
||||||
fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget, Harness.lightMode);
|
fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget, /*assertInvariants*/ !Harness.lightMode);
|
||||||
return fourslashSourceFile;
|
return fourslashSourceFile;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -174,7 +174,7 @@ class ProjectRunner extends RunnerBase {
|
||||||
else {
|
else {
|
||||||
var text = getSourceFileText(fileName);
|
var text = getSourceFileText(fileName);
|
||||||
if (text !== undefined) {
|
if (text !== undefined) {
|
||||||
sourceFile = Harness.Compiler.createSourceFileAndAssertInvariants(fileName, text, languageVersion, /*lightMode*/ false);
|
sourceFile = Harness.Compiler.createSourceFileAndAssertInvariants(fileName, text, languageVersion, /*assertInvariants*/ !Harness.lightMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue