Skip to content

Commit 04949a0

Browse files
committed
Merge remote-tracking branch 'origin/master' into properExternalModules
2 parents 297c60e + b71969e commit 04949a0

114 files changed

Lines changed: 2072 additions & 246 deletions

File tree

Some content is hidden

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

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4640,7 +4640,9 @@ namespace ts {
46404640
// and intersection types are further deconstructed on the target side, we don't want to
46414641
// make the check again (as it might fail for a partial target type). Therefore we obtain
46424642
// the regular source type and proceed with that.
4643-
source = getRegularTypeOfObjectLiteral(source);
4643+
if (target.flags & TypeFlags.UnionOrIntersection) {
4644+
source = getRegularTypeOfObjectLiteral(source);
4645+
}
46444646
}
46454647

46464648
let saveErrorInfo = errorInfo;
@@ -5511,6 +5513,7 @@ namespace ts {
55115513
regularType.constructSignatures = (<ResolvedType>type).constructSignatures;
55125514
regularType.stringIndexType = (<ResolvedType>type).stringIndexType;
55135515
regularType.numberIndexType = (<ResolvedType>type).numberIndexType;
5516+
(<FreshObjectLiteralType>type).regularType = regularType;
55145517
}
55155518
return regularType;
55165519
}

src/compiler/emitter.ts

Lines changed: 96 additions & 51 deletions
Large diffs are not rendered by default.

src/compiler/parser.ts

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,11 +1058,11 @@ namespace ts {
10581058
}
10591059

10601060
function parseIdentifierName(): Identifier {
1061-
return createIdentifier(isIdentifierOrKeyword());
1061+
return createIdentifier(tokenIsIdentifierOrKeyword(token));
10621062
}
10631063

10641064
function isLiteralPropertyName(): boolean {
1065-
return isIdentifierOrKeyword() ||
1065+
return tokenIsIdentifierOrKeyword(token) ||
10661066
token === SyntaxKind.StringLiteral ||
10671067
token === SyntaxKind.NumericLiteral;
10681068
}
@@ -1086,7 +1086,7 @@ namespace ts {
10861086
}
10871087

10881088
function isSimplePropertyName() {
1089-
return token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || isIdentifierOrKeyword();
1089+
return token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral || tokenIsIdentifierOrKeyword(token);
10901090
}
10911091

10921092
function parseComputedPropertyName(): ComputedPropertyName {
@@ -1213,9 +1213,9 @@ namespace ts {
12131213
case ParsingContext.HeritageClauses:
12141214
return isHeritageClause();
12151215
case ParsingContext.ImportOrExportSpecifiers:
1216-
return isIdentifierOrKeyword();
1216+
return tokenIsIdentifierOrKeyword(token);
12171217
case ParsingContext.JsxAttributes:
1218-
return isIdentifierOrKeyword() || token === SyntaxKind.OpenBraceToken;
1218+
return tokenIsIdentifierOrKeyword(token) || token === SyntaxKind.OpenBraceToken;
12191219
case ParsingContext.JsxChildren:
12201220
return true;
12211221
case ParsingContext.JSDocFunctionParameters:
@@ -1254,7 +1254,7 @@ namespace ts {
12541254

12551255
function nextTokenIsIdentifierOrKeyword() {
12561256
nextToken();
1257-
return isIdentifierOrKeyword();
1257+
return tokenIsIdentifierOrKeyword(token);
12581258
}
12591259

12601260
function isHeritageClauseExtendsOrImplementsKeyword(): boolean {
@@ -1824,7 +1824,7 @@ namespace ts {
18241824
// the code would be implicitly: "name.identifierOrKeyword; identifierNameOrKeyword".
18251825
// In the first case though, ASI will not take effect because there is not a
18261826
// line terminator after the identifier or keyword.
1827-
if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) {
1827+
if (scanner.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token)) {
18281828
let matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
18291829

18301830
if (matchesPattern) {
@@ -2282,7 +2282,7 @@ namespace ts {
22822282
}
22832283
}
22842284

2285-
if (isIdentifierOrKeyword()) {
2285+
if (tokenIsIdentifierOrKeyword(token)) {
22862286
return parsePropertyOrMethodSignature();
22872287
}
22882288
}
@@ -4101,13 +4101,9 @@ namespace ts {
41014101
}
41024102
}
41034103

4104-
function isIdentifierOrKeyword() {
4105-
return token >= SyntaxKind.Identifier;
4106-
}
4107-
41084104
function nextTokenIsIdentifierOrKeywordOnSameLine() {
41094105
nextToken();
4110-
return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak();
4106+
return tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak();
41114107
}
41124108

41134109
function nextTokenIsFunctionKeywordOnSameLine() {
@@ -4117,7 +4113,7 @@ namespace ts {
41174113

41184114
function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() {
41194115
nextToken();
4120-
return (isIdentifierOrKeyword() || token === SyntaxKind.NumericLiteral) && !scanner.hasPrecedingLineBreak();
4116+
return (tokenIsIdentifierOrKeyword(token) || token === SyntaxKind.NumericLiteral) && !scanner.hasPrecedingLineBreak();
41214117
}
41224118

41234119
function isDeclaration(): boolean {
@@ -4170,7 +4166,7 @@ namespace ts {
41704166
case SyntaxKind.ImportKeyword:
41714167
nextToken();
41724168
return token === SyntaxKind.StringLiteral || token === SyntaxKind.AsteriskToken ||
4173-
token === SyntaxKind.OpenBraceToken || isIdentifierOrKeyword();
4169+
token === SyntaxKind.OpenBraceToken || tokenIsIdentifierOrKeyword(token);
41744170
case SyntaxKind.ExportKeyword:
41754171
nextToken();
41764172
if (token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
@@ -4777,7 +4773,7 @@ namespace ts {
47774773

47784774
// It is very important that we check this *after* checking indexers because
47794775
// the [ token can start an index signature or a computed property name
4780-
if (isIdentifierOrKeyword() ||
4776+
if (tokenIsIdentifierOrKeyword(token) ||
47814777
token === SyntaxKind.StringLiteral ||
47824778
token === SyntaxKind.NumericLiteral ||
47834779
token === SyntaxKind.AsteriskToken ||
@@ -5320,7 +5316,7 @@ namespace ts {
53205316
return true;
53215317
}
53225318

5323-
return isIdentifierOrKeyword();
5319+
return tokenIsIdentifierOrKeyword(token);
53245320
}
53255321

53265322
export function parseJSDocTypeExpressionForTests(content: string, start: number, length: number) {

0 commit comments

Comments
 (0)