Skip to content

Commit 5d415ca

Browse files
committed
Merge branch 'master' into asyncGenerators
2 parents 21bf485 + 12e8f91 commit 5d415ca

File tree

553 files changed

+16196
-7047
lines changed

Some content is hidden

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

553 files changed

+16196
-7047
lines changed

.mailmap

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ Alexander Rusakov <[email protected]>
88
Alex Eagle <[email protected]>
99
Anatoly Ressin <[email protected]>
1010
Anders Hejlsberg <[email protected]> unknown <[email protected]> unknown <[email protected]>
11+
about-code <[email protected]> # Andreas Martin
1112
Andrej Baran <[email protected]>
13+
Andrew Ochsner <[email protected]>
1214
Andrew Z Allen <[email protected]>
1315
1416
Anil Anar <[email protected]>
1517
Anton Tolmachev <[email protected]>
18+
Anubha Mathur <[email protected]> anubmat <[email protected]>
1619
Arnavion <[email protected]> # Arnav Singh
1720
Arthur Ozga <[email protected]> Arthur Ozga <[email protected]> Arthur Ozga <[email protected]> Arthur Ozga <[email protected]> Arthur Ozga <[email protected]>
1821
Asad Saeeduddin <[email protected]>
@@ -37,6 +40,7 @@ Dan Corder <[email protected]>
3740
3841
Daniel Rosenwasser <[email protected]> Daniel Rosenwasser <[email protected]> Daniel Rosenwasser <[email protected]> Daniel Rosenwasser <[email protected]> Daniel Rosenwasser <[email protected]>
3942
43+
David Sheldrick <[email protected]>
4044
David Souther <[email protected]>
4145
Denis Nedelyaev <[email protected]>
4246
Dick van den Brink <[email protected]> unknown <[email protected]> unknown <[email protected]>
@@ -52,6 +56,7 @@ Evan Sebastian <[email protected]>
5256
Eyas <[email protected]> # Eyas Sharaiha
5357
Fabian Cook <[email protected]>
5458
falsandtru <[email protected]> # @falsandtru
59+
flowmemo <[email protected]> # @flowmemo
5560
Frank Wallis <[email protected]>
5661
František Žiacik <[email protected]> František Žiacik <[email protected]>
5762
Gabe Moothart <[email protected]>
@@ -62,6 +67,7 @@ Graeme Wicksted <[email protected]>
6267
Guillaume Salles <[email protected]>
6368
Guy Bedford <[email protected]> guybedford <[email protected]>
6469
Harald Niesche <[email protected]>
70+
Homa Wong <[email protected]>
6571
Iain Monro <[email protected]>
6672
Ingvar Stepanyan <[email protected]>
6773
impinball <[email protected]> # Isiah Meadows
@@ -81,6 +87,7 @@ Jonathan Park <[email protected]>
8187
Jonathan Turner <[email protected]> Jonathan Turner <[email protected]>
8288
Jonathan Toland <[email protected]>
8389
Jesse Schalken <[email protected]>
90+
8491
Josh Abernathy <[email protected]> joshaber <[email protected]>
8592
Josh Kalderimis <[email protected]>
8693
Josh Soref <[email protected]>
@@ -95,10 +102,12 @@ Kanchalai Tanglertsampan <[email protected]> Yui T <[email protected]>
95102
Kanchalai Tanglertsampan <[email protected]> Yui <[email protected]>
96103
Kanchalai Tanglertsampan <[email protected]> Yui <[email protected]>
97104
Kanchalai Tanglertsampan <[email protected]> yui T <[email protected]>
105+
Kārlis Gaņģis <[email protected]>
98106
Keith Mashinter <[email protected]> kmashint <[email protected]>
99107
Ken Howard <[email protected]>
100108
Kevin Lang <[email protected]>
101109
kimamula <[email protected]> # Kenji Imamula
110+
Klaus Meinhardt <[email protected]>
102111
Kyle Kelley <[email protected]>
103112
Lorant Pinter <[email protected]>
104113
Lucien Greathouse <[email protected]>
@@ -107,6 +116,7 @@ Martin Vseticka <[email protected]> Martin Všeticka <vseticka.martin@gm
107116
gcnew <[email protected]> # Marin Marinov
108117
vvakame <[email protected]> # Masahiro Wakame
109118
Matt McCutchen <[email protected]>
119+
MANISH-GIRI <[email protected]> # Manish Giri
110120
Max Deepfield <[email protected]>
111121
Micah Zoltu <[email protected]>
112122
@@ -213,4 +223,6 @@ Tim Perry <[email protected]>
213223
Vidar Tonaas Fauske <[email protected]>
214224
Viktor Zozulyak <[email protected]>
215225
rix <[email protected]> # Richard Sentino
216-
rohitverma007 <[email protected]> # Rohit Verma
226+
rohitverma007 <[email protected]> # Rohit Verma
227+
rdosanjh <[email protected]> # Raj Dosanjh
228+
gdh1995 <[email protected]> # Dahan Gong

