Skip to content

Commit da3e304

Browse files
committed
Change type of deprecated 'decorators' property
1 parent 8783da8 commit da3e304

File tree

9 files changed

+262
-436
lines changed

9 files changed

+262
-436
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44015,7 +44015,7 @@ namespace ts {
4401544015
}
4401644016

4401744017
function checkGrammarDecorators(node: Node): boolean {
44018-
if (canHaveIllegalDecorators(node) && some(node.decorators)) {
44018+
if (canHaveIllegalDecorators(node) && some(node._decorators)) {
4401944019
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
4402044020
}
4402144021
if (!canHaveDecorators(node) || !hasDecorators(node)) {

src/compiler/factory/nodeFactory.ts

+28-28
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ namespace ts {
14351435
node.transformFlags = propagateChildFlags(body) | TransformFlags.ContainsClassFields;
14361436

14371437
// The following properties are used only to report grammar errors
1438-
node.decorators = undefined;
1438+
node._decorators = undefined;
14391439
node.modifiers = undefined;
14401440
return node;
14411441
}
@@ -1452,7 +1452,7 @@ namespace ts {
14521452

14531453
function finishUpdateClassStaticBlockDeclaration(updated: Mutable<ClassStaticBlockDeclaration>, original: ClassStaticBlockDeclaration) {
14541454
if (updated !== original) {
1455-
updated.decorators = original.decorators;
1455+
updated._decorators = original._decorators;
14561456
updated.modifiers = original.modifiers;
14571457
}
14581458
return update(updated, original);
@@ -1476,7 +1476,7 @@ namespace ts {
14761476
node.transformFlags |= TransformFlags.ContainsES2015;
14771477

14781478
// The following properties are used only to report grammar errors
1479-
node.decorators = undefined;
1479+
node._decorators = undefined;
14801480
node.typeParameters = undefined;
14811481
node.type = undefined;
14821482
return node;
@@ -1498,7 +1498,7 @@ namespace ts {
14981498

14991499
function finishUpdateConstructorDeclaration(updated: Mutable<ConstructorDeclaration>, original: ConstructorDeclaration) {
15001500
if (updated !== original) {
1501-
updated.decorators = original.decorators;
1501+
updated._decorators = original._decorators;
15021502
updated.typeParameters = original.typeParameters;
15031503
updated.type = original.type;
15041504
}
@@ -3657,7 +3657,7 @@ namespace ts {
36573657
}
36583658

36593659
// The following properties are used only to report grammar errors
3660-
node.decorators = undefined;
3660+
node._decorators = undefined;
36613661
return node;
36623662
}
36633663

@@ -3686,7 +3686,7 @@ namespace ts {
36863686
function finishUpdateFunctionDeclaration(updated: Mutable<FunctionDeclaration>, original: FunctionDeclaration) {
36873687
if (updated !== original) {
36883688
// copy children used only for error reporting
3689-
updated.decorators = original.decorators;
3689+
updated._decorators = original._decorators;
36903690
}
36913691
return finishUpdateBaseSignatureDeclaration(updated, original);
36923692
}
@@ -3756,7 +3756,7 @@ namespace ts {
37563756
node.transformFlags = TransformFlags.ContainsTypeScript;
37573757

37583758
// The following properties are used only to report grammar errors
3759-
node.decorators = undefined;
3759+
node._decorators = undefined;
37603760
return node;
37613761
}
37623762

@@ -3780,7 +3780,7 @@ namespace ts {
37803780

37813781
function finishUpdateInterfaceDeclaration(updated: Mutable<InterfaceDeclaration>, original: InterfaceDeclaration) {
37823782
if (updated !== original) {
3783-
updated.decorators = original.decorators;
3783+
updated._decorators = original._decorators;
37843784
}
37853785
return update(updated, original);
37863786
}
@@ -3802,7 +3802,7 @@ namespace ts {
38023802
node.transformFlags = TransformFlags.ContainsTypeScript;
38033803

38043804
// The following properties are used only to report grammar errors
3805-
node.decorators = undefined;
3805+
node._decorators = undefined;
38063806
return node;
38073807
}
38083808

@@ -3824,7 +3824,7 @@ namespace ts {
38243824

38253825
function finishUpdateTypeAliasDeclaration(updated: Mutable<TypeAliasDeclaration>, original: TypeAliasDeclaration) {
38263826
if (updated !== original) {
3827-
updated.decorators = original.decorators;
3827+
updated._decorators = original._decorators;
38283828
}
38293829
return update(updated, original);
38303830
}
@@ -3847,7 +3847,7 @@ namespace ts {
38473847
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Enum declarations cannot contain `await`
38483848

38493849
// The following properties are used only to report grammar errors
3850-
node.decorators = undefined;
3850+
node._decorators = undefined;
38513851
return node;
38523852
}
38533853

@@ -3866,7 +3866,7 @@ namespace ts {
38663866

38673867
function finishUpdateEnumDeclaration(updated: Mutable<EnumDeclaration>, original: EnumDeclaration) {
38683868
if (updated !== original) {
3869-
updated.decorators = original.decorators;
3869+
updated._decorators = original._decorators;
38703870
}
38713871
return update(updated, original);
38723872
}
@@ -3896,7 +3896,7 @@ namespace ts {
38963896
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Module declarations cannot contain `await`.
38973897

38983898
// The following properties are used only to report grammar errors
3899-
node.decorators = undefined;
3899+
node._decorators = undefined;
39003900
return node;
39013901
}
39023902

@@ -3916,7 +3916,7 @@ namespace ts {
39163916

39173917
function finishUpdateModuleDeclaration(updated: Mutable<ModuleDeclaration>, original: ModuleDeclaration) {
39183918
if (updated !== original) {
3919-
updated.decorators = original.decorators;
3919+
updated._decorators = original._decorators;
39203920
}
39213921
return update(updated, original);
39223922
}
@@ -3961,7 +3961,7 @@ namespace ts {
39613961
node.transformFlags = TransformFlags.ContainsTypeScript;
39623962

39633963
// The following properties are used only to report grammar errors
3964-
node.decorators = undefined;
3964+
node._decorators = undefined;
39653965
node.modifiers = undefined;
39663966
return node;
39673967
}
@@ -3975,7 +3975,7 @@ namespace ts {
39753975

39763976
function finishUpdateNamespaceExportDeclaration(updated: Mutable<NamespaceExportDeclaration>, original: NamespaceExportDeclaration) {
39773977
if (updated !== original) {
3978-
updated.decorators = original.decorators;
3978+
updated._decorators = original._decorators;
39793979
updated.modifiers = original.modifiers;
39803980
}
39813981
return update(updated, original);
@@ -4000,7 +4000,7 @@ namespace ts {
40004000
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Import= declaration is always parsed in an Await context
40014001

40024002
// The following properties are used only to report grammar errors
4003-
node.decorators = undefined;
4003+
node._decorators = undefined;
40044004
return node;
40054005
}
40064006

@@ -4022,7 +4022,7 @@ namespace ts {
40224022

40234023
function finishUpdateImportEqualsDeclaration(updated: Mutable<ImportEqualsDeclaration>, original: ImportEqualsDeclaration) {
40244024
if (updated !== original) {
4025-
updated.decorators = original.decorators;
4025+
updated._decorators = original._decorators;
40264026
}
40274027
return update(updated, original);
40284028
}
@@ -4045,7 +4045,7 @@ namespace ts {
40454045
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context
40464046

40474047
// The following properties are used only to report grammar errors
4048-
node.decorators = undefined;
4048+
node._decorators = undefined;
40494049
return node;
40504050
}
40514051

@@ -4067,7 +4067,7 @@ namespace ts {
40674067

40684068
function finishUpdateImportDeclaration(updated: Mutable<ImportDeclaration>, original: ImportDeclaration) {
40694069
if (updated !== original) {
4070-
updated.decorators = original.decorators;
4070+
updated._decorators = original._decorators;
40714071
}
40724072
return update(updated, original);
40734073
}
@@ -4235,7 +4235,7 @@ namespace ts {
42354235
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context
42364236

42374237
// The following properties are used only to report grammar errors
4238-
node.decorators = undefined;
4238+
node._decorators = undefined;
42394239
return node;
42404240
}
42414241

@@ -4253,7 +4253,7 @@ namespace ts {
42534253

42544254
function finishUpdateExportAssignment(updated: Mutable<ExportAssignment>, original: ExportAssignment) {
42554255
if (updated !== original) {
4256-
updated.decorators = original.decorators;
4256+
updated._decorators = original._decorators;
42574257
}
42584258
return update(updated, original);
42594259
}
@@ -4279,7 +4279,7 @@ namespace ts {
42794279
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context
42804280

42814281
// The following properties are used only to report grammar errors
4282-
node.decorators = undefined;
4282+
node._decorators = undefined;
42834283
return node;
42844284
}
42854285

@@ -4303,7 +4303,7 @@ namespace ts {
43034303

43044304
function finishUpdateExportDeclaration(updated: Mutable<ExportDeclaration>, original: ExportDeclaration) {
43054305
if (updated !== original) {
4306-
updated.decorators = original.decorators;
4306+
updated._decorators = original._decorators;
43074307
}
43084308
return update(updated, original);
43094309
}
@@ -5162,7 +5162,7 @@ namespace ts {
51625162
propagateChildFlags(node.initializer);
51635163

51645164
// The following properties are used only to report grammar errors
5165-
node.decorators = undefined;
5165+
node._decorators = undefined;
51665166
node.modifiers = undefined;
51675167
node.questionToken = undefined;
51685168
node.exclamationToken = undefined;
@@ -5180,7 +5180,7 @@ namespace ts {
51805180
function finishUpdatePropertyAssignment(updated: Mutable<PropertyAssignment>, original: PropertyAssignment) {
51815181
// copy children used only for error reporting
51825182
if (updated !== original) {
5183-
updated.decorators = original.decorators;
5183+
updated._decorators = original._decorators;
51845184
updated.modifiers = original.modifiers;
51855185
updated.questionToken = original.questionToken;
51865186
updated.exclamationToken = original.exclamationToken;
@@ -5202,7 +5202,7 @@ namespace ts {
52025202

52035203
// The following properties are used only to report grammar errors
52045204
node.equalsToken = undefined;
5205-
node.decorators = undefined;
5205+
node._decorators = undefined;
52065206
node.modifiers = undefined;
52075207
node.questionToken = undefined;
52085208
node.exclamationToken = undefined;
@@ -5221,7 +5221,7 @@ namespace ts {
52215221
if (updated !== original) {
52225222
// copy children used only for error reporting
52235223
updated.equalsToken = original.equalsToken;
5224-
updated.decorators = original.decorators;
5224+
updated._decorators = original._decorators;
52255225
updated.modifiers = original.modifiers;
52265226
updated.questionToken = original.questionToken;
52275227
updated.exclamationToken = original.exclamationToken;

0 commit comments

Comments
 (0)