Skip to content

Commit bce4875

Browse files
author
Andy Hanson
committed
Merge branch 'master' into undefinedzilla
2 parents cf4f760 + 9acad22 commit bce4875

File tree

189 files changed

+3598
-1264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+3598
-1264
lines changed

Gulpfile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const es2017LibrarySource = [
143143
const es2017LibrarySourceMap = es2017LibrarySource.map(source =>
144144
({ target: "lib." + source, sources: ["header.d.ts", source] }));
145145

146-
const es2018LibrarySource = [];
146+
const es2018LibrarySource = ["es2018.regexp.d.ts"];
147147
const es2018LibrarySourceMap = es2018LibrarySource.map(source =>
148148
({ target: "lib." + source, sources: ["header.d.ts", source] }));
149149

Jakefile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
206206
return { target: "lib." + source, sources: ["header.d.ts", source] };
207207
});
208208

209-
var es2018LibrarySource = [];
209+
var es2018LibrarySource = ["es2018.regexp.d.ts"];
210210

211211
var es2018LibrarySourceMap = es2018LibrarySource.map(function (source) {
212212
return { target: "lib." + source, sources: ["header.d.ts", source] };

src/compiler/binder.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ namespace ts {
20732073
seenThisKeyword = true;
20742074
return;
20752075
case SyntaxKind.TypePredicate:
2076-
return checkTypePredicate(node as TypePredicateNode);
2076+
break; // Binding the children will handle everything
20772077
case SyntaxKind.TypeParameter:
20782078
return bindTypeParameter(node as TypeParameterDeclaration);
20792079
case SyntaxKind.Parameter:
@@ -2206,17 +2206,6 @@ namespace ts {
22062206
return bindAnonymousDeclaration(<Declaration>node, SymbolFlags.TypeLiteral, InternalSymbolName.Type);
22072207
}
22082208

2209-
function checkTypePredicate(node: TypePredicateNode) {
2210-
const { parameterName, type } = node;
2211-
if (parameterName && parameterName.kind === SyntaxKind.Identifier) {
2212-
checkStrictModeIdentifier(parameterName);
2213-
}
2214-
if (parameterName && parameterName.kind === SyntaxKind.ThisType) {
2215-
seenThisKeyword = true;
2216-
}
2217-
bind(type);
2218-
}
2219-
22202209
function bindSourceFileIfExternalModule() {
22212210
setExportContextFlag(file);
22222211
if (isExternalModule(file)) {

src/compiler/checker.ts

+210-213
Large diffs are not rendered by default.

src/compiler/commandLineParser.ts

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ namespace ts {
6262
category: Diagnostics.Command_line_Options,
6363
description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental
6464
},
65+
{
66+
name: "preserveWatchOutput",
67+
type: "boolean",
68+
showInSimplifiedHelpView: false,
69+
category: Diagnostics.Command_line_Options,
70+
description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen,
71+
},
6572
{
6673
name: "watch",
6774
shortName: "w",
@@ -144,6 +151,7 @@ namespace ts {
144151
"es2017.string": "lib.es2017.string.d.ts",
145152
"es2017.intl": "lib.es2017.intl.d.ts",
146153
"es2017.typedarrays": "lib.es2017.typedarrays.d.ts",
154+
"es2018.regexp": "lib.es2018.regexp.d.ts",
147155
"esnext.array": "lib.esnext.array.d.ts",
148156
"esnext.asynciterable": "lib.esnext.asynciterable.d.ts",
149157
"esnext.promise": "lib.esnext.promise.d.ts",

src/compiler/diagnosticMessages.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,7 @@
26022602
"code": 4083
26032603
},
26042604
"Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.": {
2605-
"category": "Message",
2605+
"category": "Error",
26062606
"code": 4090
26072607
},
26082608
"Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'.": {
@@ -3296,7 +3296,7 @@
32963296
"category": "Message",
32973297
"code": 6146
32983298
},
3299-
"Resolution for module '{0}' was found in cache.": {
3299+
"Resolution for module '{0}' was found in cache from location '{1}'.": {
33003300
"category": "Message",
33013301
"code": 6147
33023302
},
@@ -3472,6 +3472,10 @@
34723472
"category": "Message",
34733473
"code": 6190
34743474
},
3475+
"Whether to keep outdated console output in watch mode instead of clearing the screen.": {
3476+
"category": "Message",
3477+
"code": 6191
3478+
},
34753479
"Variable '{0}' implicitly has an '{1}' type.": {
34763480
"category": "Error",
34773481
"code": 7005
@@ -3810,6 +3814,11 @@
38103814
"code": 18003
38113815
},
38123816

3817+
"File is a CommonJS module; it may be converted to an ES6 module.": {
3818+
"category": "Suggestion",
3819+
"code": 80001
3820+
},
3821+
38133822
"Add missing 'super()' call": {
38143823
"category": "Message",
38153824
"code": 90001

src/compiler/factory.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2287,7 +2287,7 @@ namespace ts {
22872287
const node = <PropertyAssignment>createSynthesizedNode(SyntaxKind.PropertyAssignment);
22882288
node.name = asName(name);
22892289
node.questionToken = undefined;
2290-
node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined;
2290+
node.initializer = parenthesizeExpressionForList(initializer);
22912291
return node;
22922292
}
22932293

src/compiler/moduleNameResolver.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,20 @@ namespace ts {
334334
}
335335

336336
export function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache {
337-
const directoryToModuleNameMap = createMap<Map<ResolvedModuleWithFailedLookupLocations>>();
338-
const moduleNameToDirectoryMap = createMap<PerModuleNameCache>();
337+
return createModuleResolutionCacheWithMaps(
338+
createMap<Map<ResolvedModuleWithFailedLookupLocations>>(),
339+
createMap<PerModuleNameCache>(),
340+
currentDirectory,
341+
getCanonicalFileName
342+
);
343+
}
344+
345+
/*@internal*/
346+
export function createModuleResolutionCacheWithMaps(
347+
directoryToModuleNameMap: Map<Map<ResolvedModuleWithFailedLookupLocations>>,
348+
moduleNameToDirectoryMap: Map<PerModuleNameCache>,
349+
currentDirectory: string,
350+
getCanonicalFileName: GetCanonicalFileName): ModuleResolutionCache {
339351

340352
return { getOrCreateCacheForDirectory, getOrCreateCacheForModuleName };
341353

@@ -444,7 +456,7 @@ namespace ts {
444456

445457
if (result) {
446458
if (traceEnabled) {
447-
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName);
459+
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
448460
}
449461
}
450462
else {
@@ -1187,7 +1199,7 @@ namespace ts {
11871199
const result = cache && cache.get(containingDirectory);
11881200
if (result) {
11891201
if (traceEnabled) {
1190-
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName);
1202+
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
11911203
}
11921204
return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId } };
11931205
}

src/compiler/program.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ namespace ts {
227227
}
228228

229229
export function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string {
230-
const category = DiagnosticCategory[diagnostic.category].toLowerCase();
231-
const errorMessage = `${category} TS${diagnostic.code}: ${flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine())}${host.getNewLine()}`;
230+
const errorMessage = `${diagnosticCategoryName(diagnostic)} TS${diagnostic.code}: ${flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine())}${host.getNewLine()}`;
232231

233232
if (diagnostic.file) {
234233
const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start!); // TODO: GH#18217
@@ -254,8 +253,9 @@ namespace ts {
254253
const ellipsis = "...";
255254
function getCategoryFormat(category: DiagnosticCategory): string {
256255
switch (category) {
257-
case DiagnosticCategory.Warning: return ForegroundColorEscapeSequences.Yellow;
258256
case DiagnosticCategory.Error: return ForegroundColorEscapeSequences.Red;
257+
case DiagnosticCategory.Warning: return ForegroundColorEscapeSequences.Yellow;
258+
case DiagnosticCategory.Suggestion: return Debug.fail("Should never get an Info diagnostic on the command line.");
259259
case DiagnosticCategory.Message: return ForegroundColorEscapeSequences.Blue;
260260
}
261261
}
@@ -337,9 +337,7 @@ namespace ts {
337337
output += " - ";
338338
}
339339

340-
const categoryColor = getCategoryFormat(diagnostic.category);
341-
const category = DiagnosticCategory[diagnostic.category].toLowerCase();
342-
output += formatColorAndReset(category, categoryColor);
340+
output += formatColorAndReset(diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category));
343341
output += formatColorAndReset(` TS${ diagnostic.code }: `, ForegroundColorEscapeSequences.Grey);
344342
output += flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine());
345343

0 commit comments

Comments
 (0)