Rename '_decorators' to 'illegalDecorators'

This commit is contained in:
Ron Buckton
2022-08-19 13:32:17 -04:00
parent aebe225dd2
commit 46c30f3e76
6 changed files with 82 additions and 82 deletions
+1 -1
View File
@@ -44015,7 +44015,7 @@ namespace ts {
}
function checkGrammarDecorators(node: Node): boolean {
if (canHaveIllegalDecorators(node) && some(node._decorators)) {
if (canHaveIllegalDecorators(node) && some(node.illegalDecorators)) {
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
}
if (!canHaveDecorators(node) || !hasDecorators(node)) {
+28 -28
View File
@@ -1435,7 +1435,7 @@ namespace ts {
node.transformFlags = propagateChildFlags(body) | TransformFlags.ContainsClassFields;
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
node.modifiers = undefined;
return node;
}
@@ -1452,7 +1452,7 @@ namespace ts {
function finishUpdateClassStaticBlockDeclaration(updated: Mutable<ClassStaticBlockDeclaration>, original: ClassStaticBlockDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
updated.modifiers = original.modifiers;
}
return update(updated, original);
@@ -1476,7 +1476,7 @@ namespace ts {
node.transformFlags |= TransformFlags.ContainsES2015;
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
node.typeParameters = undefined;
node.type = undefined;
return node;
@@ -1498,7 +1498,7 @@ namespace ts {
function finishUpdateConstructorDeclaration(updated: Mutable<ConstructorDeclaration>, original: ConstructorDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
updated.typeParameters = original.typeParameters;
updated.type = original.type;
}
@@ -3657,7 +3657,7 @@ namespace ts {
}
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -3686,7 +3686,7 @@ namespace ts {
function finishUpdateFunctionDeclaration(updated: Mutable<FunctionDeclaration>, original: FunctionDeclaration) {
if (updated !== original) {
// copy children used only for error reporting
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return finishUpdateBaseSignatureDeclaration(updated, original);
}
@@ -3756,7 +3756,7 @@ namespace ts {
node.transformFlags = TransformFlags.ContainsTypeScript;
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -3780,7 +3780,7 @@ namespace ts {
function finishUpdateInterfaceDeclaration(updated: Mutable<InterfaceDeclaration>, original: InterfaceDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return update(updated, original);
}
@@ -3802,7 +3802,7 @@ namespace ts {
node.transformFlags = TransformFlags.ContainsTypeScript;
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -3824,7 +3824,7 @@ namespace ts {
function finishUpdateTypeAliasDeclaration(updated: Mutable<TypeAliasDeclaration>, original: TypeAliasDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return update(updated, original);
}
@@ -3847,7 +3847,7 @@ namespace ts {
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Enum declarations cannot contain `await`
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -3866,7 +3866,7 @@ namespace ts {
function finishUpdateEnumDeclaration(updated: Mutable<EnumDeclaration>, original: EnumDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return update(updated, original);
}
@@ -3896,7 +3896,7 @@ namespace ts {
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Module declarations cannot contain `await`.
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -3916,7 +3916,7 @@ namespace ts {
function finishUpdateModuleDeclaration(updated: Mutable<ModuleDeclaration>, original: ModuleDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return update(updated, original);
}
@@ -3961,7 +3961,7 @@ namespace ts {
node.transformFlags = TransformFlags.ContainsTypeScript;
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
node.modifiers = undefined;
return node;
}
@@ -3975,7 +3975,7 @@ namespace ts {
function finishUpdateNamespaceExportDeclaration(updated: Mutable<NamespaceExportDeclaration>, original: NamespaceExportDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
updated.modifiers = original.modifiers;
}
return update(updated, original);
@@ -4000,7 +4000,7 @@ namespace ts {
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Import= declaration is always parsed in an Await context
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -4022,7 +4022,7 @@ namespace ts {
function finishUpdateImportEqualsDeclaration(updated: Mutable<ImportEqualsDeclaration>, original: ImportEqualsDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return update(updated, original);
}
@@ -4045,7 +4045,7 @@ namespace ts {
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -4067,7 +4067,7 @@ namespace ts {
function finishUpdateImportDeclaration(updated: Mutable<ImportDeclaration>, original: ImportDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return update(updated, original);
}
@@ -4235,7 +4235,7 @@ namespace ts {
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -4253,7 +4253,7 @@ namespace ts {
function finishUpdateExportAssignment(updated: Mutable<ExportAssignment>, original: ExportAssignment) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return update(updated, original);
}
@@ -4279,7 +4279,7 @@ namespace ts {
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
return node;
}
@@ -4303,7 +4303,7 @@ namespace ts {
function finishUpdateExportDeclaration(updated: Mutable<ExportDeclaration>, original: ExportDeclaration) {
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
}
return update(updated, original);
}
@@ -5162,7 +5162,7 @@ namespace ts {
propagateChildFlags(node.initializer);
// The following properties are used only to report grammar errors
node._decorators = undefined;
node.illegalDecorators = undefined;
node.modifiers = undefined;
node.questionToken = undefined;
node.exclamationToken = undefined;
@@ -5180,7 +5180,7 @@ namespace ts {
function finishUpdatePropertyAssignment(updated: Mutable<PropertyAssignment>, original: PropertyAssignment) {
// copy children used only for error reporting
if (updated !== original) {
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
updated.modifiers = original.modifiers;
updated.questionToken = original.questionToken;
updated.exclamationToken = original.exclamationToken;
@@ -5202,7 +5202,7 @@ namespace ts {
// The following properties are used only to report grammar errors
node.equalsToken = undefined;
node._decorators = undefined;
node.illegalDecorators = undefined;
node.modifiers = undefined;
node.questionToken = undefined;
node.exclamationToken = undefined;
@@ -5221,7 +5221,7 @@ namespace ts {
if (updated !== original) {
// copy children used only for error reporting
updated.equalsToken = original.equalsToken;
updated._decorators = original._decorators;
updated.illegalDecorators = original.illegalDecorators;
updated.modifiers = original.modifiers;
updated.questionToken = original.questionToken;
updated.exclamationToken = original.exclamationToken;
+34 -34
View File
@@ -123,7 +123,7 @@ namespace ts {
visitNode(cbNode, (node as TypeParameterDeclaration).default) ||
visitNode(cbNode, (node as TypeParameterDeclaration).expression);
case SyntaxKind.ShorthandPropertyAssignment:
return visitNodes(cbNode, cbNodes, (node as ShorthandPropertyAssignment)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as ShorthandPropertyAssignment).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as ShorthandPropertyAssignment).modifiers) ||
visitNode(cbNode, (node as ShorthandPropertyAssignment).name) ||
visitNode(cbNode, (node as ShorthandPropertyAssignment).questionToken) ||
@@ -153,7 +153,7 @@ namespace ts {
visitNode(cbNode, (node as PropertySignature).type) ||
visitNode(cbNode, (node as PropertySignature).initializer);
case SyntaxKind.PropertyAssignment:
return visitNodes(cbNode, cbNodes, (node as PropertyAssignment)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as PropertyAssignment).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as PropertyAssignment).modifiers) ||
visitNode(cbNode, (node as PropertyAssignment).name) ||
visitNode(cbNode, (node as PropertyAssignment).questionToken) ||
@@ -170,7 +170,7 @@ namespace ts {
visitNode(cbNode, (node as BindingElement).name) ||
visitNode(cbNode, (node as BindingElement).initializer);
case SyntaxKind.IndexSignature:
return visitNodes(cbNode, cbNodes, (node as IndexSignatureDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as IndexSignatureDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as IndexSignatureDeclaration).modifiers) ||
visitNodes(cbNode, cbNodes, (node as IndexSignatureDeclaration).typeParameters) ||
visitNodes(cbNode, cbNodes, (node as IndexSignatureDeclaration).parameters) ||
@@ -208,7 +208,7 @@ namespace ts {
visitNodes(cbNode, cbNodes, (node as MethodSignature).parameters) ||
visitNode(cbNode, (node as MethodSignature).type);
case SyntaxKind.Constructor:
return visitNodes(cbNode, cbNodes, (node as ConstructorDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as ConstructorDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as ConstructorDeclaration).modifiers) ||
visitNode(cbNode, (node as ConstructorDeclaration).name) ||
visitNodes(cbNode, cbNodes, (node as ConstructorDeclaration).typeParameters) ||
@@ -230,7 +230,7 @@ namespace ts {
visitNode(cbNode, (node as SetAccessorDeclaration).type) ||
visitNode(cbNode, (node as SetAccessorDeclaration).body);
case SyntaxKind.FunctionDeclaration:
return visitNodes(cbNode, cbNodes, (node as FunctionDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as FunctionDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as FunctionDeclaration).modifiers) ||
visitNode(cbNode, (node as FunctionDeclaration).asteriskToken) ||
visitNode(cbNode, (node as FunctionDeclaration).name) ||
@@ -254,7 +254,7 @@ namespace ts {
visitNode(cbNode, (node as ArrowFunction).equalsGreaterThanToken) ||
visitNode(cbNode, (node as ArrowFunction).body);
case SyntaxKind.ClassStaticBlockDeclaration:
return visitNodes(cbNode, cbNodes, (node as ClassStaticBlockDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as ClassStaticBlockDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as ClassStaticBlockDeclaration).modifiers) ||
visitNode(cbNode, (node as ClassStaticBlockDeclaration).body);
case SyntaxKind.TypeReference:
@@ -382,7 +382,7 @@ namespace ts {
return visitNodes(cbNode, cbNodes, (node as SourceFile).statements) ||
visitNode(cbNode, (node as SourceFile).endOfFileToken);
case SyntaxKind.VariableStatement:
return visitNodes(cbNode, cbNodes, (node as VariableStatement)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as VariableStatement).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as VariableStatement).modifiers) ||
visitNode(cbNode, (node as VariableStatement).declarationList);
case SyntaxKind.VariableDeclarationList:
@@ -453,20 +453,20 @@ namespace ts {
visitNodes(cbNode, cbNodes, (node as ClassLikeDeclaration).heritageClauses) ||
visitNodes(cbNode, cbNodes, (node as ClassLikeDeclaration).members);
case SyntaxKind.InterfaceDeclaration:
return visitNodes(cbNode, cbNodes, (node as InterfaceDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as InterfaceDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as InterfaceDeclaration).modifiers) ||
visitNode(cbNode, (node as InterfaceDeclaration).name) ||
visitNodes(cbNode, cbNodes, (node as InterfaceDeclaration).typeParameters) ||
visitNodes(cbNode, cbNodes, (node as ClassDeclaration).heritageClauses) ||
visitNodes(cbNode, cbNodes, (node as InterfaceDeclaration).members);
case SyntaxKind.TypeAliasDeclaration:
return visitNodes(cbNode, cbNodes, (node as TypeAliasDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as TypeAliasDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as TypeAliasDeclaration).modifiers) ||
visitNode(cbNode, (node as TypeAliasDeclaration).name) ||
visitNodes(cbNode, cbNodes, (node as TypeAliasDeclaration).typeParameters) ||
visitNode(cbNode, (node as TypeAliasDeclaration).type);
case SyntaxKind.EnumDeclaration:
return visitNodes(cbNode, cbNodes, (node as EnumDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as EnumDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as EnumDeclaration).modifiers) ||
visitNode(cbNode, (node as EnumDeclaration).name) ||
visitNodes(cbNode, cbNodes, (node as EnumDeclaration).members);
@@ -474,17 +474,17 @@ namespace ts {
return visitNode(cbNode, (node as EnumMember).name) ||
visitNode(cbNode, (node as EnumMember).initializer);
case SyntaxKind.ModuleDeclaration:
return visitNodes(cbNode, cbNodes, (node as ModuleDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as ModuleDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as ModuleDeclaration).modifiers) ||
visitNode(cbNode, (node as ModuleDeclaration).name) ||
visitNode(cbNode, (node as ModuleDeclaration).body);
case SyntaxKind.ImportEqualsDeclaration:
return visitNodes(cbNode, cbNodes, (node as ImportEqualsDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as ImportEqualsDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as ImportEqualsDeclaration).modifiers) ||
visitNode(cbNode, (node as ImportEqualsDeclaration).name) ||
visitNode(cbNode, (node as ImportEqualsDeclaration).moduleReference);
case SyntaxKind.ImportDeclaration:
return visitNodes(cbNode, cbNodes, (node as ImportDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as ImportDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as ImportDeclaration).modifiers) ||
visitNode(cbNode, (node as ImportDeclaration).importClause) ||
visitNode(cbNode, (node as ImportDeclaration).moduleSpecifier) ||
@@ -498,7 +498,7 @@ namespace ts {
return visitNode(cbNode, (node as AssertEntry).name) ||
visitNode(cbNode, (node as AssertEntry).value);
case SyntaxKind.NamespaceExportDeclaration:
return visitNodes(cbNode, cbNodes, (node as NamespaceExportDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as NamespaceExportDeclaration).illegalDecorators) ||
visitNode(cbNode, (node as NamespaceExportDeclaration).name);
case SyntaxKind.NamespaceImport:
return visitNode(cbNode, (node as NamespaceImport).name);
@@ -508,7 +508,7 @@ namespace ts {
case SyntaxKind.NamedExports:
return visitNodes(cbNode, cbNodes, (node as NamedImportsOrExports).elements);
case SyntaxKind.ExportDeclaration:
return visitNodes(cbNode, cbNodes, (node as ExportDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as ExportDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as ExportDeclaration).modifiers) ||
visitNode(cbNode, (node as ExportDeclaration).exportClause) ||
visitNode(cbNode, (node as ExportDeclaration).moduleSpecifier) ||
@@ -518,7 +518,7 @@ namespace ts {
return visitNode(cbNode, (node as ImportOrExportSpecifier).propertyName) ||
visitNode(cbNode, (node as ImportOrExportSpecifier).name);
case SyntaxKind.ExportAssignment:
return visitNodes(cbNode, cbNodes, (node as ExportAssignment)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as ExportAssignment).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as ExportAssignment).modifiers) ||
visitNode(cbNode, (node as ExportAssignment).expression);
case SyntaxKind.TemplateExpression:
@@ -543,7 +543,7 @@ namespace ts {
case SyntaxKind.ExternalModuleReference:
return visitNode(cbNode, (node as ExternalModuleReference).expression);
case SyntaxKind.MissingDeclaration:
return visitNodes(cbNode, cbNodes, (node as MissingDeclaration)._decorators) ||
return visitNodes(cbNode, cbNodes, (node as MissingDeclaration).illegalDecorators) ||
visitNodes(cbNode, cbNodes, (node as MissingDeclaration).modifiers);
case SyntaxKind.CommaListExpression:
return visitNodes(cbNode, cbNodes, (node as CommaListExpression).elements);
@@ -3560,7 +3560,7 @@ namespace ts {
const type = parseTypeAnnotation();
parseTypeMemberSemicolon();
const node = factory.createIndexSignature(modifiers, parameters, type);
(node as Mutable<IndexSignatureDeclaration>)._decorators = decorators;
(node as Mutable<IndexSignatureDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -5974,7 +5974,7 @@ namespace ts {
node = factory.createPropertyAssignment(name, initializer);
}
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
node._decorators = decorators;
node.illegalDecorators = decorators;
node.modifiers = modifiers;
node.questionToken = questionToken;
node.exclamationToken = exclamationToken;
@@ -6694,7 +6694,7 @@ namespace ts {
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
const missing = createMissingNode<MissingDeclaration>(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
setTextRangePos(missing, pos);
missing._decorators = decorators;
missing.illegalDecorators = decorators;
missing.modifiers = modifiers;
return missing;
}
@@ -6858,7 +6858,7 @@ namespace ts {
parseSemicolon();
const node = factory.createVariableStatement(modifiers, declarationList);
// Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker.
node._decorators = decorators;
node.illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -6879,7 +6879,7 @@ namespace ts {
const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, Diagnostics.or_expected);
setAwaitContext(savedAwaitContext);
const node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body);
(node as Mutable<FunctionDeclaration>)._decorators = decorators;
(node as Mutable<FunctionDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -6905,7 +6905,7 @@ namespace ts {
const node = factory.createConstructorDeclaration(modifiers, parameters, body);
// Attach invalid nodes if they exist so that we can report them in the grammar checker.
(node as Mutable<ConstructorDeclaration>)._decorators = decorators;
(node as Mutable<ConstructorDeclaration>).illegalDecorators = decorators;
(node as Mutable<ConstructorDeclaration>).typeParameters = typeParameters;
(node as Mutable<ConstructorDeclaration>).type = type;
return withJSDoc(finishNode(node, pos), hasJSDoc);
@@ -7072,7 +7072,7 @@ namespace ts {
parseExpectedToken(SyntaxKind.StaticKeyword);
const body = parseClassStaticBlockBody();
const node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc);
(node as Mutable<ClassStaticBlockDeclaration>)._decorators = decorators;
(node as Mutable<ClassStaticBlockDeclaration>).illegalDecorators = decorators;
(node as Mutable<ClassStaticBlockDeclaration>).modifiers = modifiers;
return node;
}
@@ -7347,7 +7347,7 @@ namespace ts {
const heritageClauses = parseHeritageClauses();
const members = parseObjectTypeMembers();
const node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members);
(node as Mutable<InterfaceDeclaration>)._decorators = decorators;
(node as Mutable<InterfaceDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -7359,7 +7359,7 @@ namespace ts {
const type = token() === SyntaxKind.IntrinsicKeyword && tryParse(parseKeywordAndNoDot) || parseType();
parseSemicolon();
const node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type);
(node as Mutable<TypeAliasDeclaration>)._decorators = decorators;
(node as Mutable<TypeAliasDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -7387,7 +7387,7 @@ namespace ts {
members = createMissingList<EnumMember>();
}
const node = factory.createEnumDeclaration(modifiers, name, members);
(node as Mutable<EnumDeclaration>)._decorators = decorators;
(node as Mutable<EnumDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -7413,7 +7413,7 @@ namespace ts {
? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, NodeFlags.NestedNamespace | namespaceFlag) as NamespaceDeclaration
: parseModuleBlock();
const node = factory.createModuleDeclaration(modifiers, name, body, flags);
(node as Mutable<ModuleDeclaration>)._decorators = decorators;
(node as Mutable<ModuleDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -7437,7 +7437,7 @@ namespace ts {
parseSemicolon();
}
const node = factory.createModuleDeclaration(modifiers, name, body, flags);
(node as Mutable<ModuleDeclaration>)._decorators = decorators;
(node as Mutable<ModuleDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -7483,7 +7483,7 @@ namespace ts {
parseSemicolon();
const node = factory.createNamespaceExportDeclaration(name);
// NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker
(node as Mutable<NamespaceExportDeclaration>)._decorators = decorators;
(node as Mutable<NamespaceExportDeclaration>).illegalDecorators = decorators;
(node as Mutable<NamespaceExportDeclaration>).modifiers = modifiers;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -7532,7 +7532,7 @@ namespace ts {
parseSemicolon();
const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause);
(node as Mutable<ImportDeclaration>)._decorators = decorators;
(node as Mutable<ImportDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -7585,7 +7585,7 @@ namespace ts {
const moduleReference = parseModuleReference();
parseSemicolon();
const node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference);
(node as Mutable<ImportEqualsDeclaration>)._decorators = decorators;
(node as Mutable<ImportEqualsDeclaration>).illegalDecorators = decorators;
const finished = withJSDoc(finishNode(node, pos), hasJSDoc);
return finished;
}
@@ -7794,7 +7794,7 @@ namespace ts {
parseSemicolon();
setAwaitContext(savedAwaitContext);
const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause);
(node as Mutable<ExportDeclaration>)._decorators = decorators;
(node as Mutable<ExportDeclaration>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -7812,7 +7812,7 @@ namespace ts {
parseSemicolon();
setAwaitContext(savedAwaitContext);
const node = factory.createExportAssignment(modifiers, isExportEquals, expression);
(node as Mutable<ExportAssignment>)._decorators = decorators;
(node as Mutable<ExportAssignment>).illegalDecorators = decorators;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
+17 -17
View File
@@ -1484,7 +1484,7 @@ namespace ts {
readonly initializer: Expression;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined; // property assignment cannot have decorators
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // property assignment cannot have decorators
/* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; // property assignment cannot have modifiers
/* @internal */ readonly questionToken?: QuestionToken | undefined; // property assignment cannot have a question token
/* @internal */ readonly exclamationToken?: ExclamationToken | undefined; // property assignment cannot have an exclamation token
@@ -1500,7 +1500,7 @@ namespace ts {
readonly objectAssignmentInitializer?: Expression;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined; // shorthand property assignment cannot have decorators
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // shorthand property assignment cannot have decorators
/* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; // shorthand property assignment cannot have modifiers
/* @internal */ readonly questionToken?: QuestionToken | undefined; // shorthand property assignment cannot have a question token
/* @internal */ readonly exclamationToken?: ExclamationToken | undefined; // shorthand property assignment cannot have an exclamation token
@@ -1582,7 +1582,7 @@ namespace ts {
readonly body?: FunctionBody;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined; // functions cannot have decorators
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // functions cannot have decorators
}
export interface MethodSignature extends SignatureDeclarationBase, TypeElement {
@@ -1619,7 +1619,7 @@ namespace ts {
readonly body?: FunctionBody | undefined;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined; // A constructor cannot have decorators
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // A constructor cannot have decorators
/* @internal */ readonly typeParameters?: NodeArray<TypeParameterDeclaration>; // A constructor cannot have type parameters
/* @internal */ readonly type?: TypeNode; // A constructor cannot have a return type annotation
}
@@ -1666,7 +1666,7 @@ namespace ts {
readonly type: TypeNode;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer {
@@ -1678,7 +1678,7 @@ namespace ts {
/* @internal */ returnFlowNode?: FlowNode;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined;
}
@@ -2828,7 +2828,7 @@ namespace ts {
readonly name?: Identifier;
// The following properties are used only to report grammar errors
/*@internal*/ _decorators?: NodeArray<Decorator> | undefined;
/*@internal*/ illegalDecorators?: NodeArray<Decorator> | undefined;
/*@internal*/ modifiers?: NodeArray<Modifier> | undefined;
}
@@ -2851,7 +2851,7 @@ namespace ts {
readonly declarationList: VariableDeclarationList;
// The following properties are used only to report grammar errors
/* @internal*/ _decorators?: NodeArray<Decorator> | undefined;
/* @internal*/ illegalDecorators?: NodeArray<Decorator> | undefined;
}
export interface ExpressionStatement extends Statement {
@@ -3065,7 +3065,7 @@ namespace ts {
readonly members: NodeArray<TypeElement>;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export interface HeritageClause extends Node {
@@ -3083,7 +3083,7 @@ namespace ts {
readonly type: TypeNode;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export interface EnumMember extends NamedDeclaration, JSDocContainer {
@@ -3102,7 +3102,7 @@ namespace ts {
readonly members: NodeArray<EnumMember>;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export type ModuleName =
@@ -3128,7 +3128,7 @@ namespace ts {
readonly body?: ModuleBody | JSDocNamespaceDeclaration;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export type NamespaceBody =
@@ -3179,7 +3179,7 @@ namespace ts {
readonly moduleReference: ModuleReference;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export interface ExternalModuleReference extends Node {
@@ -3202,7 +3202,7 @@ namespace ts {
readonly assertClause?: AssertClause;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export type NamedImportBindings =
@@ -3262,7 +3262,7 @@ namespace ts {
readonly name: Identifier;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly modifiers?: NodeArray<Modifier> | undefined;
}
@@ -3278,7 +3278,7 @@ namespace ts {
readonly assertClause?: AssertClause;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export interface NamedImports extends Node {
@@ -3343,7 +3343,7 @@ namespace ts {
readonly expression: Expression;
// The following properties are used only to report grammar errors
/* @internal */ readonly _decorators?: NodeArray<Decorator> | undefined;
/* @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined;
}
export interface FileReference extends TextRange {
+1 -1
View File
@@ -7542,7 +7542,7 @@ namespace ts {
case SyntaxKind.Decorator: {
const { parent } = node as Decorator;
return canHaveDecorators(parent) ? parent.modifiers :
canHaveIllegalDecorators(parent) ? parent._decorators :
canHaveIllegalDecorators(parent) ? parent.illegalDecorators :
undefined;
}
case SyntaxKind.HeritageClause:
@@ -653,7 +653,7 @@ namespace ts.refactor.convertParamsToDestructuredObject {
interface ValidParameterDeclaration extends ParameterDeclaration {
name: Identifier;
modifiers: undefined;
_decorators: undefined;
illegalDecorators: undefined;
}
interface GroupedReferences {