Skip to content

Commit 79e2628

Browse files
author
Andy Hanson
committed
Merge branch 'master' into countPathComponents
2 parents 2386f27 + 639fdcc commit 79e2628

File tree

4,337 files changed

+17332
-65288
lines changed

Some content is hidden

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

4,337 files changed

+17332
-65288
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,5 @@ tests/cases/user/*/**/*.d.ts
7474
!tests/cases/user/bignumber.js/
7575
!tests/cases/user/discord.js/
7676
tests/baselines/reference/dt
77-
.failed-tests
77+
.failed-tests
78+
TEST-results.xml

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,4 @@ Vyacheslav Pukhanov <[email protected]>
358358
dangoo <[email protected]> # Daniel Gooss
359359
krk <[email protected]> # Kerem Kat
360360
micnic <[email protected]> # Nicu Micleușanu
361+
rflorian <[email protected]> # @rflorian

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ Jakefile.js
1919
.circleci
2020
.vscode/
2121
.parallelperf.json
22+
.mailmap
2223
test.config
2324
package-lock.json
2425
yarn.lock
2526
.github/
2627
CONTRIBUTING.md
28+
TEST-results.xml

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Design changes will not be accepted at this time. If you have a design change pr
6161

6262
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
6363

64-
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request.
64+
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request.
6565

6666
## Housekeeping
6767

Jakefile.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ const TaskNames = {
5151
configureInsiders: "configure-insiders",
5252
publishInsiders: "publish-insiders",
5353
configureNightly: "configure-nightly",
54-
publishNightly: "publish-nightly"
54+
publishNightly: "publish-nightly",
55+
help: "help"
5556
};
5657

5758
const Paths = {};
@@ -258,6 +259,11 @@ task(TaskNames.publishNightly, [TaskNames.coreBuild, TaskNames.configureNightly,
258259
exec(cmd, () => complete());
259260
}, { async: true });
260261

