Skip to content

Commit fc10eb7

Browse files
authoredJul 1, 2016
Merge master into release branch 06/30 (#9447)
* do not format comma/closeparen in jsxelement * format jsx expression * make rules optional * Remove upper boilerplate from issue template Our issue stats did not improve appreciably when we added the issue template. Reduce upper boilerplate text and try to make it more action-oriented * Update issue_template.md * new options should be optional for compatibility * Add getCurrentDirectory to ServerHost * Add nullchecks for typeRoots, remove getCurrentDirectory from ServerHost as it is always the installation location * VarDate interface and relevant Date.prototype members * Fix 9363: Object destructuring broken-variables are bound to the wrong object (#9383) * Fix emit incorrect destructuring mapping in var declaration * Add tests and baselines * Add additional tests and baselines * Fix crash in async functions when targetting ES5. When targetting ES5 and with --noImplicitReturns, an async function whose return type could not be determined would cause a compiler crash. * Add This type to lib * getVarDate should be on the Date interface * Don't emit source files found under node_modules * Destructuring assignment removes undefined from type when default value is given * Add nullcheck when calculating indentations for implort clause * Add test * Dont load JavaScript if types packages are present * Renamed API * Use checkExpression, not checkExpressionCached * Show "<unknown>" if the name of a declaration is unavailable * Parse `export default async function` as a declaration * Removed one error to avoid full path issues * Fix incorrectly-saved quote symbols in ThirdPartyNoticeText.txt
1 parent f7c9a77 commit fc10eb7

20 files changed

+2216
-2063
lines changed
 

Diff for: ‎ThirdPartyNoticeText.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Third Party Code Components
2121
--------------------------------------------
2222

2323
------------------- DefinitelyTyped --------------------
24-
This file is based on or incorporates material from the projects listed below (collectively ?Third Party Code?). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise.
24+
This file is based on or incorporates material from the projects listed below (collectively "Third Party Code"). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise.
2525
DefinitelyTyped
2626
This project is licensed under the MIT license.
2727
Copyrights are respective of each contributor listed at the beginning of each definition file.

Diff for: ‎src/compiler/checker.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -12544,6 +12544,12 @@ namespace ts {
1254412544
if (exprOrAssignment.kind === SyntaxKind.ShorthandPropertyAssignment) {
1254512545
const prop = <ShorthandPropertyAssignment>exprOrAssignment;
1254612546
if (prop.objectAssignmentInitializer) {
12547+
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
12548+
// undefined from the final type.
12549+
if (strictNullChecks &&
12550+
!(getCombinedTypeFlags(checkExpression(prop.objectAssignmentInitializer)) & TypeFlags.Undefined)) {
12551+
sourceType = getTypeWithFacts(sourceType, TypeFacts.NEUndefined);
12552+
}
1254712553
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper);
1254812554
}
1254912555
target = (<ShorthandPropertyAssignment>exprOrAssignment).name;
@@ -15450,7 +15456,7 @@ namespace ts {
1545015456

1545115457
function isUnwrappedReturnTypeVoidOrAny(func: FunctionLikeDeclaration, returnType: Type): boolean {
1545215458
const unwrappedReturnType = isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType;
15453-
return maybeTypeOfKind(unwrappedReturnType, TypeFlags.Void | TypeFlags.Any);
15459+
return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, TypeFlags.Void | TypeFlags.Any);
1545415460
}
1545515461

1545615462
function checkReturnStatement(node: ReturnStatement) {

Diff for: ‎src/compiler/parser.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1155,12 +1155,12 @@ namespace ts {
11551155
if (token === SyntaxKind.ExportKeyword) {
11561156
nextToken();
11571157
if (token === SyntaxKind.DefaultKeyword) {
1158-
return lookAhead(nextTokenIsClassOrFunction);
1158+
return lookAhead(nextTokenIsClassOrFunctionOrAsync);
11591159
}
11601160
return token !== SyntaxKind.AsteriskToken && token !== SyntaxKind.AsKeyword && token !== SyntaxKind.OpenBraceToken && canFollowModifier();
11611161
}
11621162
if (token === SyntaxKind.DefaultKeyword) {
1163-
return nextTokenIsClassOrFunction();
1163+
return nextTokenIsClassOrFunctionOrAsync();
11641164
}
11651165
if (token === SyntaxKind.StaticKeyword) {
11661166
nextToken();
@@ -1182,9 +1182,9 @@ namespace ts {
11821182
|| isLiteralPropertyName();
11831183
}
11841184

1185-
function nextTokenIsClassOrFunction(): boolean {
1185+
function nextTokenIsClassOrFunctionOrAsync(): boolean {
11861186
nextToken();
1187-
return token === SyntaxKind.ClassKeyword || token === SyntaxKind.FunctionKeyword;
1187+
return token === SyntaxKind.ClassKeyword || token === SyntaxKind.FunctionKeyword || token === SyntaxKind.AsyncKeyword;
11881188
}
11891189

11901190
// True if positioned at the start of a list element
@@ -5070,7 +5070,7 @@ namespace ts {
50705070
* In such situations, 'permitInvalidConstAsModifier' should be set to true.
50715071
*/
50725072
function parseModifiers(permitInvalidConstAsModifier?: boolean): ModifiersArray {
5073-
let flags = 0;
5073+
let flags: NodeFlags = 0;
50745074
let modifiers: ModifiersArray;
50755075
while (true) {
50765076
const modifierStart = scanner.getStartPos();

Diff for: ‎src/compiler/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ namespace ts {
469469
}
470470

471471
export interface ModifiersArray extends NodeArray<Modifier> {
472-
flags: number;
472+
flags: NodeFlags;
473473
}
474474

475475
// @kind(SyntaxKind.AbstractKeyword)

0 commit comments

Comments
 (0)