Skip to content

Commit 813f28a

Browse files
committed
Merge branch 'master' into strictParameter
2 parents cdfef4f + 9c9f3e3 commit 813f28a

File tree

4,231 files changed

+12917
-62717
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,231 files changed

+12917
-62717
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Please fill in the *entire* template below.
1616
-->
1717

1818
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
19-
**TypeScript Version:** 3.0.0-dev.201xxxxx
19+
**TypeScript Version:** 3.1.0-dev.201xxxxx
2020

2121
<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
22-
**Search Terms:**
22+
**Search Terms:**
2323

2424
**Code**
2525

@@ -32,6 +32,6 @@ Please fill in the *entire* template below.
3232

3333
**Actual behavior:**
3434

35-
**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->
35+
**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->
3636

3737
**Related Issues:** <!-- Did you find other bugs that looked similar? -->

.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: 8 additions & 2 deletions
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());
@@ -817,7 +823,7 @@ function diagnosticsToString(diagnostics, pretty) {
817823
* Concatenate a list of sourceFiles to a destinationFile
818824
* @param {string} destinationFile
819825
* @param {string[]} sourceFiles
820-
* @param {string} extraContent
826+
* @param {string=} extraContent
821827
*/
822828
function concatenateFiles(destinationFile, sourceFiles, extraContent) {
823829
var temp = "temptemp";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "http://typescriptlang.org/",
5-
"version": "3.0.0",
5+
"version": "3.1.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [

src/compiler/binder.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ namespace ts {
306306
}
307307

308308
function getDisplayName(node: Declaration): string {
309-
return isNamedDeclaration(node) ? declarationNameToString(node.name) : unescapeLeadingUnderscores(getDeclarationName(node)!); // TODO: GH#18217
309+
return isNamedDeclaration(node) ? declarationNameToString(node.name) : unescapeLeadingUnderscores(Debug.assertDefined(getDeclarationName(node)));
310310
}
311311

312312
/**
@@ -383,9 +383,11 @@ namespace ts {
383383
let message = symbol.flags & SymbolFlags.BlockScopedVariable
384384
? Diagnostics.Cannot_redeclare_block_scoped_variable_0
385385
: Diagnostics.Duplicate_identifier_0;
386+
let messageNeedsName = true;
386387

387388
if (symbol.flags & SymbolFlags.Enum || includes & SymbolFlags.Enum) {
388389
message = Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
390+
messageNeedsName = false;
389391
}
390392

391393
if (symbol.declarations && symbol.declarations.length) {
@@ -394,6 +396,7 @@ namespace ts {
394396
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
395397
if (isDefaultExport) {
396398
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
399+
messageNeedsName = false;
397400
}
398401
else {
399402
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
@@ -403,14 +406,16 @@ namespace ts {
403406
if (symbol.declarations && symbol.declarations.length &&
404407
(node.kind === SyntaxKind.ExportAssignment && !(<ExportAssignment>node).isExportEquals)) {
405408
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
409+
messageNeedsName = false;
406410
}
407411
}
408412
}
409413

410-
forEach(symbol.declarations, declaration => {
411-
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(declaration) || declaration, message, getDisplayName(declaration)));
412-
});
413-
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(node) || node, message, getDisplayName(node)));
414+
const addError = (decl: Declaration): void => {
415+
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(decl) || decl, message, messageNeedsName ? getDisplayName(decl) : undefined));
416+
};
417+
forEach(symbol.declarations, addError);
418+
addError(node);
414419

415420
symbol = createSymbol(SymbolFlags.None, name);
416421
}
@@ -1913,6 +1918,15 @@ namespace ts {
19131918
}
19141919
}
19151920

1921+
function checkStrictModeLabeledStatement(node: LabeledStatement) {
1922+
// Grammar checking for labeledStatement
1923+
if (inStrictMode && options.target! >= ScriptTarget.ES2015) {
1924+
if (isDeclarationStatement(node.statement) || isVariableStatement(node.statement)) {
1925+
errorOnFirstToken(node.label, Diagnostics.A_label_is_not_allowed_here);
1926+
}
1927+
}
1928+
}
1929+
19161930
function errorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any) {
19171931
const span = getSpanOfTokenAtPosition(file, node.pos);
19181932
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
@@ -2058,6 +2072,13 @@ namespace ts {
20582072
if (isSpecialPropertyDeclaration(node as PropertyAccessExpression)) {
20592073
bindSpecialPropertyDeclaration(node as PropertyAccessExpression);
20602074
}
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+
}
20612082
break;
20622083
case SyntaxKind.BinaryExpression:
20632084
const specialKind = getSpecialPropertyAssignmentKind(node as BinaryExpression);
@@ -2099,6 +2120,8 @@ namespace ts {
20992120
return checkStrictModePrefixUnaryExpression(<PrefixUnaryExpression>node);
21002121
case SyntaxKind.WithStatement:
21012122
return checkStrictModeWithStatement(<WithStatement>node);
2123+
case SyntaxKind.LabeledStatement:
2124+
return checkStrictModeLabeledStatement(<LabeledStatement>node);
21022125
case SyntaxKind.ThisType:
21032126
seenThisKeyword = true;
21042127
return;

0 commit comments

Comments
 (0)