Skip to content

Commit 047b76f

Browse files
committed
Merge branch 'master' into codefix_add_missing_new_operator
2 parents 21feb20 + 02ca5be commit 047b76f

File tree

1,286 files changed

+38065
-25946
lines changed

Some content is hidden

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

1,286 files changed

+38065
-25946
lines changed

.github/ISSUE_TEMPLATE/Feature_request.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ What shortcomings exist with current approaches?
3232
## Checklist
3333

3434
My suggestion meets these guidelines:
35-
* [ ] This wouldn't be a breaking change in existing TypeScript / JavaScript code
35+
36+
* [ ] This wouldn't be a breaking change in existing TypeScript/JavaScript code
3637
* [ ] This wouldn't change the runtime behavior of existing JavaScript code
3738
* [ ] This could be implemented without emitting different JS based on the types of the expressions
38-
* [ ] This isn't a runtime feature (e.g. new expression-level syntax)
39+
* [ ] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
40+
* [ ] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).
3941

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ You can specify which browser to use for debugging. Currently Chrome and IE are
137137
jake runtests-browser tests=2dArrays browser=chrome
138138
```
139139

140-
You can debug with VS Code or Node instead with `jake runtests debug=true`:
140+
You can debug with VS Code or Node instead with `jake runtests inspect=true`:
141141

142142
```Shell
143-
jake runtests tests=2dArrays debug=true
143+
jake runtests tests=2dArrays inspect=true
144144
```
145145

146146
## Adding a Test
@@ -153,7 +153,7 @@ The supported names and values are the same as those supported in the compiler i
153153
They are useful for tests relating to modules.
154154
See below for examples.
155155

156-
**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder.
156+
**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder.
157157
**Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common.
158158

159159
### Tests for multiple files

Gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const exec = require("./scripts/build/exec");
2626
const browserify = require("./scripts/build/browserify");
2727
const prepend = require("./scripts/build/prepend");
2828
const { removeSourceMaps } = require("./scripts/build/sourcemaps");
29-
const { CancellationTokenSource, CancelError, delay, Semaphore } = require("prex");
29+
const { CancellationTokenSource, CancelError, delay, Semaphore } = require("prex");
3030
const { libraryTargets, generateLibs } = require("./scripts/build/lib");
3131
const { runConsoleTests, cleanTestDirs, writeTestConfigFile, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } = require("./scripts/build/tests");
3232

Jakefile.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ task(TaskNames.local, [
147147
task("default", [TaskNames.local]);
148148

149149
const RunTestsPrereqs = [TaskNames.lib, Paths.servicesDefinitionFile, Paths.typescriptDefinitionFile, Paths.tsserverLibraryDefinitionFile];
150-
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
150+
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... i[nspect]=true.");
151151
task(TaskNames.runtestsParallel, RunTestsPrereqs, function () {
152152
tsbuild([ConfigFileFor.runjs], true, () => {
153153
runConsoleTests("min", /*parallel*/ true);
154154
});
155155
}, { async: true });
156156

157-
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
157+
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... i[nspect]=true.");
158158
task(TaskNames.runtests, RunTestsPrereqs, function () {
159159
tsbuild([ConfigFileFor.runjs], true, () => {
160160
runConsoleTests('mocha-fivemat-progress-reporter', /*runInParallel*/ false);
@@ -520,7 +520,6 @@ function runConsoleTests(defaultReporter, runInParallel) {
520520
}
521521

522522
let testTimeout = process.env.timeout || defaultTestTimeout;
523-
const debug = process.env.debug || process.env["debug-brk"] || process.env.d;
524523
const inspect = process.env.inspect || process.env["inspect-brk"] || process.env.i;
525524
const runners = process.env.runners || process.env.runner || process.env.ru;
526525
const tests = process.env.test || process.env.tests || process.env.t;

scripts/build/gulp-typescript-oop/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
const path = require("path");
33
const child_process = require("child_process");
4+
const fs = require("fs");
45
const tsc = require("gulp-typescript");
56
const Vinyl = require("vinyl");
67
const { Duplex, Readable } = require("stream");
@@ -42,7 +43,10 @@ function createProject(tsConfigFileName, settings, options) {
4243
getVinyl(path) { return inputs.get(path); },
4344
getSourceFile(fileName) { return sourceFiles.get(fileName); },
4445
createSourceFile(fileName, text, languageVersion) {
45-
if (text === undefined) throw new Error("File not cached.");
46+
if (text === undefined) {
47+
text = fs.readFileSync(fileName, "utf8");
48+
}
49+
4650
/** @type {protocol.SourceFile} */
4751
let file;
4852
if (options.parse) {

src/compiler/binder.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,7 +2418,7 @@ namespace ts {
24182418
const flags = exportAssignmentIsAlias(node)
24192419
? SymbolFlags.Alias // An export= with an EntityNameExpression or a ClassExpression exports all meanings of that identifier or class
24202420
: SymbolFlags.Property | SymbolFlags.ExportValue | SymbolFlags.ValueModule;
2421-
declareSymbol(file.symbol.exports!, file.symbol, node, flags, SymbolFlags.None);
2421+
declareSymbol(file.symbol.exports!, file.symbol, node, flags | SymbolFlags.Assignment, SymbolFlags.None);
24222422
}
24232423

24242424
function bindThisPropertyAssignment(node: BinaryExpression | PropertyAccessExpression) {
@@ -2921,7 +2921,6 @@ namespace ts {
29212921
}
29222922
}
29232923

2924-
/* @internal */
29252924
export function isExportsOrModuleExportsOrAlias(sourceFile: SourceFile, node: Expression): boolean {
29262925
return isExportsIdentifier(node) ||
29272926
isModuleExportsPropertyAccessExpression(node) ||
@@ -3702,6 +3701,10 @@ namespace ts {
37023701
}
37033702
break;
37043703

3704+
case SyntaxKind.BigIntLiteral:
3705+
transformFlags |= TransformFlags.AssertESNext;
3706+
break;
3707+
37053708
case SyntaxKind.ForOfStatement:
37063709
// This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of).
37073710
if ((<ForOfStatement>node).awaitModifier) {
@@ -3718,6 +3721,7 @@ namespace ts {
37183721

37193722
case SyntaxKind.AnyKeyword:
37203723
case SyntaxKind.NumberKeyword:
3724+
case SyntaxKind.BigIntKeyword:
37213725
case SyntaxKind.NeverKeyword:
37223726
case SyntaxKind.ObjectKeyword:
37233727
case SyntaxKind.StringKeyword:
@@ -3893,7 +3897,6 @@ namespace ts {
38933897
* For performance reasons, `computeTransformFlagsForNode` uses local constant values rather
38943898
* than calling this function.
38953899
*/
3896-
/* @internal */
38973900
export function getTransformFlagsSubtreeExclusions(kind: SyntaxKind) {
38983901
if (kind >= SyntaxKind.FirstTypeNode && kind <= SyntaxKind.LastTypeNode) {
38993902
return TransformFlags.TypeExcludes;
@@ -3926,6 +3929,7 @@ namespace ts {
39263929
return TransformFlags.MethodOrAccessorExcludes;
39273930
case SyntaxKind.AnyKeyword:
39283931
case SyntaxKind.NumberKeyword:
3932+
case SyntaxKind.BigIntKeyword:
39293933
case SyntaxKind.NeverKeyword:
39303934
case SyntaxKind.StringKeyword:
39313935
case SyntaxKind.ObjectKeyword:

src/compiler/builder.ts

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,13 @@ namespace ts {
201201
}
202202

203203
Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
204+
const seenFileAndExportsOfFile = createMap<true>();
204205
// Go through exported modules from cache first
205206
// If exported modules has path, all files referencing file exported from are affected
206207
if (forEachEntry(state.currentAffectedFilesExportedModulesMap!, (exportedModules, exportedFromPath) =>
207208
exportedModules &&
208209
exportedModules.has(affectedFile.path) &&
209-
removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath as Path)
210+
removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath as Path, seenFileAndExportsOfFile)
210211
)) {
211212
return;
212213
}
@@ -215,17 +216,49 @@ namespace ts {
215216
forEachEntry(state.exportedModulesMap, (exportedModules, exportedFromPath) =>
216217
!state.currentAffectedFilesExportedModulesMap!.has(exportedFromPath) && // If we already iterated this through cache, ignore it
217218
exportedModules.has(affectedFile.path) &&
218-
removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath as Path)
219+
removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath as Path, seenFileAndExportsOfFile)
219220
);
220221
}
221222

222223
/**
223224
* removes the semantic diagnostics of files referencing referencedPath and
224225
* returns true if there are no more semantic diagnostics from old state
225226
*/
226-
function removeSemanticDiagnosticsOfFilesReferencingPath(state: BuilderProgramState, referencedPath: Path) {
227+
function removeSemanticDiagnosticsOfFilesReferencingPath(state: BuilderProgramState, referencedPath: Path, seenFileAndExportsOfFile: Map<true>) {
227228
return forEachEntry(state.referencedMap!, (referencesInFile, filePath) =>
228-
referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOf(state, filePath as Path)
229+
referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath as Path, seenFileAndExportsOfFile)
230+
);
231+
}
232+
233+
/**
234+
* Removes semantic diagnostics of file and anything that exports this file
235+
*/
236+
function removeSemanticDiagnosticsOfFileAndExportsOfFile(state: BuilderProgramState, filePath: Path, seenFileAndExportsOfFile: Map<true>): boolean {
237+
if (!addToSeen(seenFileAndExportsOfFile, filePath)) {
238+
return false;
239+
}
240+
241+
if (removeSemanticDiagnosticsOf(state, filePath)) {
242+
// If there are no more diagnostics from old cache, done
243+
return true;
244+
}
245+
246+
Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
247+
// Go through exported modules from cache first
248+
// If exported modules has path, all files referencing file exported from are affected
249+
if (forEachEntry(state.currentAffectedFilesExportedModulesMap!, (exportedModules, exportedFromPath) =>
250+
exportedModules &&
251+
exportedModules.has(filePath) &&
252+
removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath as Path, seenFileAndExportsOfFile)
253+
)) {
254+
return true;
255+
}
256+
257+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
258+
return !!forEachEntry(state.exportedModulesMap!, (exportedModules, exportedFromPath) =>
259+
!state.currentAffectedFilesExportedModulesMap!.has(exportedFromPath) && // If we already iterated this through cache, ignore it
260+
exportedModules.has(filePath) &&
261+
removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath as Path, seenFileAndExportsOfFile)
229262
);
230263
}
231264

@@ -417,7 +450,7 @@ namespace ts {
417450
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
418451
if (!targetSourceFile) {
419452
// Emit and report any errors we ran into.
420-
let sourceMaps: SourceMapData[] = [];
453+
let sourceMaps: SourceMapEmitResult[] = [];
421454
let emitSkipped = false;
422455
let diagnostics: Diagnostic[] | undefined;
423456
let emittedFiles: string[] = [];

0 commit comments

Comments
 (0)