AUTHORS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ TypeScript is authored by:
1212
* Aliaksandr Radzivanovich
1313
* Anatoly Ressin
1414
* Anders Hejlsberg
15+
* Andreas Martin
1516
* Andrej Baran
17+
* Andrew Ochsner
1618
* Andrew Z Allen
1719
* András Parditka
1820
* Andy Hanson
1921
* Anil Anar
2022
* Anton Khlynovskiy
2123
* Anton Tolmachev
24+
* Anubha Mathur
2225
* Arnav Singh
2326
* Arthur Ozga
2427
* Asad Saeeduddin
@@ -42,12 +45,14 @@ TypeScript is authored by:
4245
* Cotton Hou
4346
* Cyrus Najmabadi
4447
* Dafrok Zhang
48+
* Dahan Gong
4549
* Dan Corder
4650
* Dan Quirk
4751
* Daniel Hollocher
4852
* Daniel Rosenwasser
4953
* David Kmenta
5054
* David Li
55+
* David Sheldrick
5156
* David Souther
5257
* Denis Nedelyaev
5358
* Dick van den Brink
@@ -66,6 +71,7 @@ TypeScript is authored by:
6671
* Eyas Sharaiha
6772
* Fabian Cook
6873
* @falsandtru
74+
* @flowmemo
6975
* Frank Wallis
7076
* Franklin Tse
7177
* František Žiacik
@@ -79,6 +85,7 @@ TypeScript is authored by:
7985
* Guy Bedford
8086
* Harald Niesche
8187
* Herrington Darkholme
88+
* Homa Wong
8289
* Iain Monro
8390
* Ingvar Stepanyan
8491
* Isiah Meadows
@@ -93,6 +100,7 @@ TypeScript is authored by:
93100
* Jeffrey Morlan
94101
* Jesse Schalken
95102
* Jiri Tobisek
103+
* Joel Day
96104
* Joey Wilson
97105
* Johannes Rieken
98106
* John Vilk
@@ -114,10 +122,13 @@ TypeScript is authored by:
114122
* Ken Howard
115123
* Kenji Imamula
116124
* Kevin Lang
125+
* Klaus Meinhardt
117126
* Kyle Kelley
127+
* Kārlis Gaņģis
118128
* Lorant Pinter
119129
* Lucien Greathouse
120130
* Lukas Elmer
131+
* Manish Giri
121132
* Marin Marinov
122133
* Marius Schulz
123134
* Martin Vseticka
@@ -155,6 +166,7 @@ TypeScript is authored by:
155166
* @progre
156167
* Punya Biswal
157168
* Rado Kirov
169+
* Raj Dosanjh
158170
* Richard Knoll
159171
* Richard Sentino
160172
* Robert Coie

Gulpfile.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
5050
r: "reporter",
5151
color: "colors",
5252
f: "files",
53-
file: "files"
53+
file: "files",
54+
w: "workers",
5455
},
5556
default: {
5657
soft: false,
@@ -63,6 +64,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
6364
reporter: process.env.reporter || process.env.r,
6465
lint: process.env.lint || true,
6566
files: process.env.f || process.env.file || process.env.files || "",
67+
workers: process.env.workerCount || os.cpus().length,
6668
}
6769
});
6870

