This commit is contained in:
Jason Freeman 2015-06-03 13:39:25 -07:00
Родитель 34a5514fef
Коммит 1bb46e3f33
4 изменённых файлов: 147 добавлений и 26 удалений

Просмотреть файл

@ -4688,6 +4688,21 @@ var ts;
return result;
}
ts.convertToBase64 = convertToBase64;
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function getNewLineCharacter(options) {
if (options.newLine === 0) {
return carriageReturnLineFeed;
}
else if (options.newLine === 1) {
return lineFeed;
}
else if (ts.sys) {
return ts.sys.newLine;
}
return carriageReturnLineFeed;
}
ts.getNewLineCharacter = getNewLineCharacter;
})(ts || (ts = {}));
var ts;
(function (ts) {
@ -14454,6 +14469,9 @@ var ts;
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
}
if (node.body) {
if (!node.type) {
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
if (node.body.kind === 180) {
checkSourceElement(node.body);
}
@ -25062,8 +25080,6 @@ var ts;
ts.ioReadTime = 0;
ts.ioWriteTime = 0;
ts.version = "1.5.3";
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function findConfigFile(searchPath) {
var fileName = "tsconfig.json";
while (true) {
@ -25134,9 +25150,7 @@ var ts;
}
}
}
var newLine = options.newLine === 0 ? carriageReturnLineFeed :
options.newLine === 1 ? lineFeed :
ts.sys.newLine;
var newLine = ts.getNewLineCharacter(options);
return {
getSourceFile: getSourceFile,
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@ -25204,6 +25218,7 @@ var ts;
getGlobalDiagnostics: getGlobalDiagnostics,
getSemanticDiagnostics: getSemanticDiagnostics,
getDeclarationDiagnostics: getDeclarationDiagnostics,
getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
getTypeChecker: getTypeChecker,
getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
getCommonSourceDirectory: function () { return commonSourceDirectory; },
@ -25284,6 +25299,11 @@ var ts;
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
}
}
function getCompilerOptionsDiagnostics() {
var allDiagnostics = [];
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
}
function getGlobalDiagnostics() {
var typeChecker = getDiagnosticsProducingTypeChecker();
var allDiagnostics = [];

Просмотреть файл

@ -4565,6 +4565,21 @@ var ts;
return result;
}
ts.convertToBase64 = convertToBase64;
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function getNewLineCharacter(options) {
if (options.newLine === 0) {
return carriageReturnLineFeed;
}
else if (options.newLine === 1) {
return lineFeed;
}
else if (ts.sys) {
return ts.sys.newLine;
}
return carriageReturnLineFeed;
}
ts.getNewLineCharacter = getNewLineCharacter;
})(ts || (ts = {}));
var ts;
(function (ts) {
@ -14844,6 +14859,9 @@ var ts;
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
}
if (node.body) {
if (!node.type) {
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
if (node.body.kind === 180) {
checkSourceElement(node.body);
}
@ -25452,8 +25470,6 @@ var ts;
ts.ioReadTime = 0;
ts.ioWriteTime = 0;
ts.version = "1.5.3";
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function findConfigFile(searchPath) {
var fileName = "tsconfig.json";
while (true) {
@ -25524,9 +25540,7 @@ var ts;
}
}
}
var newLine = options.newLine === 0 ? carriageReturnLineFeed :
options.newLine === 1 ? lineFeed :
ts.sys.newLine;
var newLine = ts.getNewLineCharacter(options);
return {
getSourceFile: getSourceFile,
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@ -25594,6 +25608,7 @@ var ts;
getGlobalDiagnostics: getGlobalDiagnostics,
getSemanticDiagnostics: getSemanticDiagnostics,
getDeclarationDiagnostics: getDeclarationDiagnostics,
getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
getTypeChecker: getTypeChecker,
getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
getCommonSourceDirectory: function () { return commonSourceDirectory; },
@ -25674,6 +25689,11 @@ var ts;
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
}
}
function getCompilerOptionsDiagnostics() {
var allDiagnostics = [];
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
}
function getGlobalDiagnostics() {
var typeChecker = getDiagnosticsProducingTypeChecker();
var allDiagnostics = [];
@ -31379,11 +31399,14 @@ var ts;
var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions();
options.isolatedModules = true;
options.allowNonTsExtensions = true;
options.noLib = true;
options.noResolve = true;
var inputFileName = fileName || "module.ts";
var sourceFile = ts.createSourceFile(inputFileName, input, options.target);
if (diagnostics && sourceFile.parseDiagnostics) {
diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics);
}
var newLine = ts.getNewLineCharacter(options);
var outputText;
var compilerHost = {
getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; },
@ -31395,11 +31418,11 @@ var ts;
useCaseSensitiveFileNames: function () { return false; },
getCanonicalFileName: function (fileName) { return fileName; },
getCurrentDirectory: function () { return ""; },
getNewLine: function () { return (ts.sys && ts.sys.newLine) || "\r\n"; }
getNewLine: function () { return newLine; }
};
var program = ts.createProgram([inputFileName], options, compilerHost);
if (diagnostics) {
diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics());
diagnostics.push.apply(diagnostics, program.getCompilerOptionsDiagnostics());
}
program.emit();
ts.Debug.assert(outputText !== undefined, "Output generation failed");
@ -31914,10 +31937,12 @@ var ts;
}
}
}
hostCache = undefined;
program = newProgram;
program.getTypeChecker();
return;
function getOrCreateSourceFile(fileName) {
ts.Debug.assert(hostCache !== undefined);
var hostFileInformation = hostCache.getOrCreateEntry(fileName);
if (!hostFileInformation) {
return undefined;

Просмотреть файл

@ -5793,6 +5793,21 @@ var ts;
return result;
}
ts.convertToBase64 = convertToBase64;
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function getNewLineCharacter(options) {
if (options.newLine === 0 /* CarriageReturnLineFeed */) {
return carriageReturnLineFeed;
}
else if (options.newLine === 1 /* LineFeed */) {
return lineFeed;
}
else if (ts.sys) {
return ts.sys.newLine;
}
return carriageReturnLineFeed;
}
ts.getNewLineCharacter = getNewLineCharacter;
})(ts || (ts = {}));
var ts;
(function (ts) {
@ -17596,6 +17611,14 @@ var ts;
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
}
if (node.body) {
if (!node.type) {
// There are some checks that are only performed in getReturnTypeFromBody, that may produce errors
// we need. An example is the noImplicitAny errors resulting from widening the return expression
// of a function. Because checking of function expression bodies is deferred, there was never an
// appropriate time to do this during the main walk of the file (see the comment at the top of
// checkFunctionExpressionBodies). So it must be done now.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
if (node.body.kind === 180 /* Block */) {
checkSourceElement(node.body);
}
@ -29658,8 +29681,6 @@ var ts;
/* @internal */ ts.ioWriteTime = 0;
/** The version of the TypeScript compiler release */
ts.version = "1.5.3";
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function findConfigFile(searchPath) {
var fileName = "tsconfig.json";
while (true) {
@ -29733,9 +29754,7 @@ var ts;
}
}
}
var newLine = options.newLine === 0 /* CarriageReturnLineFeed */ ? carriageReturnLineFeed :
options.newLine === 1 /* LineFeed */ ? lineFeed :
ts.sys.newLine;
var newLine = ts.getNewLineCharacter(options);
return {
getSourceFile: getSourceFile,
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@ -29803,6 +29822,7 @@ var ts;
getGlobalDiagnostics: getGlobalDiagnostics,
getSemanticDiagnostics: getSemanticDiagnostics,
getDeclarationDiagnostics: getDeclarationDiagnostics,
getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
getTypeChecker: getTypeChecker,
getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
getCommonSourceDirectory: function () { return commonSourceDirectory; },
@ -29894,6 +29914,11 @@ var ts;
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
}
}
function getCompilerOptionsDiagnostics() {
var allDiagnostics = [];
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
}
function getGlobalDiagnostics() {
var typeChecker = getDiagnosticsProducingTypeChecker();
var allDiagnostics = [];
@ -36695,12 +36720,20 @@ var ts;
* Extra compiler options that will unconditionally be used bu this function are:
* - isolatedModules = true
* - allowNonTsExtensions = true
* - noLib = true
* - noResolve = true
*/
function transpile(input, compilerOptions, fileName, diagnostics) {
var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions();
options.isolatedModules = true;
// Filename can be non-ts file.
options.allowNonTsExtensions = true;
// We are not returning a sourceFile for lib file when asked by the program,
// so pass --noLib to avoid reporting a file not found error.
options.noLib = true;
// We are not doing a full typecheck, we are not resolving the whole context,
// so pass --noResolve to avoid reporting missing file errors.
options.noResolve = true;
// Parse
var inputFileName = fileName || "module.ts";
var sourceFile = ts.createSourceFile(inputFileName, input, options.target);
@ -36708,6 +36741,7 @@ var ts;
if (diagnostics && sourceFile.parseDiagnostics) {
diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics);
}
var newLine = ts.getNewLineCharacter(options);
// Output
var outputText;
// Create a compilerHost object to allow the compiler to read and write files
@ -36721,11 +36755,11 @@ var ts;
useCaseSensitiveFileNames: function () { return false; },
getCanonicalFileName: function (fileName) { return fileName; },
getCurrentDirectory: function () { return ""; },
getNewLine: function () { return (ts.sys && ts.sys.newLine) || "\r\n"; }
getNewLine: function () { return newLine; }
};
var program = ts.createProgram([inputFileName], options, compilerHost);
if (diagnostics) {
diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics());
diagnostics.push.apply(diagnostics, program.getCompilerOptionsDiagnostics());
}
// Emit
program.emit();
@ -37328,12 +37362,16 @@ var ts;
}
}
}
// hostCache is captured in the closure for 'getOrCreateSourceFile' but it should not be used past this point.
// It needs to be cleared to allow all collected snapshots to be released
hostCache = undefined;
program = newProgram;
// Make sure all the nodes in the program are both bound, and have their parent
// pointers set property.
program.getTypeChecker();
return;
function getOrCreateSourceFile(fileName) {
ts.Debug.assert(hostCache !== undefined);
// The program is asking for this file, check first if the host can locate it.
// If the host can not locate the file, then it does not exist. return undefined
// to the program to allow reporting of errors for missing files.

Просмотреть файл

@ -5793,6 +5793,21 @@ var ts;
return result;
}
ts.convertToBase64 = convertToBase64;
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function getNewLineCharacter(options) {
if (options.newLine === 0 /* CarriageReturnLineFeed */) {
return carriageReturnLineFeed;
}
else if (options.newLine === 1 /* LineFeed */) {
return lineFeed;
}
else if (ts.sys) {
return ts.sys.newLine;
}
return carriageReturnLineFeed;
}
ts.getNewLineCharacter = getNewLineCharacter;
})(ts || (ts = {}));
var ts;
(function (ts) {
@ -17596,6 +17611,14 @@ var ts;
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
}
if (node.body) {
if (!node.type) {
// There are some checks that are only performed in getReturnTypeFromBody, that may produce errors
// we need. An example is the noImplicitAny errors resulting from widening the return expression
// of a function. Because checking of function expression bodies is deferred, there was never an
// appropriate time to do this during the main walk of the file (see the comment at the top of
// checkFunctionExpressionBodies). So it must be done now.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
if (node.body.kind === 180 /* Block */) {
checkSourceElement(node.body);
}
@ -29658,8 +29681,6 @@ var ts;
/* @internal */ ts.ioWriteTime = 0;
/** The version of the TypeScript compiler release */
ts.version = "1.5.3";
var carriageReturnLineFeed = "\r\n";
var lineFeed = "\n";
function findConfigFile(searchPath) {
var fileName = "tsconfig.json";
while (true) {
@ -29733,9 +29754,7 @@ var ts;
}
}
}
var newLine = options.newLine === 0 /* CarriageReturnLineFeed */ ? carriageReturnLineFeed :
options.newLine === 1 /* LineFeed */ ? lineFeed :
ts.sys.newLine;
var newLine = ts.getNewLineCharacter(options);
return {
getSourceFile: getSourceFile,
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@ -29803,6 +29822,7 @@ var ts;
getGlobalDiagnostics: getGlobalDiagnostics,
getSemanticDiagnostics: getSemanticDiagnostics,
getDeclarationDiagnostics: getDeclarationDiagnostics,
getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
getTypeChecker: getTypeChecker,
getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
getCommonSourceDirectory: function () { return commonSourceDirectory; },
@ -29894,6 +29914,11 @@ var ts;
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
}
}
function getCompilerOptionsDiagnostics() {
var allDiagnostics = [];
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
}
function getGlobalDiagnostics() {
var typeChecker = getDiagnosticsProducingTypeChecker();
var allDiagnostics = [];
@ -36695,12 +36720,20 @@ var ts;
* Extra compiler options that will unconditionally be used bu this function are:
* - isolatedModules = true
* - allowNonTsExtensions = true
* - noLib = true
* - noResolve = true
*/
function transpile(input, compilerOptions, fileName, diagnostics) {
var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions();
options.isolatedModules = true;
// Filename can be non-ts file.
options.allowNonTsExtensions = true;
// We are not returning a sourceFile for lib file when asked by the program,
// so pass --noLib to avoid reporting a file not found error.
options.noLib = true;
// We are not doing a full typecheck, we are not resolving the whole context,
// so pass --noResolve to avoid reporting missing file errors.
options.noResolve = true;
// Parse
var inputFileName = fileName || "module.ts";
var sourceFile = ts.createSourceFile(inputFileName, input, options.target);
@ -36708,6 +36741,7 @@ var ts;
if (diagnostics && sourceFile.parseDiagnostics) {
diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics);
}
var newLine = ts.getNewLineCharacter(options);
// Output
var outputText;
// Create a compilerHost object to allow the compiler to read and write files
@ -36721,11 +36755,11 @@ var ts;
useCaseSensitiveFileNames: function () { return false; },
getCanonicalFileName: function (fileName) { return fileName; },
getCurrentDirectory: function () { return ""; },
getNewLine: function () { return (ts.sys && ts.sys.newLine) || "\r\n"; }
getNewLine: function () { return newLine; }
};
var program = ts.createProgram([inputFileName], options, compilerHost);
if (diagnostics) {
diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics());
diagnostics.push.apply(diagnostics, program.getCompilerOptionsDiagnostics());
}
// Emit
program.emit();
@ -37328,12 +37362,16 @@ var ts;
}
}
}
// hostCache is captured in the closure for 'getOrCreateSourceFile' but it should not be used past this point.
// It needs to be cleared to allow all collected snapshots to be released
hostCache = undefined;
program = newProgram;
// Make sure all the nodes in the program are both bound, and have their parent
// pointers set property.
program.getTypeChecker();
return;
function getOrCreateSourceFile(fileName) {
ts.Debug.assert(hostCache !== undefined);
// The program is asking for this file, check first if the host can locate it.
// If the host can not locate the file, then it does not exist. return undefined
// to the program to allow reporting of errors for missing files.