Skip to content

Commit a81c55f

Browse files
committed
Merge branch 'master' into deprecated_support
2 parents ccb6301 + 6c7697a commit a81c55f

File tree

58 files changed

+1973
-324
lines changed

Some content is hidden

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

58 files changed

+1973
-324
lines changed

src/compiler/binder.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ namespace ts {
987987
return initFlowNode({ flags: FlowFlags.SwitchClause, antecedent, switchStatement, clauseStart, clauseEnd });
988988
}
989989

990-
function createFlowMutation(flags: FlowFlags, antecedent: FlowNode, node: Node): FlowNode {
990+
function createFlowMutation(flags: FlowFlags, antecedent: FlowNode, node: Expression | VariableDeclaration | ArrayBindingElement): FlowNode {
991991
setFlowNodeReferenced(antecedent);
992992
const result = initFlowNode({ flags, antecedent, node });
993993
if (currentExceptionTarget) {
@@ -1343,7 +1343,7 @@ namespace ts {
13431343
// is potentially an assertion and is therefore included in the control flow.
13441344
if (node.expression.kind === SyntaxKind.CallExpression) {
13451345
const call = <CallExpression>node.expression;
1346-
if (isDottedName(call.expression)) {
1346+
if (isDottedName(call.expression) && call.expression.kind !== SyntaxKind.SuperKeyword) {
13471347
currentFlow = createFlowCall(currentFlow, call);
13481348
}
13491349
}
@@ -1749,6 +1749,9 @@ namespace ts {
17491749
}
17501750
else {
17511751
bindEachChild(node);
1752+
if (node.expression.kind === SyntaxKind.SuperKeyword) {
1753+
currentFlow = createFlowCall(currentFlow, node);
1754+
}
17521755
}
17531756
}
17541757
if (node.expression.kind === SyntaxKind.PropertyAccessExpression) {
@@ -2466,6 +2469,9 @@ namespace ts {
24662469
node.flowNode = currentFlow;
24672470
}
24682471
return checkStrictModeIdentifier(<Identifier>node);
2472+
case SyntaxKind.SuperKeyword:
2473+
node.flowNode = currentFlow;
2474+
break;
24692475
case SyntaxKind.PrivateIdentifier:
24702476
return checkPrivateIdentifier(node as PrivateIdentifier);
24712477
case SyntaxKind.PropertyAccessExpression:

src/compiler/checker.ts

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

src/compiler/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ namespace ts {
150150
* returns a falsey value, then returns false.
151151
* If no such value is found, the callback is applied to each element of array and `true` is returned.
152152
*/
153-
export function every<T>(array: readonly T[], callback: (element: T, index: number) => boolean): boolean {
153+
export function every<T>(array: readonly T[] | undefined, callback: (element: T, index: number) => boolean): boolean {
154154
if (array) {
155155
for (let i = 0; i < array.length; i++) {
156156
if (!callback(array[i], i)) {

src/compiler/transformers/es2015.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,7 @@ namespace ts {
25832583
&& i < numInitialPropertiesWithoutYield) {
25842584
numInitialPropertiesWithoutYield = i;
25852585
}
2586-
if (property.name!.kind === SyntaxKind.ComputedPropertyName) {
2586+
if (Debug.checkDefined(property.name).kind === SyntaxKind.ComputedPropertyName) {
25872587
numInitialProperties = i;
25882588
break;
25892589
}

src/compiler/transformers/taggedTemplate.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ts {
88
export function processTaggedTemplateExpression(
99
context: TransformationContext,
1010
node: TaggedTemplateExpression,
11-
visitor: ((node: Node) => VisitResult<Node>) | undefined,
11+
visitor: Visitor,
1212
currentSourceFile: SourceFile,
1313
recordTaggedTemplateString: (temp: Identifier) => void,
1414
level: ProcessLevel) {
@@ -24,7 +24,9 @@ namespace ts {
2424
const rawStrings: Expression[] = [];
2525
const template = node.template;
2626

27-
if (level === ProcessLevel.LiftRestriction && !hasInvalidEscape(template)) return node;
27+
if (level === ProcessLevel.LiftRestriction && !hasInvalidEscape(template)) {
28+
return visitEachChild(node, visitor, context);
29+
}
2830

2931
if (isNoSubstitutionTemplateLiteral(template)) {
3032
cookedStrings.push(createTemplateCooked(template));

src/compiler/types.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,34 +2796,21 @@ namespace ts {
27962796
}
27972797

27982798
export type FlowNode =
2799-
| AfterFinallyFlow
2800-
| PreFinallyFlow
28012799
| FlowStart
28022800
| FlowLabel
28032801
| FlowAssignment
28042802
| FlowCall
28052803
| FlowCondition
28062804
| FlowSwitchClause
2807-
| FlowArrayMutation;
2805+
| FlowArrayMutation
2806+
| FlowCall
2807+
| FlowReduceLabel;
28082808

28092809
export interface FlowNodeBase {
28102810
flags: FlowFlags;
28112811
id?: number; // Node id used by flow type cache in checker
28122812
}
28132813

2814-
export interface FlowLock {
2815-
locked?: boolean;
2816-
}
2817-
2818-
export interface AfterFinallyFlow extends FlowNodeBase, FlowLock {
2819-
antecedent: FlowNode;
2820-
}
2821-
2822-
export interface PreFinallyFlow extends FlowNodeBase {
2823-
antecedent: FlowNode;
2824-
lock: FlowLock;
2825-
}
2826-
28272814
// FlowStart represents the start of a control flow. For a function expression or arrow
28282815
// function, the node property references the function (which in turn has a flowNode
28292816
// property for the containing control flow).
@@ -4322,8 +4309,6 @@ namespace ts {
43224309
resolvedJsxElementAttributesType?: Type; // resolved element attributes type of a JSX openinglike element
43234310
resolvedJsxElementAllAttributesType?: Type; // resolved all element attributes type of a JSX openinglike element
43244311
resolvedJSDocType?: Type; // Resolved type of a JSDoc type reference
4325-
hasSuperCall?: boolean; // recorded result when we try to find super-call. We only try to find one if this flag is undefined, indicating that we haven't made an attempt.
4326-
superCall?: SuperCall; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
43274312
switchTypes?: Type[]; // Cached array of switch case expression types
43284313
jsxNamespace?: Symbol | false; // Resolved jsx namespace symbol for this node
43294314
contextFreeType?: Type; // Cached context-free type used by the first pass of inference; used when a function's return is partially contextually sensitive

src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@
4848
</Str>
4949
<Disp Icon="Str" />
5050
</Item>
51+
<Item ItemId=";A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033" ItemType="0" PsrId="306" Leaf="true">
52+
<Str Cat="Text">
53+
<Val><![CDATA[A JSDoc '@typedef' comment may not contain multiple '@type' tags.]]></Val>
54+
<Tgt Cat="Text" Stat="Loc" Orig="New">
55+
<Val><![CDATA[JSDoc "@typedef" 注释不能包含多个 "@type" 标记。]]></Val>
56+
</Tgt>
57+
</Str>
58+
<Disp Icon="Str" />
59+
</Item>
5160
<Item ItemId=";A_bigint_literal_cannot_use_exponential_notation_1352" ItemType="0" PsrId="306" Leaf="true">
5261
<Str Cat="Text">
5362
<Val><![CDATA[A bigint literal cannot use exponential notation.]]></Val>
@@ -3720,6 +3729,9 @@
37203729
<Item ItemId=";Declare_private_method_0_90038" ItemType="0" PsrId="306" Leaf="true">
37213730
<Str Cat="Text">
37223731
<Val><![CDATA[Declare private method '{0}']]></Val>
3732+
<Tgt Cat="Text" Stat="Loc" Orig="New">
3733+
<Val><![CDATA[声明私有方法 "{0}"]]></Val>
3734+
</Tgt>
37233735
</Str>
37243736
<Disp Icon="Str" />
37253737
</Item>
@@ -8610,15 +8622,6 @@
86108622
</Str>
86118623
<Disp Icon="Str" />
86128624
</Item>
8613-
<Item ItemId=";Remove_all_incorrect_body_block_braces_95115" ItemType="0" PsrId="306" Leaf="true">
8614-
<Str Cat="Text">
8615-
<Val><![CDATA[Remove all incorrect body block braces]]></Val>
8616-
<Tgt Cat="Text" Stat="Loc" Orig="New">
8617-
<Val><![CDATA[删除所有错误的正文块括号]]></Val>
8618-
</Tgt>
8619-
</Str>
8620-
<Disp Icon="Str" />
8621-
</Item>
86228625
<Item ItemId=";Remove_all_unnecessary_uses_of_await_95087" ItemType="0" PsrId="306" Leaf="true">
86238626
<Str Cat="Text">
86248627
<Val><![CDATA[Remove all unnecessary uses of 'await']]></Val>
@@ -8646,12 +8649,9 @@
86468649
</Str>
86478650
<Disp Icon="Str" />
86488651
</Item>
8649-
<Item ItemId=";Remove_block_body_braces_95112" ItemType="0" PsrId="306" Leaf="true">
8652+
<Item ItemId=";Remove_braces_from_all_arrow_function_bodies_with_relevant_issues_95115" ItemType="0" PsrId="306" Leaf="true">
86508653
<Str Cat="Text">
8651-
<Val><![CDATA[Remove block body braces]]></Val>
8652-
<Tgt Cat="Text" Stat="Loc" Orig="New">
8653-
<Val><![CDATA[删除块正文括号]]></Val>
8654-
</Tgt>
8654+
<Val><![CDATA[Remove braces from all arrow function bodies with relevant issues]]></Val>
86558655
</Str>
86568656
<Disp Icon="Str" />
86578657
</Item>
@@ -8664,6 +8664,12 @@
86648664
</Str>
86658665
<Disp Icon="Str" />
86668666
</Item>
8667+
<Item ItemId=";Remove_braces_from_arrow_function_body_95112" ItemType="0" PsrId="306" Leaf="true">
8668+
<Str Cat="Text">
8669+
<Val><![CDATA[Remove braces from arrow function body]]></Val>
8670+
</Str>
8671+
<Disp Icon="Str" />
8672+
</Item>
86678673
<Item ItemId=";Remove_destructuring_90009" ItemType="0" PsrId="306" Leaf="true">
86688674
<Str Cat="Text">
86698675
<Val><![CDATA[Remove destructuring]]></Val>
@@ -10389,6 +10395,15 @@
1038910395
</Str>
1039010396
<Disp Icon="Str" />
1039110397
</Item>
10398+
<Item ItemId=";The_tag_was_first_specified_here_8034" ItemType="0" PsrId="306" Leaf="true">
10399+
<Str Cat="Text">
10400+
<Val><![CDATA[The tag was first specified here.]]></Val>
10401+
<Tgt Cat="Text" Stat="Loc" Orig="New">
10402+
<Val><![CDATA[第一次在此处指定了标记。]]></Val>
10403+
</Tgt>
10404+
</Str>
10405+
<Disp Icon="Str" />
10406+
</Item>
1039210407
<Item ItemId=";The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541" ItemType="0" PsrId="306" Leaf="true">
1039310408
<Str Cat="Text">
1039410409
<Val><![CDATA[The target of an assignment must be a variable or a property access.]]></Val>

src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
</Str>
4949
<Disp Icon="Str" />
5050
</Item>
51+
<Item ItemId=";A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033" ItemType="0" PsrId="306" Leaf="true">
52+
<Str Cat="Text">
53+
<Val><![CDATA[A JSDoc '@typedef' comment may not contain multiple '@type' tags.]]></Val>
54+
</Str>
55+
<Disp Icon="Str" />
56+
</Item>
5157
<Item ItemId=";A_bigint_literal_cannot_use_exponential_notation_1352" ItemType="0" PsrId="306" Leaf="true">
5258
<Str Cat="Text">
5359
<Val><![CDATA[A bigint literal cannot use exponential notation.]]></Val>
@@ -3720,6 +3726,9 @@
37203726
<Item ItemId=";Declare_private_method_0_90038" ItemType="0" PsrId="306" Leaf="true">
37213727
<Str Cat="Text">
37223728
<Val><![CDATA[Declare private method '{0}']]></Val>
3729+
<Tgt Cat="Text" Stat="Loc" Orig="New">
3730+
<Val><![CDATA[宣告私人方法 '{0}']]></Val>
3731+
</Tgt>
37233732
</Str>
37243733
<Disp Icon="Str" />
37253734
</Item>
@@ -8610,15 +8619,6 @@
86108619
</Str>
86118620
<Disp Icon="Str" />
86128621
</Item>
8613-
<Item ItemId=";Remove_all_incorrect_body_block_braces_95115" ItemType="0" PsrId="306" Leaf="true">
8614-
<Str Cat="Text">
8615-
<Val><![CDATA[Remove all incorrect body block braces]]></Val>
8616-
<Tgt Cat="Text" Stat="Loc" Orig="New">
8617-
<Val><![CDATA[移除所有不正確的主體區塊大括弧]]></Val>
8618-
</Tgt>
8619-
</Str>
8620-
<Disp Icon="Str" />
8621-
</Item>
86228622
<Item ItemId=";Remove_all_unnecessary_uses_of_await_95087" ItemType="0" PsrId="306" Leaf="true">
86238623
<Str Cat="Text">
86248624
<Val><![CDATA[Remove all unnecessary uses of 'await']]></Val>
@@ -8646,12 +8646,9 @@
86468646
</Str>
86478647
<Disp Icon="Str" />
86488648
</Item>
8649-
<Item ItemId=";Remove_block_body_braces_95112" ItemType="0" PsrId="306" Leaf="true">
8649+
<Item ItemId=";Remove_braces_from_all_arrow_function_bodies_with_relevant_issues_95115" ItemType="0" PsrId="306" Leaf="true">
86508650
<Str Cat="Text">
8651-
<Val><![CDATA[Remove block body braces]]></Val>
8652-
<Tgt Cat="Text" Stat="Loc" Orig="New">
8653-
<Val><![CDATA[移除區塊主體大括弧]]></Val>
8654-
</Tgt>
8651+
<Val><![CDATA[Remove braces from all arrow function bodies with relevant issues]]></Val>
86558652
</Str>
86568653
<Disp Icon="Str" />
86578654
</Item>
@@ -8664,6 +8661,12 @@
86648661
</Str>
86658662
<Disp Icon="Str" />
86668663
</Item>
8664+
<Item ItemId=";Remove_braces_from_arrow_function_body_95112" ItemType="0" PsrId="306" Leaf="true">
8665+
<Str Cat="Text">
8666+
<Val><![CDATA[Remove braces from arrow function body]]></Val>
8667+
</Str>
8668+
<Disp Icon="Str" />
8669+
</Item>
86678670
<Item ItemId=";Remove_destructuring_90009" ItemType="0" PsrId="306" Leaf="true">
86688671
<Str Cat="Text">
86698672
<Val><![CDATA[Remove destructuring]]></Val>
@@ -10389,6 +10392,12 @@
1038910392
</Str>
1039010393
<Disp Icon="Str" />
1039110394
</Item>
10395+
<Item ItemId=";The_tag_was_first_specified_here_8034" ItemType="0" PsrId="306" Leaf="true">
10396+
<Str Cat="Text">
10397+
<Val><![CDATA[The tag was first specified here.]]></Val>
10398+
</Str>
10399+
<Disp Icon="Str" />
10400+
</Item>
1039210401
<Item ItemId=";The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541" ItemType="0" PsrId="306" Leaf="true">
1039310402
<Str Cat="Text">
1039410403
<Val><![CDATA[The target of an assignment must be a variable or a property access.]]></Val>

src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757
</Str>
5858
<Disp Icon="Str" />
5959
</Item>
60+
<Item ItemId=";A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033" ItemType="0" PsrId="306" Leaf="true">
61+
<Str Cat="Text">
62+
<Val><![CDATA[A JSDoc '@typedef' comment may not contain multiple '@type' tags.]]></Val>
63+
</Str>
64+
<Disp Icon="Str" />
65+
</Item>
6066
<Item ItemId=";A_bigint_literal_cannot_use_exponential_notation_1352" ItemType="0" PsrId="306" Leaf="true">
6167
<Str Cat="Text">
6268
<Val><![CDATA[A bigint literal cannot use exponential notation.]]></Val>
@@ -3726,6 +3732,15 @@
37263732
</Str>
37273733
<Disp Icon="Str" />
37283734
</Item>
3735+
<Item ItemId=";Declare_private_method_0_90038" ItemType="0" PsrId="306" Leaf="true">
3736+
<Str Cat="Text">
3737+
<Val><![CDATA[Declare private method '{0}']]></Val>
3738+
<Tgt Cat="Text" Stat="Loc" Orig="New">
3739+
<Val><![CDATA[Deklarovat privátní metodu {0}]]></Val>
3740+
</Tgt>
3741+
</Str>
3742+
<Disp Icon="Str" />
3743+
</Item>
37293744
<Item ItemId=";Declare_private_property_0_90035" ItemType="0" PsrId="306" Leaf="true">
37303745
<Str Cat="Text">
37313746
<Val><![CDATA[Declare private property '{0}']]></Val>
@@ -8613,15 +8628,6 @@
86138628
</Str>
86148629
<Disp Icon="Str" />
86158630
</Item>
8616-
<Item ItemId=";Remove_all_incorrect_body_block_braces_95115" ItemType="0" PsrId="306" Leaf="true">
8617-
<Str Cat="Text">
8618-
<Val><![CDATA[Remove all incorrect body block braces]]></Val>
8619-
<Tgt Cat="Text" Stat="Loc" Orig="New">
8620-
<Val><![CDATA[Odebrat všechny nesprávné závorky bloku kódu]]></Val>
8621-
</Tgt>
8622-
</Str>
8623-
<Disp Icon="Str" />
8624-
</Item>
86258631
<Item ItemId=";Remove_all_unnecessary_uses_of_await_95087" ItemType="0" PsrId="306" Leaf="true">
86268632
<Str Cat="Text">
86278633
<Val><![CDATA[Remove all unnecessary uses of 'await']]></Val>
@@ -8649,12 +8655,9 @@
86498655
</Str>
86508656
<Disp Icon="Str" />
86518657
</Item>
8652-
<Item ItemId=";Remove_block_body_braces_95112" ItemType="0" PsrId="306" Leaf="true">
8658+
<Item ItemId=";Remove_braces_from_all_arrow_function_bodies_with_relevant_issues_95115" ItemType="0" PsrId="306" Leaf="true">
86538659
<Str Cat="Text">
8654-
<Val><![CDATA[Remove block body braces]]></Val>
8655-
<Tgt Cat="Text" Stat="Loc" Orig="New">
8656-
<Val><![CDATA[Odebrat všechny závorky bloku kódu]]></Val>
8657-
</Tgt>
8660+
<Val><![CDATA[Remove braces from all arrow function bodies with relevant issues]]></Val>
86588661
</Str>
86598662
<Disp Icon="Str" />
86608663
</Item>
@@ -8667,6 +8670,12 @@
86678670
</Str>
86688671
<Disp Icon="Str" />
86698672
</Item>
8673+
<Item ItemId=";Remove_braces_from_arrow_function_body_95112" ItemType="0" PsrId="306" Leaf="true">
8674+
<Str Cat="Text">
8675+
<Val><![CDATA[Remove braces from arrow function body]]></Val>
8676+
</Str>
8677+
<Disp Icon="Str" />
8678+
</Item>
86708679
<Item ItemId=";Remove_destructuring_90009" ItemType="0" PsrId="306" Leaf="true">
86718680
<Str Cat="Text">
86728681
<Val><![CDATA[Remove destructuring]]></Val>
@@ -10392,6 +10401,12 @@
1039210401
</Str>
1039310402
<Disp Icon="Str" />
1039410403
</Item>
10404+
<Item ItemId=";The_tag_was_first_specified_here_8034" ItemType="0" PsrId="306" Leaf="true">
10405+
<Str Cat="Text">
10406+
<Val><![CDATA[The tag was first specified here.]]></Val>
10407+
</Str>
10408+
<Disp Icon="Str" />
10409+
</Item>
1039510410
<Item ItemId=";The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541" ItemType="0" PsrId="306" Leaf="true">
1039610411
<Str Cat="Text">
1039710412
<Val><![CDATA[The target of an assignment must be a variable or a property access.]]></Val>

0 commit comments

Comments
 (0)