Skip to content

Commit 06cd3c3

Browse files
authored
Merge branch 'master' into module-format-aware-import-fixes
2 parents eb6e025 + 8d5b052 commit 06cd3c3

File tree

296 files changed

+3297
-1516
lines changed

Some content is hidden

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

296 files changed

+3297
-1516
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ internal/
5959
.idea
6060
yarn.lock
6161
.parallelperf.*
62+
tests/cases/user/*/package-lock.json
63+
tests/cases/user/*/node_modules/
64+
tests/cases/user/*/**/*.js
65+
tests/cases/user/*/**/*.js.map
66+
tests/cases/user/*/**/*.d.ts
67+
!tests/cases/user/zone.js/
68+
!tests/cases/user/bignumber.js/
69+
!tests/cases/user/discord.js/

Gulpfile.ts

+22-36
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,13 @@ const es2015LibrarySources = [
123123
"es2015.symbol.wellknown.d.ts"
124124
];
125125

126-
const es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
127-
return { target: "lib." + source, sources: ["header.d.ts", source] };
128-
});
126+
const es2015LibrarySourceMap = es2015LibrarySources.map(source =>
127+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
129128

130129
const es2016LibrarySource = ["es2016.array.include.d.ts"];
131130

132-
const es2016LibrarySourceMap = es2016LibrarySource.map(function(source) {
133-
return { target: "lib." + source, sources: ["header.d.ts", source] };
134-
});
131+
const es2016LibrarySourceMap = es2016LibrarySource.map(source =>
132+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
135133

136134
const es2017LibrarySource = [
137135
"es2017.object.d.ts",
@@ -140,17 +138,15 @@ const es2017LibrarySource = [
140138
"es2017.intl.d.ts",
141139
];
142140

143-
const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) {
144-
return { target: "lib." + source, sources: ["header.d.ts", source] };
145-
});
141+
const es2017LibrarySourceMap = es2017LibrarySource.map(source =>
142+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
146143

147144
const esnextLibrarySource = [
148145
"esnext.asynciterable.d.ts"
149146
];
150147

151-
const esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {
152-
return { target: "lib." + source, sources: ["header.d.ts", source] };
153-
});
148+
const esnextLibrarySourceMap = esnextLibrarySource.map(source =>
149+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
154150

155151
const hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
156152

@@ -176,9 +172,8 @@ const librarySourceMap = [
176172
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
177173
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
178174

179-
const libraryTargets = librarySourceMap.map(function(f) {
180-
return path.join(builtLocalDirectory, f.target);
181-
});
175+
const libraryTargets = librarySourceMap.map(f =>
176+
path.join(builtLocalDirectory, f.target));
182177

183178
/**
184179
* .lcg file is what localization team uses to know what messages to localize.
@@ -193,22 +188,19 @@ const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessag
193188
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
194189
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
195190
*/
196-
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"].map(function (f) {
197-
return path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json");
198-
}).concat(generatedLCGFile);
191+
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"]
192+
.map(f => path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json"))
193+
.concat(generatedLCGFile);
199194

200195
for (const i in libraryTargets) {
201196
const entry = librarySourceMap[i];
202197
const target = libraryTargets[i];
203-
const sources = [copyright].concat(entry.sources.map(function(s) {
204-
return path.join(libraryDirectory, s);
205-
}));
206-
gulp.task(target, /*help*/ false, [], function() {
207-
return gulp.src(sources)
198+
const sources = [copyright].concat(entry.sources.map(s => path.join(libraryDirectory, s)));
199+
gulp.task(target, /*help*/ false, [], () =>
200+
gulp.src(sources)
208201
.pipe(newer(target))
209202
.pipe(concat(target, { newLine: "\n\n" }))
210-
.pipe(gulp.dest("."));
211-
});
203+
.pipe(gulp.dest(".")));
212204
}
213205

214206
const configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
@@ -575,9 +567,7 @@ gulp.task(specMd, /*help*/ false, [word2mdJs], (done) => {
575567
const specMDFullPath = path.resolve(specMd);
576568
const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\"";
577569
console.log(cmd);
578-
cp.exec(cmd, function() {
579-
done();
580-
});
570+
cp.exec(cmd, done);
581571
});
582572

583573
gulp.task("generate-spec", "Generates a Markdown version of the Language Specification", [specMd]);
@@ -714,17 +704,13 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
714704
}
715705
args.push(run);
716706
setNodeEnvToDevelopment();
717-
exec(mocha, args, lintThenFinish, function(e, status) {
718-
finish(e, status);
719-
});
707+
exec(mocha, args, lintThenFinish, finish);
720708

721709
}
722710
else {
723711
// run task to load all tests and partition them between workers
724712
setNodeEnvToDevelopment();
725-
exec(host, [run], lintThenFinish, function(e, status) {
726-
finish(e, status);
727-
});
713+
exec(host, [run], lintThenFinish, finish);
728714
}
729715
});
730716

