Skip to content

Commit a15a7ec

Browse files
committed
Merge branch 'master' into release-2.4
2 parents 14fa6ac + 3d8cf62 commit a15a7ec

File tree

162 files changed

+5741
-973
lines changed

Some content is hidden

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

162 files changed

+5741
-973
lines changed

.mailmap

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,23 @@ rdosanjh <[email protected]> # Raj Dosanjh
248248
gdh1995 <[email protected]> # Dahan Gong
249249
cedvdb <[email protected]> # @cedvdb
250250
kpreisser <[email protected]> # K. Preißer
251-
e-cloud <[email protected]> # @e-cloud
251+
e-cloud <[email protected]> # @e-cloud
252+
Andrew Casey <[email protected]> Andrew Casey <[email protected]>
253+
Andrew Stegmaier <[email protected]>
254+
Benny Neugebauer <[email protected]>
255+
Blaine Bublitz <[email protected]>
256+
Charles Pierce <[email protected]>
257+
Daniel Król <[email protected]>
258+
Diogo Franco (Kovensky) <[email protected]>
259+
Donald Pipowitch <[email protected]>
260+
Halasi Tamás <[email protected]>
261+
262+
Joe Chung <[email protected]>
263+
Kate Miháliková <[email protected]>
264+
Mohsen Azimi <[email protected]>
265+
Noel Varanda <[email protected]>
266+
Reiner Dolp <[email protected]>
267+
268+
TravCav <[email protected]> # @TravCav
269+
Vladimir Kurchatkin <[email protected]>
270+
William Orr <[email protected]>

AUTHORS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ TypeScript is authored by:
1515
* Anders Hejlsberg
1616
* Andreas Martin
1717
* Andrej Baran
18+
* Andrew Casey
1819
* Andrew Ochsner
20+
* Andrew Stegmaier
1921
* Andrew Z Allen
2022
* András Parditka
2123
* Andy Hanson
@@ -31,14 +33,17 @@ TypeScript is authored by:
3133
* Ben Duffield
3234
* Ben Mosher
3335
* Benjamin Bock
36+
* Benny Neugebauer
3437
* Bill Ticehurst
38+
* Blaine Bublitz
3539
* Blake Embrey
3640
* @bootstraponline
3741
* Bowden Kelly
3842
* Brett Mayen
3943
* Bryan Forbes
4044
* Caitlin Potter
4145
* @cedvdb
46+
* Charles Pierce
4247
* Charly POLY
4348
* Chris Bubernak
4449
* Christophe Vidal
@@ -52,6 +57,7 @@ TypeScript is authored by:
5257
* Dan Corder
5358
* Dan Quirk
5459
* Daniel Hollocher
60+
* Daniel Król
5561
* Daniel Lehenbauer
5662
* Daniel Rosenwasser
5763
* David Kmenta
@@ -60,9 +66,11 @@ TypeScript is authored by:
6066
* David Souther
6167
* Denis Nedelyaev
6268
* Dick van den Brink
69+
* Diogo Franco (Kovensky)
6370
* Dirk Bäumer
6471
* Dirk Holtwick
6572
* Dom Chen
73+
* Donald Pipowitch
6674
* Doug Ilijev
6775
* @e-cloud
6876
* Elisée Maurer
@@ -89,12 +97,14 @@ TypeScript is authored by:
8997
* Guilherme Oenning
9098
* Guillaume Salles
9199
* Guy Bedford
100+
* Halasi Tamás
92101
* Harald Niesche
93102
* Hendrik Liebau
94103
* Herrington Darkholme
95104
* Homa Wong
96105
* Iain Monro
97106
* Igor Novozhilov
107+
* Ika
98108
* Ingvar Stepanyan
99109
* Isiah Meadows
100110
* Ivo Gabe de Wolff
@@ -111,6 +121,7 @@ TypeScript is authored by:
111121
* Jeffrey Morlan
112122
* Jesse Schalken
113123
* Jiri Tobisek
124+
* Joe Chung
114125
* Joel Day
115126
* Joey Wilson
116127
* Johannes Rieken
@@ -131,6 +142,7 @@ TypeScript is authored by:
131142
* K. Preißer
132143
* Kagami Sascha Rosylight
133144
* Kanchalai Tanglertsampan
145+
* Kate Miháliková
134146
* Keith Mashinter
135147
* Ken Howard
136148
* Kenji Imamula
@@ -159,13 +171,15 @@ TypeScript is authored by:
159171
* Mike Busyrev
160172
* Mine Starks
161173
* Mohamed Hegazy
174+
* Mohsen Azimi
162175
* Myles Megyesi
163176
* Natalie Coley
164177
* Nathan Shively-Sanders
165178
* Nathan Yee
166179
* Nicolas Henry
167180
* Nima Zahedi
168181
* Noah Chen
182+
* Noel Varanda
169183
* Noj Vek
170184
* Oleg Mihailik
171185
* Oleksandr Chekhovskyi
@@ -186,6 +200,7 @@ TypeScript is authored by:
186200
* Punya Biswal
187201
* Rado Kirov
188202
* Raj Dosanjh
203+
* Reiner Dolp
189204
* Richard Karmazín
190205
* Richard Knoll
191206
* Richard Sentino
@@ -213,6 +228,7 @@ TypeScript is authored by:
213228
* Sudheesh Singanamalla
214229
* Sébastien Arod
215230
* @T18970237136
231+
* @t_
216232
* Tarik Ozket
217233
* Tetsuharu Ohzeki
218234
* Thomas Loubiou
@@ -225,13 +241,16 @@ TypeScript is authored by:
225241
* togru
226242
* Tomas Grubliauskas
227243
* Torben Fitschen
244+
* @TravCav
228245
* TruongSinh Tran-Nguyen
229246
* Vadi Taslim
230247
* Vidar Tonaas Fauske
231248
* Viktor Zozulyak
232249
* Vilic Vane
250+
* Vladimir Kurchatkin
233251
* Vladimir Matveev
234252
* Wesley Wigham
253+
* William Orr
235254
* York Yao
236255
* @yortus
237256
* Yuichi Nukiyama