@@ -337,6 +339,7 @@ const builtGeneratedDiagnosticMessagesJSON = path.join(builtLocalDirectory, "dia
337339
// processDiagnosticMessages script
338340
gulp.task(processDiagnosticMessagesJs, false, [], () => {
339341
const settings: tsc.Settings = getCompilerSettings({
342+
target: "es5",
340343
declaration: false,
341344
removeComments: true,
342345
noResolve: false,
@@ -612,7 +615,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
612615
} while (fs.existsSync(taskConfigsFolder));
613616
fs.mkdirSync(taskConfigsFolder);
614617

615-
workerCount = process.env.workerCount || os.cpus().length;
618+
workerCount = cmdLineOptions["workers"];
616619
}
617620

618621
if (tests || light || taskConfigsFolder) {
@@ -1025,7 +1028,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
10251028
cb();
10261029
}, (cb) => {
10271030
files = files.filter(file => fileMatcher.test(file.path)).sort((filea, fileb) => filea.stat.size - fileb.stat.size);
1028-
const workerCount = (process.env.workerCount && +process.env.workerCount) || os.cpus().length;
1031+
const workerCount = cmdLineOptions["workers"];
10291032
for (let i = 0; i < workerCount; i++) {
10301033
spawnLintWorker(files, finished);
10311034
}

Jakefile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ var harnessSources = harnessCoreSources.concat([
269269
"projectErrors.ts",
270270
"matchFiles.ts",
271271
"initializeTSConfig.ts",
272+
"printer.ts",
272273
].map(function (f) {
273274
return path.join(unittestsDirectory, f);
274275
})).concat([
@@ -465,7 +466,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
465466
options += " --stripInternal";
466467
}
467468

468-
options += " --target es5 --noUnusedLocals --noUnusedParameters";
469+
options += " --target es5 --lib es5,scripthost --noUnusedLocals --noUnusedParameters";
469470

470471
var cmd = host + " " + compilerPath + " " + options + " ";
471472
cmd = cmd + sources.join(" ");
@@ -735,7 +736,7 @@ compileFile(
735736

736737
// Appending exports at the end of the server library
737738
var tsserverLibraryDefinitionFileContents =
738-
fs.readFileSync(tsserverLibraryDefinitionFile).toString() +
739+
fs.readFileSync(tsserverLibraryDefinitionFile).toString() +
739740
"\r\nexport = ts;" +
740741
"\r\nexport as namespace ts;";
741742

scripts/processDiagnosticMessages.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function main(): void {
2727

2828
var inputFilePath = sys.args[0].replace(/\\/g, "/");
2929
var inputStr = sys.readFile(inputFilePath);
30-
30+
3131
var diagnosticMessages: InputDiagnosticMessageTable = JSON.parse(inputStr);
3232

3333
var names = Utilities.getObjectKeys(diagnosticMessages);
@@ -44,7 +44,7 @@ function main(): void {
4444
function checkForUniqueCodes(messages: string[], diagnosticTable: InputDiagnosticMessageTable) {
4545
const originalMessageForCode: string[] = [];
4646
let numConflicts = 0;
47-
47+
4848
for (const currentMessage of messages) {
4949
const code = diagnosticTable[currentMessage].code;
5050

@@ -74,7 +74,7 @@ function buildUniqueNameMap(names: string[]): ts.Map<string> {
7474
var uniqueNames = NameGenerator.ensureUniqueness(names, /* isCaseSensitive */ false, /* isFixed */ undefined);
7575

7676
for (var i = 0; i < names.length; i++) {
77-
nameMap[names[i]] = uniqueNames[i];
77+
nameMap.set(names[i], uniqueNames[i]);
7878
}
7979

8080
return nameMap;
@@ -91,7 +91,7 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap:
9191
for (var i = 0; i < names.length; i++) {
9292
var name = names[i];
9393
var diagnosticDetails = messageTable[name];
94-
var propName = convertPropertyName(nameMap[name]);
94+
var propName = convertPropertyName(nameMap.get(name));
9595

9696
result +=
9797
' ' + propName +
@@ -114,7 +114,7 @@ function buildDiagnosticMessageOutput(messageTable: InputDiagnosticMessageTable,
114114
for (var i = 0; i < names.length; i++) {
115115
var name = names[i];
116116
var diagnosticDetails = messageTable[name];
117-
var propName = convertPropertyName(nameMap[name]);
117+
var propName = convertPropertyName(nameMap.get(name));
118118

119119
result += '\r\n "' + createKey(propName, diagnosticDetails.code) + '"' + ' : "' + name.replace(/[\"]/g, '\\"') + '"';
120120
if (i !== names.length - 1) {

src/compiler/binder.ts

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -349,17 +349,20 @@ namespace ts {
349349
// Otherwise, we'll be merging into a compatible existing symbol (for example when
350350
// you have multiple 'vars' with the same name in the same container). In this case
351351
// just add this node into the declarations list of the symbol.
352-
symbol = symbolTable[name] || (symbolTable[name] = createSymbol(SymbolFlags.None, name));
352+
symbol = symbolTable.get(name);
353+
if (!symbol) {
354+
symbolTable.set(name, symbol = createSymbol(SymbolFlags.None, name));
355+
}
353356

354357
if (name && (includes & SymbolFlags.Classifiable)) {
355-
classifiableNames[name] = name;
358+
classifiableNames.set(name, name);
356359
}
357360

358361
if (symbol.flags & excludes) {
359362
if (symbol.isReplaceableByMethod) {
360363
// Javascript constructor-declared symbols can be discarded in favor of
361364
// prototype symbols like methods.
362-
symbol = symbolTable[name] = createSymbol(SymbolFlags.None, name);
365+
symbolTable.set(name, symbol = createSymbol(SymbolFlags.None, name));
363366
}
364367
else {
365368
if (node.name) {
@@ -1512,7 +1515,7 @@ namespace ts {
15121515
errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
15131516
}
15141517
if (isExternalModuleAugmentation(node)) {
1515-
declareSymbolAndAddToSymbolTable(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);
1518+
declareModuleSymbol(node);
15161519
}
15171520
else {
15181521
let pattern: Pattern | undefined;
@@ -1534,12 +1537,8 @@ namespace ts {
15341537
}
15351538
}
15361539
else {
1537-
const state = getModuleInstanceState(node);
1538-
if (state === ModuleInstanceState.NonInstantiated) {
1539-
declareSymbolAndAddToSymbolTable(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);
1540-
}
1541-
else {
1542-
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
1540+
const state = declareModuleSymbol(node);
1541+
if (state !== ModuleInstanceState.NonInstantiated) {
15431542
if (node.symbol.flags & (SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.RegularEnum)) {
15441543
// if module was already merged with some function, class or non-const enum
15451544
// treat is a non-const-enum-only
@@ -1560,6 +1559,15 @@ namespace ts {
15601559
}
15611560
}
15621561

1562+
function declareModuleSymbol(node: ModuleDeclaration): ModuleInstanceState {
1563+
const state = getModuleInstanceState(node);
1564+
const instantiated = state !== ModuleInstanceState.NonInstantiated;
1565+
declareSymbolAndAddToSymbolTable(node,
1566+
instantiated ? SymbolFlags.ValueModule : SymbolFlags.NamespaceModule,
1567+
instantiated ? SymbolFlags.ValueModuleExcludes : SymbolFlags.NamespaceModuleExcludes);
1568+
return state;
1569+
}
1570+
15631571
function bindFunctionOrConstructorType(node: SignatureDeclaration): void {
15641572
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
15651573
// to the one we would get for: { <...>(...): T }
@@ -1573,7 +1581,7 @@ namespace ts {
15731581
const typeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, "__type");
15741582
addDeclarationToSymbol(typeLiteralSymbol, node, SymbolFlags.TypeLiteral);
15751583
typeLiteralSymbol.members = createMap<Symbol>();
1576-
typeLiteralSymbol.members[symbol.name] = symbol;
1584+
typeLiteralSymbol.members.set(symbol.name, symbol);
15771585
}
15781586

15791587
function bindObjectLiteralExpression(node: ObjectLiteralExpression) {
@@ -1604,9 +1612,9 @@ namespace ts {
16041612
? ElementKind.Property
16051613
: ElementKind.Accessor;
16061614

1607-
const existingKind = seen[identifier.text];
1615+
const existingKind = seen.get(identifier.text);
16081616
if (!existingKind) {
1609-
seen[identifier.text] = currentKind;
1617+
seen.set(identifier.text, currentKind);
16101618
continue;
16111619
}
16121620

@@ -2211,7 +2219,7 @@ namespace ts {
22112219
constructorFunction.parent = classPrototype;
22122220
classPrototype.parent = leftSideOfAssignment;
22132221

2214-
const funcSymbol = container.locals[constructorFunction.text];
2222+
const funcSymbol = container.locals.get(constructorFunction.text);
22152223
if (!funcSymbol || !(funcSymbol.flags & SymbolFlags.Function || isDeclarationOfFunctionExpression(funcSymbol))) {
22162224
return;
22172225
}
@@ -2242,7 +2250,7 @@ namespace ts {
22422250
bindAnonymousDeclaration(node, SymbolFlags.Class, bindingName);
22432251
// Add name of class expression into the map for semantic classifier
22442252
if (node.name) {
2245-
classifiableNames[node.name.text] = node.name.text;
2253+
classifiableNames.set(node.name.text, node.name.text);
22462254
}
22472255
}
22482256

@@ -2258,14 +2266,14 @@ namespace ts {
22582266
// module might have an exported variable called 'prototype'. We can't allow that as
22592267
// that would clash with the built-in 'prototype' for the class.
22602268
const prototypeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Prototype, "prototype");
2261-
if (symbol.exports[prototypeSymbol.name]) {
2269+
const symbolExport = symbol.exports.get(prototypeSymbol.name);
2270+
if (symbolExport) {
22622271
if (node.name) {
22632272
node.name.parent = node;
22642273
}
2265-
file.bindDiagnostics.push(createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0],
2266-
Diagnostics.Duplicate_identifier_0, prototypeSymbol.name));
2274+
file.bindDiagnostics.push(createDiagnosticForNode(symbolExport.declarations[0], Diagnostics.Duplicate_identifier_0, prototypeSymbol.name));
22672275
}
2268-
symbol.exports[prototypeSymbol.name] = prototypeSymbol;
2276+
symbol.exports.set(prototypeSymbol.name, prototypeSymbol);
22692277
prototypeSymbol.parent = symbol;
22702278
}
22712279

0 commit comments

Comments
 (0)