@@ -1082,7 +1068,7 @@ function sendNextFile(files: {path: string}[], child: cp.ChildProcess, callback:
10821068
function spawnLintWorker(files: {path: string}[], callback: (failures: number) => void) {
10831069
const child = cp.fork("./scripts/parallel-lint");
10841070
let failures = 0;
1085-
child.on("message", function(data) {
1071+
child.on("message", data => {
10861072
switch (data.kind) {
10871073
case "result":
10881074
if (data.failures > 0) {
@@ -1106,7 +1092,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
11061092
const fileMatcher = cmdLineOptions.files;
11071093
const files = fileMatcher
11081094
? `src/**/${fileMatcher}`
1109-
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";
1095+
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
11101096
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
11111097
console.log("Linting: " + cmd);
11121098
child_process.execSync(cmd, { stdio: [0, 1, 2] });

Jakefile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ var harnessCoreSources = [
105105
"projectsRunner.ts",
106106
"loggedIO.ts",
107107
"rwcRunner.ts",
108+
"userRunner.ts",
108109
"test262Runner.ts",
109110
"./parallel/shared.ts",
110111
"./parallel/host.ts",
@@ -1282,7 +1283,7 @@ task("lint", ["build-rules"], () => {
12821283
const fileMatcher = process.env.f || process.env.file || process.env.files;
12831284
const files = fileMatcher
12841285
? `src/**/${fileMatcher}`
1285-
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";
1286+
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
12861287
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
12871288
console.log("Linting: " + cmd);
12881289
jake.exec([cmd], { interactive: true }, () => {

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@
7474
"q": "latest",
7575
"run-sequence": "latest",
7676
"sorcery": "latest",
77+
"source-map-support": "latest",
7778
"through2": "latest",
7879
"travis-fold": "latest",
7980
"ts-node": "latest",
8081
"tslint": "latest",
82+
"vinyl": "latest",
8183
"colors": "latest",
8284
"typescript": "next"
8385
},

scripts/ior.ts

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ module Commands {
6464
}
6565
if (path.charAt(1) === ":") {
6666
if (path.charAt(2) === directorySeparator) return 3;
67-
return 2;
6867
}
6968
return 0;
7069
}

src/compiler/binder.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ namespace ts {
15501550
function setExportContextFlag(node: ModuleDeclaration | SourceFile) {
15511551
// A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
15521552
// declarations with export modifiers) is an export context in which declarations are implicitly exported.
1553-
if (isInAmbientContext(node) && !hasExportDeclarations(node)) {
1553+
if (node.flags & NodeFlags.Ambient && !hasExportDeclarations(node)) {
15541554
node.flags |= NodeFlags.ExportContext;
15551555
}
15561556
else {
@@ -1726,7 +1726,7 @@ namespace ts {
17261726
node.originalKeywordKind >= SyntaxKind.FirstFutureReservedWord &&
17271727
node.originalKeywordKind <= SyntaxKind.LastFutureReservedWord &&
17281728
!isIdentifierName(node) &&
1729-
!isInAmbientContext(node)) {
1729+
!(node.flags & NodeFlags.Ambient)) {
17301730

17311731
// Report error only if there are no parse errors in file
17321732
if (!file.parseDiagnostics.length) {
@@ -2481,7 +2481,7 @@ namespace ts {
24812481
}
24822482

24832483
function bindParameter(node: ParameterDeclaration) {
2484-
if (inStrictMode && !isInAmbientContext(node)) {
2484+
if (inStrictMode && !(node.flags & NodeFlags.Ambient)) {
24852485
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
24862486
// strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
24872487
checkStrictModeEvalOrArguments(node, node.name);
@@ -2503,7 +2503,7 @@ namespace ts {
25032503
}
25042504

25052505
function bindFunctionDeclaration(node: FunctionDeclaration) {
2506-
if (!file.isDeclarationFile && !isInAmbientContext(node)) {
2506+
if (!file.isDeclarationFile && !(node.flags & NodeFlags.Ambient)) {
25072507
if (isAsyncFunction(node)) {
25082508
emitFlags |= NodeFlags.HasAsyncFunctions;
25092509
}
@@ -2520,7 +2520,7 @@ namespace ts {
25202520
}
25212521

25222522
function bindFunctionExpression(node: FunctionExpression) {
2523-
if (!file.isDeclarationFile && !isInAmbientContext(node)) {
2523+
if (!file.isDeclarationFile && !(node.flags & NodeFlags.Ambient)) {
25242524
if (isAsyncFunction(node)) {
25252525
emitFlags |= NodeFlags.HasAsyncFunctions;
25262526
}
@@ -2534,7 +2534,7 @@ namespace ts {
25342534
}
25352535

25362536
function bindPropertyOrMethodOrAccessor(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
2537-
if (!file.isDeclarationFile && !isInAmbientContext(node) && isAsyncFunction(node)) {
2537+
if (!file.isDeclarationFile && !(node.flags & NodeFlags.Ambient) && isAsyncFunction(node)) {
25382538
emitFlags |= NodeFlags.HasAsyncFunctions;
25392539
}
25402540

@@ -2583,7 +2583,7 @@ namespace ts {
25832583
// On the other side we do want to report errors on non-initialized 'lets' because of TDZ
25842584
const reportUnreachableCode =
25852585
!options.allowUnreachableCode &&
2586-
!isInAmbientContext(node) &&
2586+
!(node.flags & NodeFlags.Ambient) &&
25872587
(
25882588
node.kind !== SyntaxKind.VariableStatement ||
25892589
getCombinedNodeFlags((<VariableStatement>node).declarationList) & NodeFlags.BlockScoped ||

0 commit comments

Comments
 (0)