Gulpfile.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,25 @@ Error.stackTraceLimit = 1000;
3939

4040
const cmdLineOptions = minimist(process.argv.slice(2), {
4141
boolean: ["debug", "inspect", "light", "colors", "lint", "soft"],
42-
string: ["browser", "tests", "host", "reporter", "stackTraceLimit"],
42+
string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout"],
4343
alias: {
4444
b: "browser",
45-
d: "debug",
46-
t: "tests",
47-
test: "tests",
45+
d: "debug", "debug-brk": "debug",
46+
i: "inspect", "inspect-brk": "inspect",
47+
t: "tests", test: "tests",
4848
r: "reporter",
49-
color: "colors",
50-
f: "files",
51-
file: "files",
49+
c: "colors", color: "colors",
50+
f: "files", file: "files",
5251
w: "workers",
5352
},
5453
default: {
5554
soft: false,
5655
colors: process.env.colors || process.env.color || true,
57-
debug: process.env.debug || process.env.d,
58-
inspect: process.env.inspect,
56+
debug: process.env.debug || process.env["debug-brk"] || process.env.d,
57+
inspect: process.env.inspect || process.env["inspect-brk"] || process.env.i,
5958
host: process.env.TYPESCRIPT_HOST || process.env.host || "node",
6059
browser: process.env.browser || process.env.b || "IE",
60+
timeout: process.env.timeout || 40000,
6161
tests: process.env.test || process.env.tests || process.env.t,
6262
light: process.env.light || false,
6363
reporter: process.env.reporter || process.env.r,
@@ -594,11 +594,11 @@ function restoreSavedNodeEnv() {
594594
process.env.NODE_ENV = savedNodeEnv;
595595
}
596596

597-
let testTimeout = 40000;
598597
function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: (e?: any) => void) {
599598
const lintFlag = cmdLineOptions["lint"];
600599
cleanTestDirs((err) => {
601600
if (err) { console.error(err); failWithStatus(err, 1); }
601+
let testTimeout = cmdLineOptions["timeout"];
602602
const debug = cmdLineOptions["debug"];
603603
const inspect = cmdLineOptions["inspect"];
604604
const tests = cmdLineOptions["tests"];
@@ -637,12 +637,6 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
637637
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
638638
if (!runInParallel) {
639639
const args = [];
640-
if (inspect) {
641-
args.push("--inspect");
642-
}
643-
if (inspect || debug) {
644-
args.push("--debug-brk");
645-
}
646640
args.push("-R", reporter);
647641
if (tests) {
648642
args.push("-g", `"${tests}"`);
@@ -653,7 +647,15 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
653647
else {
654648
args.push("--no-colors");
655649
}
656-
args.push("-t", testTimeout);
650+
if (inspect) {
651+
args.unshift("--inspect-brk");
652+
}
653+
else if (debug) {
654+
args.unshift("--debug-brk");
655+
}
656+
else {
657+
args.push("-t", testTimeout);
658+
}
657659
args.push(run);
658660
setNodeEnvToDevelopment();
659661
exec(mocha, args, lintThenFinish, function(e, status) {
@@ -838,6 +840,7 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
838840
});
839841

840842
gulp.task("generate-code-coverage", "Generates code coverage data via istanbul", ["tests"], (done) => {
843+
const testTimeout = cmdLineOptions["timeout"];
841844
exec("istanbul", ["cover", "node_modules/mocha/bin/_mocha", "--", "-R", "min", "-t", testTimeout.toString(), run], done, done);
842845
});
843846

Jakefile.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ var LKGDirectory = "lib/";
2525
var copyright = "CopyrightNotice.txt";
2626
var thirdParty = "ThirdPartyNoticeText.txt";
2727

28+
var defaultTestTimeout = 40000;
29+
2830
// add node_modules to path so we don't need global modules, prefer the modules by adding them first
2931
var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter;
3032
if (process.env.path !== undefined) {
@@ -74,6 +76,10 @@ function measure(marker) {
7476
console.log("travis_time:end:" + marker.id + ":start=" + toNs(marker.stamp) + ",finish=" + toNs(total) + ",duration=" + toNs(diff) + "\r");
7577
}
7678

79+
function removeConstModifierFromEnumDeclarations(text) {
80+
return text.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, '$1$2enum $3 {$4');
81+
}
82+
7783
var compilerSources = filesFromConfig("./src/compiler/tsconfig.json");
7884
var servicesSources = filesFromConfig("./src/services/tsconfig.json");
7985
var cancellationTokenSources = filesFromConfig(path.join(serverDirectory, "cancellationToken/tsconfig.json"));
@@ -551,7 +557,7 @@ compileFile(servicesFile, servicesSources, [builtLocalDirectory, copyright].conc
551557
// Stanalone/web definition file using global 'ts' namespace
552558
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, { silent: true });
553559
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
554-
definitionFileContents = definitionFileContents.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, '$1$2enum $3 {$4');
560+
definitionFileContents = removeConstModifierFromEnumDeclarations(definitionFileContents)
555561
fs.writeFileSync(standaloneDefinitionsFile, definitionFileContents);
556562

557563
// Official node package definition file, pointed to by 'typings' in package.json
@@ -611,6 +617,7 @@ compileFile(
611617
fs.readFileSync(tsserverLibraryDefinitionFile).toString() +
612618
"\r\nexport = ts;" +
613619
"\r\nexport as namespace ts;";
620+
tsserverLibraryDefinitionFileContents = removeConstModifierFromEnumDeclarations(tsserverLibraryDefinitionFileContents);
614621

615622
fs.writeFileSync(tsserverLibraryDefinitionFile, tsserverLibraryDefinitionFileContents);
616623
});
@@ -800,8 +807,8 @@ function runConsoleTests(defaultReporter, runInParallel) {
800807
cleanTestDirs();
801808
}
802809

803-
var debug = process.env.debug || process.env.d;
804-
var inspect = process.env.inspect;
810+
var debug = process.env.debug || process.env["debug-brk"] || process.env.d;
811+
var inspect = process.env.inspect || process.env["inspect-brk"] || process.env.i;
805812
var testTimeout = process.env.timeout || defaultTestTimeout;
806813
var tests = process.env.test || process.env.tests || process.env.t;
807814
var light = process.env.light || false;
@@ -842,12 +849,6 @@ function runConsoleTests(defaultReporter, runInParallel) {
842849
if (!runInParallel) {
843850
var startTime = mark();
844851
var args = [];
845-
if (inspect) {
846-
args.push("--inspect");
847-
}
848-
if (inspect || debug) {
849-
args.push("--debug-brk");
850-
}
851852
args.push("-R", reporter);
852853
if (tests) {
853854
args.push("-g", `"${tests}"`);
@@ -861,7 +862,15 @@ function runConsoleTests(defaultReporter, runInParallel) {
861862
if (bail) {
862863
args.push("--bail");
863864
}
864-
args.push("-t", testTimeout);
865+
if (inspect) {
866+
args.unshift("--inspect-brk");
867+
}
868+
else if (debug) {
869+
args.unshift("--debug-brk");
870+
}
871+
else {
872+
args.push("-t", testTimeout);
873+
}
865874
args.push(run);
866875

867876
var cmd = "mocha " + args.join(" ");
@@ -926,7 +935,6 @@ function runConsoleTests(defaultReporter, runInParallel) {
926935
}
927936
}
928937

929-
var defaultTestTimeout = 22000;
930938
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
931939
task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], function () {
932940
runConsoleTests('min', /*runInParallel*/ true);
@@ -939,6 +947,7 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
939947

940948
desc("Generates code coverage data via instanbul");
941949
task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
950+
var testTimeout = process.env.timeout || defaultTestTimeout;
942951
var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run;
943952
console.log(cmd);
944953
exec(cmd);

src/compiler/binder.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ namespace ts {
612612
break;
613613
case SyntaxKind.ForInStatement:
614614
case SyntaxKind.ForOfStatement:
615-
bindForInOrForOfStatement(<ForInStatement | ForOfStatement>node);
615+
bindForInOrForOfStatement(<ForInOrOfStatement>node);
616616
break;
617617
case SyntaxKind.IfStatement:
618618
bindIfStatement(<IfStatement>node);
@@ -950,7 +950,7 @@ namespace ts {
950950
currentFlow = finishFlowLabel(postLoopLabel);
951951
}
952952

953-
function bindForInOrForOfStatement(node: ForInStatement | ForOfStatement): void {
953+
function bindForInOrForOfStatement(node: ForInOrOfStatement): void {
954954
const preLoopLabel = createLoopLabel();
955955
const postLoopLabel = createBranchLabel();
956956
addAntecedent(preLoopLabel, currentFlow);
@@ -1328,7 +1328,7 @@ namespace ts {
13281328

13291329
function bindVariableDeclarationFlow(node: VariableDeclaration) {
13301330
bindEachChild(node);
1331-
if (node.initializer || node.parent.parent.kind === SyntaxKind.ForInStatement || node.parent.parent.kind === SyntaxKind.ForOfStatement) {
1331+
if (node.initializer || isForInOrOfStatement(node.parent.parent)) {
13321332
bindInitializedVariableFlow(node);
13331333
}
13341334
}
@@ -1521,7 +1521,7 @@ namespace ts {
15211521
// All the children of these container types are never visible through another
15221522
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
15231523
// they're only accessed 'lexically' (i.e. from code that exists underneath
1524-
// their container in the tree. To accomplish this, we simply add their declared
1524+
// their container in the tree). To accomplish this, we simply add their declared
15251525
// symbol to the 'locals' of the container. These symbols can then be found as
15261526
// the type checker walks up the containers, checking them for matching names.
15271527
return declareSymbol(container.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes);
@@ -2053,7 +2053,10 @@ namespace ts {
20532053
case SyntaxKind.TypePredicate:
20542054
return checkTypePredicate(node as TypePredicateNode);
20552055
case SyntaxKind.TypeParameter:
2056-
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
2056+
if (node.parent.kind !== ts.SyntaxKind.JSDocTemplateTag || isInJavaScriptFile(node)) {
2057+
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
2058+
}
2059+
return;
20572060
case SyntaxKind.Parameter:
20582061
return bindParameter(<ParameterDeclaration>node);
20592062
case SyntaxKind.VariableDeclaration:
@@ -2135,8 +2138,10 @@ namespace ts {
21352138
case SyntaxKind.EnumDeclaration:
21362139
return bindEnumDeclaration(<EnumDeclaration>node);
21372140
case SyntaxKind.ModuleDeclaration:
2138-
return bindModuleDeclaration(<ModuleDeclaration>node);
2139-
2141+
if (node.parent.kind !== ts.SyntaxKind.JSDocTypedefTag || isInJavaScriptFile(node)) {
2142+
return bindModuleDeclaration(<ModuleDeclaration>node);
2143+
}
2144+
return undefined;
21402145
// Jsx-attributes
21412146
case SyntaxKind.JsxAttributes:
21422147
return bindJsxAttributes(<JsxAttributes>node);

0 commit comments

Comments
 (0)