262+
task(TaskNames.help, function() {
263+
var cmd = "jake --tasks";
264+
exec(cmd, () => complete());
265+
})
266+
261267
task(TaskNames.configureInsiders, [TaskNames.scripts], function () {
262268
const cmd = `${host} ${Paths.scripts.configurePrerelease} insiders ${Paths.packageJson} ${Paths.versionFile}`;
263269
exec(cmd, () => complete());

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
99

10-
[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescriptlang).
10+
[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescriptlang).
1111

1212
## Installing
1313

ThirdPartyNoticeText.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,30 @@ For purposes of this definition, the normative portions of the Specification sha
164164
I am encouraged to provide a contact from which licensing information can be obtained and other relevant licensing information. Any such information will be made publicly available.
165165
10.8. You or Your. �You,� �you,� or �your� means any person or entity who exercises copyright or patent rights granted under this Agreement, and any person that person or entity controls.
166166

167+
-------------------------------------------------------------------------------------
168+
169+
------------------- WebGL -----------------------------
170+
Copyright (c) 2018 The Khronos Group Inc.
171+
172+
Permission is hereby granted, free of charge, to any person obtaining a
173+
copy of this software and/or associated documentation files (the
174+
"Materials"), to deal in the Materials without restriction, including
175+
without limitation the rights to use, copy, modify, merge, publish,
176+
distribute, sublicense, and/or sell copies of the Materials, and to
177+
permit persons to whom the Materials are furnished to do so, subject to
178+
the following conditions:
179+
180+
The above copyright notice and this permission notice shall be included
181+
in all copies or substantial portions of the Materials.
182+
183+
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
184+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
185+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
186+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
187+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
188+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
189+
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
190+
------------------------------------------------------
191+
167192
------------- End of ThirdPartyNotices ------------------------------------------- */
168193

scripts/failed-tests.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class FailedTestsReporter extends Mocha.reporters.Base {
4646
}
4747

4848
const newOptions = Object.assign({}, options, { reporterOptions: reporterOptions.reporterOptions || {} });
49+
if (reporterOptions.reporter === "xunit") {
50+
newOptions.reporterOptions.output = "TEST-results.xml";
51+
}
4952
this.reporter = new reporter(runner, newOptions);
5053
}
5154

scripts/open-user-pr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function padNum(number: number) {
1616
}
1717

1818
const userName = process.env.GH_USERNAME;
19-
const reviewers = ["weswigham", "sandersn", "mhegazy"]
19+
const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"]
2020
const now = new Date();
2121
const branchName = `user-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`;
2222
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;

src/compiler/binder.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,13 @@ namespace ts {
20722072
if (isSpecialPropertyDeclaration(node as PropertyAccessExpression)) {
20732073
bindSpecialPropertyDeclaration(node as PropertyAccessExpression);
20742074
}
2075+
if (isInJavaScriptFile(node) &&
2076+
file.commonJsModuleIndicator &&
2077+
isModuleExportsPropertyAccessExpression(node as PropertyAccessExpression) &&
2078+
!lookupSymbolForNameWorker(container, "module" as __String)) {
2079+
declareSymbol(container.locals!, /*parent*/ undefined, (node as PropertyAccessExpression).expression as Identifier,
2080+
SymbolFlags.FunctionScopedVariable | SymbolFlags.ModuleExports, SymbolFlags.FunctionScopedVariableExcludes);
2081+
}
20752082
break;
20762083
case SyntaxKind.BinaryExpression:
20772084
const specialKind = getSpecialPropertyAssignmentKind(node as BinaryExpression);

src/compiler/builder.ts

Lines changed: 79 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,18 @@ namespace ts {
3030
* These will be commited whenever the iteration through affected files of current changed file is complete
3131
*/
3232
currentAffectedFilesSignatures: Map<string> | undefined;
33+
/**
34+
* Newly computed visible to outside referencedSet
35+
*/
36+
currentAffectedFilesExportedModulesMap: BuilderState.ComputingExportedModulesMap | undefined;
3337
/**
3438
* Already seen affected files
3539
*/
3640
seenAffectedFiles: Map<true> | undefined;
41+
/**
42+
* True if the semantic diagnostics were copied from the old state
43+
*/
44+
semanticDiagnosticsFromOldState?: Map<true>;
3745
/**
3846
* program corresponding to this state
3947
*/
@@ -96,6 +104,10 @@ namespace ts {
96104
const diagnostics = oldState!.semanticDiagnosticsPerFile!.get(sourceFilePath);
97105
if (diagnostics) {
98106
state.semanticDiagnosticsPerFile!.set(sourceFilePath, diagnostics);
107+
if (!state.semanticDiagnosticsFromOldState) {
108+
state.semanticDiagnosticsFromOldState = createMap<true>();
109+
}
110+
state.semanticDiagnosticsFromOldState.set(sourceFilePath, true);
99111
}
100112
}
101113
});
@@ -120,17 +132,17 @@ namespace ts {
120132
while (true) {
121133
const { affectedFiles } = state;
122134
if (affectedFiles) {
123-
const { seenAffectedFiles, semanticDiagnosticsPerFile } = state;
135+
const seenAffectedFiles = state.seenAffectedFiles!;
124136
let affectedFilesIndex = state.affectedFilesIndex!; // TODO: GH#18217
125137
while (affectedFilesIndex < affectedFiles.length) {
126138
const affectedFile = affectedFiles[affectedFilesIndex];
127-
if (!seenAffectedFiles!.has(affectedFile.path)) {
139+
if (!seenAffectedFiles.has(affectedFile.path)) {
128140
// Set the next affected file as seen and remove the cached semantic diagnostics
129141
state.affectedFilesIndex = affectedFilesIndex;
130-
semanticDiagnosticsPerFile!.delete(affectedFile.path);
142+
cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile);
131143
return affectedFile;
132144
}
133-
seenAffectedFiles!.set(affectedFile.path, true);
145+
seenAffectedFiles.set(affectedFile.path, true);
134146
affectedFilesIndex++;
135147
}
136148

@@ -140,6 +152,7 @@ namespace ts {
140152
// Commit the changes in file signature
141153
BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures!);
142154
state.currentAffectedFilesSignatures!.clear();
155+
BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
143156
state.affectedFiles = undefined;
144157
}
145158

@@ -160,14 +173,74 @@ namespace ts {
160173

161174
// Get next batch of affected files
162175
state.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures || createMap();
163-
state.affectedFiles = BuilderState.getFilesAffectedBy(state, state.program, nextKey.value as Path, cancellationToken, computeHash, state.currentAffectedFilesSignatures);
176+
if (state.exportedModulesMap) {
177+
state.currentAffectedFilesExportedModulesMap = state.currentAffectedFilesExportedModulesMap || createMap<BuilderState.ReferencedSet | false>();
178+
}
179+
state.affectedFiles = BuilderState.getFilesAffectedBy(state, state.program, nextKey.value as Path, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
164180
state.currentChangedFilePath = nextKey.value as Path;
165-
state.semanticDiagnosticsPerFile!.delete(nextKey.value as Path);
166181
state.affectedFilesIndex = 0;
167182
state.seenAffectedFiles = state.seenAffectedFiles || createMap<true>();
168183
}
169184
}
170185

186+
/**
187+
* Remove the semantic diagnostics cached from old state for affected File and the files that are referencing modules that export entities from affected file
188+
*/
189+
function cleanSemanticDiagnosticsOfAffectedFile(state: BuilderProgramState, affectedFile: SourceFile) {
190+
if (removeSemanticDiagnosticsOf(state, affectedFile.path)) {
191+
// If there are no more diagnostics from old cache, done
192+
return;
193+
}
194+
195+
// If there was change in signature for the changed file,
196+
// then delete the semantic diagnostics for files that are affected by using exports of this module
197+
198+
if (!state.exportedModulesMap || state.affectedFiles!.length === 1 || !state.changedFilesSet.has(affectedFile.path)) {
199+
return;
200+
}
201+
202+
Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
203+
// Go through exported modules from cache first
204+
// If exported modules has path, all files referencing file exported from are affected
205+
if (forEachEntry(state.currentAffectedFilesExportedModulesMap!, (exportedModules, exportedFromPath) =>
206+
exportedModules &&
207+
exportedModules.has(affectedFile.path) &&
208+
removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath as Path)
209+
)) {
210+
return;
211+
}
212+
213+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
214+
forEachEntry(state.exportedModulesMap, (exportedModules, exportedFromPath) =>
215+
!state.currentAffectedFilesExportedModulesMap!.has(exportedFromPath) && // If we already iterated this through cache, ignore it
216+
exportedModules.has(affectedFile.path) &&
217+
removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath as Path)
218+
);
219+
}
220+
221+
/**
222+
* removes the semantic diagnostics of files referencing referencedPath and
223+
* returns true if there are no more semantic diagnostics from old state
224+
*/
225+
function removeSemanticDiagnosticsOfFilesReferencingPath(state: BuilderProgramState, referencedPath: Path) {
226+
return forEachEntry(state.referencedMap!, (referencesInFile, filePath) =>
227+
referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOf(state, filePath as Path)
228+
);
229+
}
230+
231+
/**
232+
* Removes semantic diagnostics for path and
233+
* returns true if there are no more semantic diagnostics from the old state
234+
*/
235+
function removeSemanticDiagnosticsOf(state: BuilderProgramState, path: Path) {
236+
if (!state.semanticDiagnosticsFromOldState) {
237+
return false;
238+
}
239+
state.semanticDiagnosticsFromOldState.delete(path);
240+
state.semanticDiagnosticsPerFile!.delete(path);
241+
return !state.semanticDiagnosticsFromOldState.size;
242+
}
243+
171244
/**
172245
* This is called after completing operation on the next affected file.
173246
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly

0 commit comments

Comments
 (0)