mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
minor cleanup in factory.ts
* remove deprecated signatures * deprecate some legacy signature * remove 2 useless conditions
This commit is contained in:
@@ -1058,7 +1058,7 @@ namespace ts {
|
||||
: node;
|
||||
}
|
||||
|
||||
export function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
|
||||
/** @deprecated */ export function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
|
||||
export function createTaggedTemplate(tag: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, template: TemplateLiteral): TaggedTemplateExpression;
|
||||
/** @internal */
|
||||
export function createTaggedTemplate(tag: Expression, typeArgumentsOrTemplate: ReadonlyArray<TypeNode> | TemplateLiteral | undefined, template?: TemplateLiteral): TaggedTemplateExpression;
|
||||
@@ -1076,7 +1076,7 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
|
||||
/** @deprecated */ export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
|
||||
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, template: TemplateLiteral): TaggedTemplateExpression;
|
||||
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, typeArgumentsOrTemplate: ReadonlyArray<TypeNode> | TemplateLiteral | undefined, template?: TemplateLiteral) {
|
||||
return node.tag !== tag
|
||||
@@ -1168,14 +1168,6 @@ namespace ts {
|
||||
node.body = parenthesizeConciseBody(body);
|
||||
return node;
|
||||
}
|
||||
|
||||
/** @deprecated */ export function updateArrowFunction(
|
||||
node: ArrowFunction,
|
||||
modifiers: ReadonlyArray<Modifier> | undefined,
|
||||
typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined,
|
||||
parameters: ReadonlyArray<ParameterDeclaration>,
|
||||
type: TypeNode | undefined,
|
||||
body: ConciseBody): ArrowFunction;
|
||||
export function updateArrowFunction(
|
||||
node: ArrowFunction,
|
||||
modifiers: ReadonlyArray<Modifier> | undefined,
|
||||
@@ -1183,28 +1175,8 @@ namespace ts {
|
||||
parameters: ReadonlyArray<ParameterDeclaration>,
|
||||
type: TypeNode | undefined,
|
||||
equalsGreaterThanToken: Token<SyntaxKind.EqualsGreaterThanToken>,
|
||||
body: ConciseBody): ArrowFunction;
|
||||
export function updateArrowFunction(
|
||||
node: ArrowFunction,
|
||||
modifiers: ReadonlyArray<Modifier> | undefined,
|
||||
typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined,
|
||||
parameters: ReadonlyArray<ParameterDeclaration>,
|
||||
type: TypeNode | undefined,
|
||||
equalsGreaterThanTokenOrBody: Token<SyntaxKind.EqualsGreaterThanToken> | ConciseBody,
|
||||
bodyOrUndefined?: ConciseBody,
|
||||
body: ConciseBody
|
||||
): ArrowFunction {
|
||||
let equalsGreaterThanToken: Token<SyntaxKind.EqualsGreaterThanToken>;
|
||||
let body: ConciseBody;
|
||||
if (bodyOrUndefined === undefined) {
|
||||
equalsGreaterThanToken = node.equalsGreaterThanToken;
|
||||
body = cast(equalsGreaterThanTokenOrBody, isConciseBody);
|
||||
}
|
||||
else {
|
||||
equalsGreaterThanToken = cast(equalsGreaterThanTokenOrBody, (n): n is Token<SyntaxKind.EqualsGreaterThanToken> =>
|
||||
n.kind === SyntaxKind.EqualsGreaterThanToken);
|
||||
body = bodyOrUndefined;
|
||||
}
|
||||
|
||||
return node.modifiers !== modifiers
|
||||
|| node.typeParameters !== typeParameters
|
||||
|| node.parameters !== parameters
|
||||
@@ -1306,7 +1278,7 @@ namespace ts {
|
||||
: node;
|
||||
}
|
||||
|
||||
export function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression;
|
||||
/** @deprecated */ export function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression;
|
||||
export function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression): ConditionalExpression;
|
||||
export function createConditional(condition: Expression, questionTokenOrWhenTrue: QuestionToken | Expression, whenTrueOrWhenFalse: Expression, colonToken?: ColonToken, whenFalse?: Expression) {
|
||||
const node = <ConditionalExpression>createSynthesizedNode(SyntaxKind.ConditionalExpression);
|
||||
@@ -1317,26 +1289,14 @@ namespace ts {
|
||||
node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse);
|
||||
return node;
|
||||
}
|
||||
|
||||
/** @deprecated */ export function updateConditional(
|
||||
node: ConditionalExpression,
|
||||
condition: Expression,
|
||||
whenTrue: Expression,
|
||||
whenFalse: Expression): ConditionalExpression;
|
||||
export function updateConditional(
|
||||
node: ConditionalExpression,
|
||||
condition: Expression,
|
||||
questionToken: Token<SyntaxKind.QuestionToken>,
|
||||
whenTrue: Expression,
|
||||
colonToken: Token<SyntaxKind.ColonToken>,
|
||||
whenFalse: Expression): ConditionalExpression;
|
||||
export function updateConditional(node: ConditionalExpression, condition: Expression, ...args: any[]) {
|
||||
if (args.length === 2) {
|
||||
const [whenTrue, whenFalse] = args;
|
||||
return updateConditional(node, condition, node.questionToken, whenTrue, node.colonToken, whenFalse);
|
||||
}
|
||||
Debug.assert(args.length === 4);
|
||||
const [questionToken, whenTrue, colonToken, whenFalse] = args;
|
||||
whenFalse: Expression
|
||||
): ConditionalExpression {
|
||||
return node.condition !== condition
|
||||
|| node.questionToken !== questionToken
|
||||
|| node.whenTrue !== whenTrue
|
||||
@@ -2231,7 +2191,7 @@ namespace ts {
|
||||
export function createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes) {
|
||||
const node = <JsxSelfClosingElement>createSynthesizedNode(SyntaxKind.JsxSelfClosingElement);
|
||||
node.tagName = tagName;
|
||||
node.typeArguments = typeArguments && createNodeArray(typeArguments);
|
||||
node.typeArguments = asNodeArray(typeArguments);
|
||||
node.attributes = attributes;
|
||||
return node;
|
||||
}
|
||||
@@ -2247,7 +2207,7 @@ namespace ts {
|
||||
export function createJsxOpeningElement(tagName: JsxTagNameExpression, typeArguments: ReadonlyArray<TypeNode> | undefined, attributes: JsxAttributes) {
|
||||
const node = <JsxOpeningElement>createSynthesizedNode(SyntaxKind.JsxOpeningElement);
|
||||
node.tagName = tagName;
|
||||
node.typeArguments = typeArguments && createNodeArray(typeArguments);
|
||||
node.typeArguments = asNodeArray(typeArguments);
|
||||
node.attributes = attributes;
|
||||
return node;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user