Skip to content

Commit 0e171ab

Browse files
committed
factory: replace Array parameters with ReadonlyArray
1 parent c487a9d commit 0e171ab

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

src/compiler/factory.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -544,15 +544,15 @@ namespace ts {
544544
: node;
545545
}
546546

547-
export function createCallSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined) {
547+
export function createCallSignature(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined) {
548548
return createSignatureDeclaration(SyntaxKind.CallSignature, typeParameters, parameters, type) as CallSignatureDeclaration;
549549
}
550550

551551
export function updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined) {
552552
return updateSignatureDeclaration(node, typeParameters, parameters, type);
553553
}
554554

555-
export function createConstructSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined) {
555+
export function createConstructSignature(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined) {
556556
return createSignatureDeclaration(SyntaxKind.ConstructSignature, typeParameters, parameters, type) as ConstructSignatureDeclaration;
557557
}
558558

@@ -588,7 +588,7 @@ namespace ts {
588588
}
589589

590590
/* @internal */
591-
export function createSignatureDeclaration(kind: SyntaxKind, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, typeArguments?: TypeNode[] | undefined) {
591+
export function createSignatureDeclaration(kind: SyntaxKind, typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined, typeArguments?: ReadonlyArray<TypeNode> | undefined) {
592592
const node = createSynthesizedNode(kind) as SignatureDeclaration;
593593
node.typeParameters = asNodeArray(typeParameters);
594594
node.parameters = asNodeArray(parameters);
@@ -639,15 +639,15 @@ namespace ts {
639639
: node;
640640
}
641641

642-
export function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined) {
642+
export function createFunctionTypeNode(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined) {
643643
return createSignatureDeclaration(SyntaxKind.FunctionType, typeParameters, parameters, type) as FunctionTypeNode;
644644
}
645645

646646
export function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined) {
647647
return updateSignatureDeclaration(node, typeParameters, parameters, type);
648648
}
649649

650-
export function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined) {
650+
export function createConstructorTypeNode(typeParameters: ReadonlyArray<TypeParameterDeclaration> | undefined, parameters: ReadonlyArray<ParameterDeclaration>, type: TypeNode | undefined) {
651651
return createSignatureDeclaration(SyntaxKind.ConstructorType, typeParameters, parameters, type) as ConstructorTypeNode;
652652
}
653653

@@ -703,15 +703,15 @@ namespace ts {
703703
: node;
704704
}
705705

706-
export function createUnionTypeNode(types: TypeNode[]): UnionTypeNode {
706+
export function createUnionTypeNode(types: ReadonlyArray<TypeNode>): UnionTypeNode {
707707
return <UnionTypeNode>createUnionOrIntersectionTypeNode(SyntaxKind.UnionType, types);
708708
}
709709

710710
export function updateUnionTypeNode(node: UnionTypeNode, types: NodeArray<TypeNode>) {
711711
return updateUnionOrIntersectionTypeNode(node, types);
712712
}
713713

714-
export function createIntersectionTypeNode(types: TypeNode[]): IntersectionTypeNode {
714+
export function createIntersectionTypeNode(types: ReadonlyArray<TypeNode>): IntersectionTypeNode {
715715
return <IntersectionTypeNode>createUnionOrIntersectionTypeNode(SyntaxKind.IntersectionType, types);
716716
}
717717

@@ -2496,9 +2496,9 @@ namespace ts {
24962496

24972497
// Compound nodes
24982498

2499-
export function createImmediatelyInvokedFunctionExpression(statements: Statement[]): CallExpression;
2500-
export function createImmediatelyInvokedFunctionExpression(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression;
2501-
export function createImmediatelyInvokedFunctionExpression(statements: Statement[], param?: ParameterDeclaration, paramValue?: Expression) {
2499+
export function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>): CallExpression;
2500+
export function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
2501+
export function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param?: ParameterDeclaration, paramValue?: Expression) {
25022502
return createCall(
25032503
createFunctionExpression(
25042504
/*modifiers*/ undefined,
@@ -2514,9 +2514,9 @@ namespace ts {
25142514
);
25152515
}
25162516

2517-
export function createImmediatelyInvokedArrowFunction(statements: Statement[]): CallExpression;
2518-
export function createImmediatelyInvokedArrowFunction(statements: Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression;
2519-
export function createImmediatelyInvokedArrowFunction(statements: Statement[], param?: ParameterDeclaration, paramValue?: Expression) {
2517+
export function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray<Statement>): CallExpression;
2518+
export function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
2519+
export function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray<Statement>, param?: ParameterDeclaration, paramValue?: Expression) {
25202520
return createCall(
25212521
createArrowFunction(
25222522
/*modifiers*/ undefined,
@@ -3016,7 +3016,7 @@ namespace ts {
30163016
return createCall(createPropertyAccess(array, "slice"), /*typeArguments*/ undefined, argumentsList);
30173017
}
30183018

3019-
export function createArrayConcat(array: Expression, values: Expression[]) {
3019+
export function createArrayConcat(array: Expression, values: ReadonlyArray<Expression>) {
30203020
return createCall(
30213021
createPropertyAccess(array, "concat"),
30223022
/*typeArguments*/ undefined,
@@ -3068,7 +3068,7 @@ namespace ts {
30683068
);
30693069
}
30703070

3071-
export function createExpressionForJsxElement(jsxFactoryEntity: EntityName, reactNamespace: string, tagName: Expression, props: Expression, children: Expression[], parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression {
3071+
export function createExpressionForJsxElement(jsxFactoryEntity: EntityName, reactNamespace: string, tagName: Expression, props: Expression, children: ReadonlyArray<Expression>, parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression {
30723072
const argumentsList = [tagName];
30733073
if (props) {
30743074
argumentsList.push(props);
@@ -3100,7 +3100,7 @@ namespace ts {
31003100
);
31013101
}
31023102

3103-
export function createExpressionForJsxFragment(jsxFactoryEntity: EntityName, reactNamespace: string, children: Expression[], parentElement: JsxOpeningFragment, location: TextRange): LeftHandSideExpression {
3103+
export function createExpressionForJsxFragment(jsxFactoryEntity: EntityName, reactNamespace: string, children: ReadonlyArray<Expression>, parentElement: JsxOpeningFragment, location: TextRange): LeftHandSideExpression {
31043104
const tagName = createPropertyAccess(
31053105
createReactNamespace(reactNamespace, parentElement),
31063106
"Fragment"
@@ -3213,7 +3213,7 @@ namespace ts {
32133213
};`
32143214
};
32153215

3216-
export function createSpreadHelper(context: TransformationContext, argumentList: Expression[], location?: TextRange) {
3216+
export function createSpreadHelper(context: TransformationContext, argumentList: ReadonlyArray<Expression>, location?: TextRange) {
32173217
context.requestEmitHelper(readHelper);
32183218
context.requestEmitHelper(spreadHelper);
32193219
return setTextRange(
@@ -3383,7 +3383,7 @@ namespace ts {
33833383
return { target, thisArg };
33843384
}
33853385

3386-
export function inlineExpressions(expressions: Expression[]) {
3386+
export function inlineExpressions(expressions: ReadonlyArray<Expression>) {
33873387
// Avoid deeply nested comma expressions as traversing them during emit can result in "Maximum call
33883388
// stack size exceeded" errors.
33893389
return expressions.length > 10

0 commit comments

Comments
 (0)