Skip to content

Commit 1bb46e3

Browse files
committed
Update LKG after commit 34a5514
1 parent 34a5514 commit 1bb46e3

File tree

4 files changed

+147
-26
lines changed

4 files changed

+147
-26
lines changed

bin/tsc.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4688,6 +4688,21 @@ var ts;
46884688
return result;
46894689
}
46904690
ts.convertToBase64 = convertToBase64;
4691+
var carriageReturnLineFeed = "\r\n";
4692+
var lineFeed = "\n";
4693+
function getNewLineCharacter(options) {
4694+
if (options.newLine === 0) {
4695+
return carriageReturnLineFeed;
4696+
}
4697+
else if (options.newLine === 1) {
4698+
return lineFeed;
4699+
}
4700+
else if (ts.sys) {
4701+
return ts.sys.newLine;
4702+
}
4703+
return carriageReturnLineFeed;
4704+
}
4705+
ts.getNewLineCharacter = getNewLineCharacter;
46914706
})(ts || (ts = {}));
46924707
var ts;
46934708
(function (ts) {
@@ -14454,6 +14469,9 @@ var ts;
1445414469
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
1445514470
}
1445614471
if (node.body) {
14472+
if (!node.type) {
14473+
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
14474+
}
1445714475
if (node.body.kind === 180) {
1445814476
checkSourceElement(node.body);
1445914477
}
@@ -25062,8 +25080,6 @@ var ts;
2506225080
ts.ioReadTime = 0;
2506325081
ts.ioWriteTime = 0;
2506425082
ts.version = "1.5.3";
25065-
var carriageReturnLineFeed = "\r\n";
25066-
var lineFeed = "\n";
2506725083
function findConfigFile(searchPath) {
2506825084
var fileName = "tsconfig.json";
2506925085
while (true) {
@@ -25134,9 +25150,7 @@ var ts;
2513425150
}
2513525151
}
2513625152
}
25137-
var newLine = options.newLine === 0 ? carriageReturnLineFeed :
25138-
options.newLine === 1 ? lineFeed :
25139-
ts.sys.newLine;
25153+
var newLine = ts.getNewLineCharacter(options);
2514025154
return {
2514125155
getSourceFile: getSourceFile,
2514225156
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@@ -25204,6 +25218,7 @@ var ts;
2520425218
getGlobalDiagnostics: getGlobalDiagnostics,
2520525219
getSemanticDiagnostics: getSemanticDiagnostics,
2520625220
getDeclarationDiagnostics: getDeclarationDiagnostics,
25221+
getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
2520725222
getTypeChecker: getTypeChecker,
2520825223
getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
2520925224
getCommonSourceDirectory: function () { return commonSourceDirectory; },
@@ -25284,6 +25299,11 @@ var ts;
2528425299
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
2528525300
}
2528625301
}
25302+
function getCompilerOptionsDiagnostics() {
25303+
var allDiagnostics = [];
25304+
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
25305+
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
25306+
}
2528725307
function getGlobalDiagnostics() {
2528825308
var typeChecker = getDiagnosticsProducingTypeChecker();
2528925309
var allDiagnostics = [];

bin/tsserver.js

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4565,6 +4565,21 @@ var ts;
45654565
return result;
45664566
}
45674567
ts.convertToBase64 = convertToBase64;
4568+
var carriageReturnLineFeed = "\r\n";
4569+
var lineFeed = "\n";
4570+
function getNewLineCharacter(options) {
4571+
if (options.newLine === 0) {
4572+
return carriageReturnLineFeed;
4573+
}
4574+
else if (options.newLine === 1) {
4575+
return lineFeed;
4576+
}
4577+
else if (ts.sys) {
4578+
return ts.sys.newLine;
4579+
}
4580+
return carriageReturnLineFeed;
4581+
}
4582+
ts.getNewLineCharacter = getNewLineCharacter;
45684583
})(ts || (ts = {}));
45694584
var ts;
45704585
(function (ts) {
@@ -14844,6 +14859,9 @@ var ts;
1484414859
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
1484514860
}
1484614861
if (node.body) {
14862+
if (!node.type) {
14863+
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
14864+
}
1484714865
if (node.body.kind === 180) {
1484814866
checkSourceElement(node.body);
1484914867
}
@@ -25452,8 +25470,6 @@ var ts;
2545225470
ts.ioReadTime = 0;
2545325471
ts.ioWriteTime = 0;
2545425472
ts.version = "1.5.3";
25455-
var carriageReturnLineFeed = "\r\n";
25456-
var lineFeed = "\n";
2545725473
function findConfigFile(searchPath) {
2545825474
var fileName = "tsconfig.json";
2545925475
while (true) {
@@ -25524,9 +25540,7 @@ var ts;
2552425540
}
2552525541
}
2552625542
}
25527-
var newLine = options.newLine === 0 ? carriageReturnLineFeed :
25528-
options.newLine === 1 ? lineFeed :
25529-
ts.sys.newLine;
25543+
var newLine = ts.getNewLineCharacter(options);
2553025544
return {
2553125545
getSourceFile: getSourceFile,
2553225546
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@@ -25594,6 +25608,7 @@ var ts;
2559425608
getGlobalDiagnostics: getGlobalDiagnostics,
2559525609
getSemanticDiagnostics: getSemanticDiagnostics,
2559625610
getDeclarationDiagnostics: getDeclarationDiagnostics,
25611+
getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
2559725612
getTypeChecker: getTypeChecker,
2559825613
getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
2559925614
getCommonSourceDirectory: function () { return commonSourceDirectory; },
@@ -25674,6 +25689,11 @@ var ts;
2567425689
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
2567525690
}
2567625691
}
25692+
function getCompilerOptionsDiagnostics() {
25693+
var allDiagnostics = [];
25694+
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
25695+
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
25696+
}
2567725697
function getGlobalDiagnostics() {
2567825698
var typeChecker = getDiagnosticsProducingTypeChecker();
2567925699
var allDiagnostics = [];
@@ -31379,11 +31399,14 @@ var ts;
3137931399
var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions();
3138031400
options.isolatedModules = true;
3138131401
options.allowNonTsExtensions = true;
31402+
options.noLib = true;
31403+
options.noResolve = true;
3138231404
var inputFileName = fileName || "module.ts";
3138331405
var sourceFile = ts.createSourceFile(inputFileName, input, options.target);
3138431406
if (diagnostics && sourceFile.parseDiagnostics) {
3138531407
diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics);
3138631408
}
31409+
var newLine = ts.getNewLineCharacter(options);
3138731410
var outputText;
3138831411
var compilerHost = {
3138931412
getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; },
@@ -31395,11 +31418,11 @@ var ts;
3139531418
useCaseSensitiveFileNames: function () { return false; },
3139631419
getCanonicalFileName: function (fileName) { return fileName; },
3139731420
getCurrentDirectory: function () { return ""; },
31398-
getNewLine: function () { return (ts.sys && ts.sys.newLine) || "\r\n"; }
31421+
getNewLine: function () { return newLine; }
3139931422
};
3140031423
var program = ts.createProgram([inputFileName], options, compilerHost);
3140131424
if (diagnostics) {
31402-
diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics());
31425+
diagnostics.push.apply(diagnostics, program.getCompilerOptionsDiagnostics());
3140331426
}
3140431427
program.emit();
3140531428
ts.Debug.assert(outputText !== undefined, "Output generation failed");
@@ -31914,10 +31937,12 @@ var ts;
3191431937
}
3191531938
}
3191631939
}
31940+
hostCache = undefined;
3191731941
program = newProgram;
3191831942
program.getTypeChecker();
3191931943
return;
3192031944
function getOrCreateSourceFile(fileName) {
31945+
ts.Debug.assert(hostCache !== undefined);
3192131946
var hostFileInformation = hostCache.getOrCreateEntry(fileName);
3192231947
if (!hostFileInformation) {
3192331948
return undefined;

bin/typescript.js

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5793,6 +5793,21 @@ var ts;
57935793
return result;
57945794
}
57955795
ts.convertToBase64 = convertToBase64;
5796+
var carriageReturnLineFeed = "\r\n";
5797+
var lineFeed = "\n";
5798+
function getNewLineCharacter(options) {
5799+
if (options.newLine === 0 /* CarriageReturnLineFeed */) {
5800+
return carriageReturnLineFeed;
5801+
}
5802+
else if (options.newLine === 1 /* LineFeed */) {
5803+
return lineFeed;
5804+
}
5805+
else if (ts.sys) {
5806+
return ts.sys.newLine;
5807+
}
5808+
return carriageReturnLineFeed;
5809+
}
5810+
ts.getNewLineCharacter = getNewLineCharacter;
57965811
})(ts || (ts = {}));
57975812
var ts;
57985813
(function (ts) {
@@ -17596,6 +17611,14 @@ var ts;
1759617611
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
1759717612
}
1759817613
if (node.body) {
17614+
if (!node.type) {
17615+
// There are some checks that are only performed in getReturnTypeFromBody, that may produce errors
17616+
// we need. An example is the noImplicitAny errors resulting from widening the return expression
17617+
// of a function. Because checking of function expression bodies is deferred, there was never an
17618+
// appropriate time to do this during the main walk of the file (see the comment at the top of
17619+
// checkFunctionExpressionBodies). So it must be done now.
17620+
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
17621+
}
1759917622
if (node.body.kind === 180 /* Block */) {
1760017623
checkSourceElement(node.body);
1760117624
}
@@ -29658,8 +29681,6 @@ var ts;
2965829681
/* @internal */ ts.ioWriteTime = 0;
2965929682
/** The version of the TypeScript compiler release */
2966029683
ts.version = "1.5.3";
29661-
var carriageReturnLineFeed = "\r\n";
29662-
var lineFeed = "\n";
2966329684
function findConfigFile(searchPath) {
2966429685
var fileName = "tsconfig.json";
2966529686
while (true) {
@@ -29733,9 +29754,7 @@ var ts;
2973329754
}
2973429755
}
2973529756
}
29736-
var newLine = options.newLine === 0 /* CarriageReturnLineFeed */ ? carriageReturnLineFeed :
29737-
options.newLine === 1 /* LineFeed */ ? lineFeed :
29738-
ts.sys.newLine;
29757+
var newLine = ts.getNewLineCharacter(options);
2973929758
return {
2974029759
getSourceFile: getSourceFile,
2974129760
getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); },
@@ -29803,6 +29822,7 @@ var ts;
2980329822
getGlobalDiagnostics: getGlobalDiagnostics,
2980429823
getSemanticDiagnostics: getSemanticDiagnostics,
2980529824
getDeclarationDiagnostics: getDeclarationDiagnostics,
29825+
getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,
2980629826
getTypeChecker: getTypeChecker,
2980729827
getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
2980829828
getCommonSourceDirectory: function () { return commonSourceDirectory; },
@@ -29894,6 +29914,11 @@ var ts;
2989429914
return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile);
2989529915
}
2989629916
}
29917+
function getCompilerOptionsDiagnostics() {
29918+
var allDiagnostics = [];
29919+
ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
29920+
return ts.sortAndDeduplicateDiagnostics(allDiagnostics);
29921+
}
2989729922
function getGlobalDiagnostics() {
2989829923
var typeChecker = getDiagnosticsProducingTypeChecker();
2989929924
var allDiagnostics = [];
@@ -36695,19 +36720,28 @@ var ts;
3669536720
* Extra compiler options that will unconditionally be used bu this function are:
3669636721
* - isolatedModules = true
3669736722
* - allowNonTsExtensions = true
36723+
* - noLib = true
36724+
* - noResolve = true
3669836725
*/
3669936726
function transpile(input, compilerOptions, fileName, diagnostics) {
3670036727
var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions();
3670136728
options.isolatedModules = true;
3670236729
// Filename can be non-ts file.
3670336730
options.allowNonTsExtensions = true;
36731+
// We are not returning a sourceFile for lib file when asked by the program,
36732+
// so pass --noLib to avoid reporting a file not found error.
36733+
options.noLib = true;
36734+
// We are not doing a full typecheck, we are not resolving the whole context,
36735+
// so pass --noResolve to avoid reporting missing file errors.
36736+
options.noResolve = true;
3670436737
// Parse
3670536738
var inputFileName = fileName || "module.ts";
3670636739
var sourceFile = ts.createSourceFile(inputFileName, input, options.target);
3670736740
// Store syntactic diagnostics
3670836741
if (diagnostics && sourceFile.parseDiagnostics) {
3670936742
diagnostics.push.apply(diagnostics, sourceFile.parseDiagnostics);
3671036743
}
36744+
var newLine = ts.getNewLineCharacter(options);
3671136745
// Output
3671236746
var outputText;
3671336747
// Create a compilerHost object to allow the compiler to read and write files
@@ -36721,11 +36755,11 @@ var ts;
3672136755
useCaseSensitiveFileNames: function () { return false; },
3672236756
getCanonicalFileName: function (fileName) { return fileName; },
3672336757
getCurrentDirectory: function () { return ""; },
36724-
getNewLine: function () { return (ts.sys && ts.sys.newLine) || "\r\n"; }
36758+
getNewLine: function () { return newLine; }
3672536759
};
3672636760
var program = ts.createProgram([inputFileName], options, compilerHost);
3672736761
if (diagnostics) {
36728-
diagnostics.push.apply(diagnostics, program.getGlobalDiagnostics());
36762+
diagnostics.push.apply(diagnostics, program.getCompilerOptionsDiagnostics());
3672936763
}
3673036764
// Emit
3673136765
program.emit();
@@ -37328,12 +37362,16 @@ var ts;
3732837362
}
3732937363
}
3733037364
}
37365+
// hostCache is captured in the closure for 'getOrCreateSourceFile' but it should not be used past this point.
37366+
// It needs to be cleared to allow all collected snapshots to be released
37367+
hostCache = undefined;
3733137368
program = newProgram;
3733237369
// Make sure all the nodes in the program are both bound, and have their parent
3733337370
// pointers set property.
3733437371
program.getTypeChecker();
3733537372
return;
3733637373
function getOrCreateSourceFile(fileName) {
37374+
ts.Debug.assert(hostCache !== undefined);
3733737375
// The program is asking for this file, check first if the host can locate it.
3733837376
// If the host can not locate the file, then it does not exist. return undefined
3733937377
// to the program to allow reporting of errors for missing files.

0 commit comments

Comments
 (0)