Make canHaveModifiers/Decorators public

This commit is contained in:
Ron Buckton 2022-08-22 11:03:34 -04:00
Родитель aca1aa6897
Коммит 69ee8e3785
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9ADA0DFD36502AB9
4 изменённых файлов: 44 добавлений и 40 удалений

Просмотреть файл

@ -877,17 +877,6 @@ namespace ts {
|| kind === SyntaxKind.SetAccessor;
}
export function canHaveDecorators(node: Node): node is HasDecorators {
const kind = node.kind;
return kind === SyntaxKind.Parameter
|| kind === SyntaxKind.PropertyDeclaration
|| kind === SyntaxKind.MethodDeclaration
|| kind === SyntaxKind.GetAccessor
|| kind === SyntaxKind.SetAccessor
|| kind === SyntaxKind.ClassExpression
|| kind === SyntaxKind.ClassDeclaration;
}
export function canHaveIllegalDecorators(node: Node): node is HasIllegalDecorators {
const kind = node.kind;
return kind === SyntaxKind.PropertyAssignment
@ -909,35 +898,6 @@ namespace ts {
|| kind === SyntaxKind.ExportAssignment;
}
export function canHaveModifiers(node: Node): node is HasModifiers {
const kind = node.kind;
return kind === SyntaxKind.TypeParameter
|| kind === SyntaxKind.Parameter
|| kind === SyntaxKind.PropertySignature
|| kind === SyntaxKind.PropertyDeclaration
|| kind === SyntaxKind.MethodSignature
|| kind === SyntaxKind.MethodDeclaration
|| kind === SyntaxKind.Constructor
|| kind === SyntaxKind.GetAccessor
|| kind === SyntaxKind.SetAccessor
|| kind === SyntaxKind.IndexSignature
|| kind === SyntaxKind.ConstructorType
|| kind === SyntaxKind.FunctionExpression
|| kind === SyntaxKind.ArrowFunction
|| kind === SyntaxKind.ClassExpression
|| kind === SyntaxKind.VariableStatement
|| kind === SyntaxKind.FunctionDeclaration
|| kind === SyntaxKind.ClassDeclaration
|| kind === SyntaxKind.InterfaceDeclaration
|| kind === SyntaxKind.TypeAliasDeclaration
|| kind === SyntaxKind.EnumDeclaration
|| kind === SyntaxKind.ModuleDeclaration
|| kind === SyntaxKind.ImportEqualsDeclaration
|| kind === SyntaxKind.ImportDeclaration
|| kind === SyntaxKind.ExportAssignment
|| kind === SyntaxKind.ExportDeclaration;
}
export function canHaveIllegalModifiers(node: Node): node is HasIllegalModifiers {
const kind = node.kind;
return kind === SyntaxKind.ClassStaticBlockDeclaration

Просмотреть файл

@ -2,4 +2,44 @@ namespace ts {
export function setTextRange<T extends TextRange>(range: T, location: TextRange | undefined): T {
return location ? setTextRangePosEnd(range, location.pos, location.end) : range;
}
export function canHaveModifiers(node: Node): node is HasModifiers {
const kind = node.kind;
return kind === SyntaxKind.TypeParameter
|| kind === SyntaxKind.Parameter
|| kind === SyntaxKind.PropertySignature
|| kind === SyntaxKind.PropertyDeclaration
|| kind === SyntaxKind.MethodSignature
|| kind === SyntaxKind.MethodDeclaration
|| kind === SyntaxKind.Constructor
|| kind === SyntaxKind.GetAccessor
|| kind === SyntaxKind.SetAccessor
|| kind === SyntaxKind.IndexSignature
|| kind === SyntaxKind.ConstructorType
|| kind === SyntaxKind.FunctionExpression
|| kind === SyntaxKind.ArrowFunction
|| kind === SyntaxKind.ClassExpression
|| kind === SyntaxKind.VariableStatement
|| kind === SyntaxKind.FunctionDeclaration
|| kind === SyntaxKind.ClassDeclaration
|| kind === SyntaxKind.InterfaceDeclaration
|| kind === SyntaxKind.TypeAliasDeclaration
|| kind === SyntaxKind.EnumDeclaration
|| kind === SyntaxKind.ModuleDeclaration
|| kind === SyntaxKind.ImportEqualsDeclaration
|| kind === SyntaxKind.ImportDeclaration
|| kind === SyntaxKind.ExportAssignment
|| kind === SyntaxKind.ExportDeclaration;
}
export function canHaveDecorators(node: Node): node is HasDecorators {
const kind = node.kind;
return kind === SyntaxKind.Parameter
|| kind === SyntaxKind.PropertyDeclaration
|| kind === SyntaxKind.MethodDeclaration
|| kind === SyntaxKind.GetAccessor
|| kind === SyntaxKind.SetAccessor
|| kind === SyntaxKind.ClassExpression
|| kind === SyntaxKind.ClassDeclaration;
}
}

Просмотреть файл

@ -4834,6 +4834,8 @@ declare namespace ts {
}
declare namespace ts {
function setTextRange<T extends TextRange>(range: T, location: TextRange | undefined): T;
function canHaveModifiers(node: Node): node is HasModifiers;
function canHaveDecorators(node: Node): node is HasDecorators;
}
declare namespace ts {
/**

Просмотреть файл

@ -4834,6 +4834,8 @@ declare namespace ts {
}
declare namespace ts {
function setTextRange<T extends TextRange>(range: T, location: TextRange | undefined): T;
function canHaveModifiers(node: Node): node is HasModifiers;
function canHaveDecorators(node: Node): node is HasDecorators;
}
declare namespace ts {
/**