Update factories to work with strictNullChecks
This commit is contained in:
parent
2e466c6d8f
commit
3a7874f138
|
@ -215,7 +215,7 @@ namespace ts {
|
|||
|
||||
// Signature elements
|
||||
|
||||
export function createParameter(decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: string | Identifier | BindingPattern, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression) {
|
||||
export function createParameter(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression) {
|
||||
const node = <ParameterDeclaration>createSynthesizedNode(SyntaxKind.Parameter);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -227,7 +227,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: BindingName, type: TypeNode, initializer: Expression) {
|
||||
export function updateParameter(node: ParameterDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.dotDotDotToken !== dotDotDotToken
|
||||
|
@ -252,7 +252,7 @@ namespace ts {
|
|||
|
||||
// Type members
|
||||
|
||||
export function createProperty(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, questionToken: QuestionToken, type: TypeNode, initializer: Expression) {
|
||||
export function createProperty(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression) {
|
||||
const node = <PropertyDeclaration>createSynthesizedNode(SyntaxKind.PropertyDeclaration);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -263,7 +263,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateProperty(node: PropertyDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, type: TypeNode, initializer: Expression) {
|
||||
export function updateProperty(node: PropertyDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, type: TypeNode | undefined, initializer: Expression) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -273,7 +273,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createMethod(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) {
|
||||
export function createMethod(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) {
|
||||
const node = <MethodDeclaration>createSynthesizedNode(SyntaxKind.MethodDeclaration);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -286,7 +286,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateMethod(node: MethodDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) {
|
||||
export function updateMethod(node: MethodDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -298,7 +298,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createConstructor(decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block) {
|
||||
export function createConstructor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined) {
|
||||
const node = <ConstructorDeclaration>createSynthesizedNode(SyntaxKind.Constructor);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -309,7 +309,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block) {
|
||||
export function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.parameters !== parameters
|
||||
|
@ -318,7 +318,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createGetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block) {
|
||||
export function createGetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) {
|
||||
const node = <GetAccessorDeclaration>createSynthesizedNode(SyntaxKind.GetAccessor);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -330,7 +330,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block) {
|
||||
export function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -341,7 +341,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createSetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], body: Block) {
|
||||
export function createSetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], body: Block | undefined) {
|
||||
const node = <SetAccessorDeclaration>createSynthesizedNode(SyntaxKind.SetAccessor);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -352,7 +352,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], body: Block) {
|
||||
export function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], body: Block | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -388,21 +388,21 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createBindingElement(propertyName: string | PropertyName, dotDotDotToken: DotDotDotToken, name: string | BindingName, initializer?: Expression) {
|
||||
export function createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression) {
|
||||
const node = <BindingElement>createSynthesizedNode(SyntaxKind.BindingElement);
|
||||
node.propertyName = asName(propertyName);
|
||||
node.dotDotDotToken = dotDotDotToken;
|
||||
node.propertyName = asName(propertyName);
|
||||
node.name = asName(name);
|
||||
node.initializer = initializer;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken, propertyName: PropertyName, name: BindingName, initializer: Expression) {
|
||||
export function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined) {
|
||||
return node.propertyName !== propertyName
|
||||
|| node.dotDotDotToken !== dotDotDotToken
|
||||
|| node.name !== name
|
||||
|| node.initializer !== initializer
|
||||
? updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer), node)
|
||||
? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node)
|
||||
: node;
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createCall(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]) {
|
||||
export function createCall(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]) {
|
||||
const node = <CallExpression>createSynthesizedNode(SyntaxKind.CallExpression);
|
||||
node.expression = parenthesizeForAccess(expression);
|
||||
node.typeArguments = asNodeArray(typeArguments);
|
||||
|
@ -478,7 +478,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]) {
|
||||
export function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]) {
|
||||
return expression !== node.expression
|
||||
|| typeArguments !== node.typeArguments
|
||||
|| argumentsArray !== node.arguments
|
||||
|
@ -486,7 +486,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createNew(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]) {
|
||||
export function createNew(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined) {
|
||||
const node = <NewExpression>createSynthesizedNode(SyntaxKind.NewExpression);
|
||||
node.expression = parenthesizeForNew(expression);
|
||||
node.typeArguments = asNodeArray(typeArguments);
|
||||
|
@ -494,7 +494,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]) {
|
||||
export function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined) {
|
||||
return node.expression !== expression
|
||||
|| node.typeArguments !== typeArguments
|
||||
|| node.arguments !== argumentsArray
|
||||
|
@ -542,7 +542,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createFunctionExpression(modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) {
|
||||
export function createFunctionExpression(modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block) {
|
||||
const node = <FunctionExpression>createSynthesizedNode(SyntaxKind.FunctionExpression);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
node.asteriskToken = asteriskToken;
|
||||
|
@ -554,7 +554,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) {
|
||||
export function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block) {
|
||||
return node.name !== name
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.typeParameters !== typeParameters
|
||||
|
@ -565,7 +565,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createArrowFunction(modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, equalsGreaterThanToken: EqualsGreaterThanToken, body: ConciseBody) {
|
||||
export function createArrowFunction(modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody) {
|
||||
const node = <ArrowFunction>createSynthesizedNode(SyntaxKind.ArrowFunction);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
node.typeParameters = asNodeArray(typeParameters);
|
||||
|
@ -576,7 +576,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: ConciseBody) {
|
||||
export function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: ConciseBody) {
|
||||
return node.modifiers !== modifiers
|
||||
|| node.typeParameters !== typeParameters
|
||||
|| node.parameters !== parameters
|
||||
|
@ -720,9 +720,10 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateYield(node: YieldExpression, expression: Expression) {
|
||||
export function updateYield(node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression) {
|
||||
return node.expression !== expression
|
||||
? updateNode(createYield(node.asteriskToken, expression), node)
|
||||
|| node.asteriskToken !== asteriskToken
|
||||
? updateNode(createYield(asteriskToken, expression), node)
|
||||
: node;
|
||||
}
|
||||
|
||||
|
@ -738,7 +739,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createClassExpression(modifiers: Modifier[], name: string | Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]) {
|
||||
export function createClassExpression(modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]) {
|
||||
const node = <ClassExpression>createSynthesizedNode(SyntaxKind.ClassExpression);
|
||||
node.decorators = undefined;
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -749,7 +750,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateClassExpression(node: ClassExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]) {
|
||||
export function updateClassExpression(node: ClassExpression, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]) {
|
||||
return node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|| node.typeParameters !== typeParameters
|
||||
|
@ -834,7 +835,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createVariableStatement(modifiers: Modifier[], declarationList: VariableDeclarationList | VariableDeclaration[]): VariableStatement {
|
||||
export function createVariableStatement(modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList | VariableDeclaration[]) {
|
||||
const node = <VariableStatement>createSynthesizedNode(SyntaxKind.VariableStatement);
|
||||
node.decorators = undefined;
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -842,14 +843,14 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateVariableStatement(node: VariableStatement, modifiers: Modifier[], declarationList: VariableDeclarationList): VariableStatement {
|
||||
export function updateVariableStatement(node: VariableStatement, modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList) {
|
||||
return node.modifiers !== modifiers
|
||||
|| node.declarationList !== declarationList
|
||||
? updateNode(createVariableStatement(modifiers, declarationList), node)
|
||||
: node;
|
||||
}
|
||||
|
||||
export function createVariableDeclarationList(declarations: VariableDeclaration[], flags?: NodeFlags): VariableDeclarationList {
|
||||
export function createVariableDeclarationList(declarations: VariableDeclaration[], flags?: NodeFlags) {
|
||||
const node = <VariableDeclarationList>createSynthesizedNode(SyntaxKind.VariableDeclarationList);
|
||||
node.flags |= flags;
|
||||
node.declarations = createNodeArray(declarations);
|
||||
|
@ -862,7 +863,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression): VariableDeclaration {
|
||||
export function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression) {
|
||||
const node = <VariableDeclaration>createSynthesizedNode(SyntaxKind.VariableDeclaration);
|
||||
node.name = asName(name);
|
||||
node.type = type;
|
||||
|
@ -870,7 +871,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode, initializer: Expression) {
|
||||
export function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined) {
|
||||
return node.name !== name
|
||||
|| node.type !== type
|
||||
|| node.initializer !== initializer
|
||||
|
@ -882,7 +883,7 @@ namespace ts {
|
|||
return <EmptyStatement>createSynthesizedNode(SyntaxKind.EmptyStatement);
|
||||
}
|
||||
|
||||
export function createStatement(expression: Expression): ExpressionStatement {
|
||||
export function createStatement(expression: Expression) {
|
||||
const node = <ExpressionStatement>createSynthesizedNode(SyntaxKind.ExpressionStatement);
|
||||
node.expression = parenthesizeExpressionForExpressionStatement(expression);
|
||||
return node;
|
||||
|
@ -902,7 +903,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement) {
|
||||
export function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined) {
|
||||
return node.expression !== expression
|
||||
|| node.thenStatement !== thenStatement
|
||||
|| node.elseStatement !== elseStatement
|
||||
|
@ -938,7 +939,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createFor(initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement) {
|
||||
export function createFor(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement) {
|
||||
const node = <ForStatement>createSynthesizedNode(SyntaxKind.ForStatement);
|
||||
node.initializer = initializer;
|
||||
node.condition = condition;
|
||||
|
@ -947,7 +948,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateFor(node: ForStatement, initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement) {
|
||||
export function updateFor(node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement) {
|
||||
return node.initializer !== initializer
|
||||
|| node.condition !== condition
|
||||
|| node.incrementor !== incrementor
|
||||
|
@ -994,7 +995,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateContinue(node: ContinueStatement, label: Identifier) {
|
||||
export function updateContinue(node: ContinueStatement, label: Identifier | undefined) {
|
||||
return node.label !== label
|
||||
? updateNode(createContinue(label), node)
|
||||
: node;
|
||||
|
@ -1006,7 +1007,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateBreak(node: BreakStatement, label: Identifier) {
|
||||
export function updateBreak(node: BreakStatement, label: Identifier | undefined) {
|
||||
return node.label !== label
|
||||
? updateNode(createBreak(label), node)
|
||||
: node;
|
||||
|
@ -1018,7 +1019,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateReturn(node: ReturnStatement, expression: Expression) {
|
||||
export function updateReturn(node: ReturnStatement, expression: Expression | undefined) {
|
||||
return node.expression !== expression
|
||||
? updateNode(createReturn(expression), node)
|
||||
: node;
|
||||
|
@ -1078,7 +1079,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createTry(tryBlock: Block, catchClause: CatchClause, finallyBlock: Block) {
|
||||
export function createTry(tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined) {
|
||||
const node = <TryStatement>createSynthesizedNode(SyntaxKind.TryStatement);
|
||||
node.tryBlock = tryBlock;
|
||||
node.catchClause = catchClause;
|
||||
|
@ -1086,7 +1087,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause, finallyBlock: Block) {
|
||||
export function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined) {
|
||||
return node.tryBlock !== tryBlock
|
||||
|| node.catchClause !== catchClause
|
||||
|| node.finallyBlock !== finallyBlock
|
||||
|
@ -1094,7 +1095,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createFunctionDeclaration(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) {
|
||||
export function createFunctionDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) {
|
||||
const node = <FunctionDeclaration>createSynthesizedNode(SyntaxKind.FunctionDeclaration);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -1107,7 +1108,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) {
|
||||
export function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -1119,7 +1120,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createClassDeclaration(decorators: Decorator[], modifiers: Modifier[], name: string | Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]) {
|
||||
export function createClassDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]) {
|
||||
const node = <ClassDeclaration>createSynthesizedNode(SyntaxKind.ClassDeclaration);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -1130,7 +1131,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]) {
|
||||
export function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -1141,7 +1142,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createEnumDeclaration(decorators: Decorator[], modifiers: Modifier[], name: string | Identifier, members: EnumMember[]) {
|
||||
export function createEnumDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, members: EnumMember[]) {
|
||||
const node = <EnumDeclaration>createSynthesizedNode(SyntaxKind.EnumDeclaration);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -1150,7 +1151,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateEnumDeclaration(node: EnumDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, members: EnumMember[]) {
|
||||
export function updateEnumDeclaration(node: EnumDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, members: EnumMember[]) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -1159,7 +1160,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createModuleDeclaration(decorators: Decorator[], modifiers: Modifier[], name: ModuleName, body: ModuleBody, flags?: NodeFlags) {
|
||||
export function createModuleDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags) {
|
||||
const node = <ModuleDeclaration>createSynthesizedNode(SyntaxKind.ModuleDeclaration);
|
||||
node.flags |= flags;
|
||||
node.decorators = asNodeArray(decorators);
|
||||
|
@ -1169,7 +1170,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateModuleDeclaration(node: ModuleDeclaration, decorators: Decorator[], modifiers: Modifier[], name: ModuleName, body: ModuleBody) {
|
||||
export function updateModuleDeclaration(node: ModuleDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -1202,7 +1203,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createImportEqualsDeclaration(decorators: Decorator[], modifiers: Modifier[], name: string | Identifier, moduleReference: ModuleReference) {
|
||||
export function createImportEqualsDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, moduleReference: ModuleReference) {
|
||||
const node = <ImportEqualsDeclaration>createSynthesizedNode(SyntaxKind.ImportEqualsDeclaration);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -1211,7 +1212,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, moduleReference: ModuleReference) {
|
||||
export function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, moduleReference: ModuleReference) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.name !== name
|
||||
|
@ -1220,7 +1221,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createImportDeclaration(decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier?: Expression): ImportDeclaration {
|
||||
export function createImportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier?: Expression): ImportDeclaration {
|
||||
const node = <ImportDeclaration>createSynthesizedNode(SyntaxKind.ImportDeclaration);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -1229,7 +1230,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier: Expression) {
|
||||
export function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier
|
||||
|
@ -1275,21 +1276,21 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createImportSpecifier(propertyName: Identifier, name: Identifier) {
|
||||
export function createImportSpecifier(propertyName: Identifier | undefined, name: Identifier) {
|
||||
const node = <ImportSpecifier>createSynthesizedNode(SyntaxKind.ImportSpecifier);
|
||||
node.propertyName = propertyName;
|
||||
node.name = name;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier, name: Identifier) {
|
||||
export function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier) {
|
||||
return node.propertyName !== propertyName
|
||||
|| node.name !== name
|
||||
? updateNode(createImportSpecifier(propertyName, name), node)
|
||||
: node;
|
||||
}
|
||||
|
||||
export function createExportAssignment(decorators: Decorator[], modifiers: Modifier[], isExportEquals: boolean, expression: Expression) {
|
||||
export function createExportAssignment(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, isExportEquals: boolean, expression: Expression) {
|
||||
const node = <ExportAssignment>createSynthesizedNode(SyntaxKind.ExportAssignment);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -1298,7 +1299,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateExportAssignment(node: ExportAssignment, decorators: Decorator[], modifiers: Modifier[], expression: Expression) {
|
||||
export function updateExportAssignment(node: ExportAssignment, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, expression: Expression) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.expression !== expression
|
||||
|
@ -1306,7 +1307,7 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createExportDeclaration(decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier?: Expression) {
|
||||
export function createExportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier?: Expression) {
|
||||
const node = <ExportDeclaration>createSynthesizedNode(SyntaxKind.ExportDeclaration);
|
||||
node.decorators = asNodeArray(decorators);
|
||||
node.modifiers = asNodeArray(modifiers);
|
||||
|
@ -1315,7 +1316,7 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier: Expression) {
|
||||
export function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier: Expression | undefined) {
|
||||
return node.decorators !== decorators
|
||||
|| node.modifiers !== modifiers
|
||||
|| node.exportClause !== exportClause
|
||||
|
@ -1336,16 +1337,17 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createExportSpecifier(name: string | Identifier, propertyName?: string | Identifier) {
|
||||
export function createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier) {
|
||||
const node = <ExportSpecifier>createSynthesizedNode(SyntaxKind.ExportSpecifier);
|
||||
node.name = asName(name);
|
||||
node.propertyName = asName(propertyName);
|
||||
node.name = asName(name);
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateExportSpecifier(node: ExportSpecifier, name: Identifier, propertyName: Identifier) {
|
||||
return node.name !== name || node.propertyName !== propertyName
|
||||
? updateNode(createExportSpecifier(name, propertyName), node)
|
||||
export function updateExportSpecifier(node: ExportSpecifier, propertyName: Identifier | undefined, name: Identifier) {
|
||||
return node.propertyName !== propertyName
|
||||
|| node.name !== name
|
||||
? updateNode(createExportSpecifier(propertyName, name), node)
|
||||
: node;
|
||||
}
|
||||
|
||||
|
@ -1547,26 +1549,26 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer: Expression) {
|
||||
export function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer?: Expression) {
|
||||
const node = <ShorthandPropertyAssignment>createSynthesizedNode(SyntaxKind.ShorthandPropertyAssignment);
|
||||
node.name = asName(name);
|
||||
node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createSpreadAssignment(expression: Expression) {
|
||||
const node = <SpreadAssignment>createSynthesizedNode(SyntaxKind.SpreadAssignment);
|
||||
node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression) {
|
||||
export function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined) {
|
||||
if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) {
|
||||
return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createSpreadAssignment(expression: Expression) {
|
||||
const node = <SpreadAssignment>createSynthesizedNode(SyntaxKind.SpreadAssignment);
|
||||
node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateSpreadAssignment(node: SpreadAssignment, expression: Expression) {
|
||||
if (node.expression !== expression) {
|
||||
return updateNode(createSpreadAssignment(expression), node);
|
||||
|
@ -1774,7 +1776,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
export function createExternalModuleExport(exportName: Identifier) {
|
||||
return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(exportName)]));
|
||||
return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(/*propertyName*/ undefined, exportName)]));
|
||||
}
|
||||
|
||||
// Utilities
|
||||
|
@ -1855,7 +1857,7 @@ namespace ts {
|
|||
/**
|
||||
* Gets flags that control emit behavior of a node.
|
||||
*/
|
||||
export function getEmitFlags(node: Node) {
|
||||
export function getEmitFlags(node: Node): EmitFlags | undefined {
|
||||
const emitNode = node.emitNode;
|
||||
return emitNode && emitNode.flags;
|
||||
}
|
||||
|
@ -1879,7 +1881,7 @@ namespace ts {
|
|||
/**
|
||||
* Sets a custom text range to use when emitting source maps.
|
||||
*/
|
||||
export function setSourceMapRange<T extends Node>(node: T, range: TextRange) {
|
||||
export function setSourceMapRange<T extends Node>(node: T, range: TextRange | undefined) {
|
||||
getOrCreateEmitNode(node).sourceMapRange = range;
|
||||
return node;
|
||||
}
|
||||
|
@ -1887,7 +1889,7 @@ namespace ts {
|
|||
/**
|
||||
* Gets the TextRange to use for source maps for a token of a node.
|
||||
*/
|
||||
export function getTokenSourceMapRange(node: Node, token: SyntaxKind) {
|
||||
export function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange | undefined {
|
||||
const emitNode = node.emitNode;
|
||||
const tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges;
|
||||
return tokenSourceMapRanges && tokenSourceMapRanges[token];
|
||||
|
@ -1896,7 +1898,7 @@ namespace ts {
|
|||
/**
|
||||
* Sets the TextRange to use for source maps for a token of a node.
|
||||
*/
|
||||
export function setTokenSourceMapRange<T extends Node>(node: T, token: SyntaxKind, range: TextRange) {
|
||||
export function setTokenSourceMapRange<T extends Node>(node: T, token: SyntaxKind, range: TextRange | undefined) {
|
||||
const emitNode = getOrCreateEmitNode(node);
|
||||
const tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []);
|
||||
tokenSourceMapRanges[token] = range;
|
||||
|
@ -2019,7 +2021,7 @@ namespace ts {
|
|||
return compareValues(x.priority, y.priority);
|
||||
}
|
||||
|
||||
export function setOriginalNode<T extends Node>(node: T, original: Node): T {
|
||||
export function setOriginalNode<T extends Node>(node: T, original: Node | undefined): T {
|
||||
node.original = original;
|
||||
if (original) {
|
||||
const emitNode = original.emitNode;
|
||||
|
|
|
@ -448,7 +448,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
function makeBindingElement(name: Identifier) {
|
||||
return createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name);
|
||||
return createBindingElement(/*dotDotDotToken*/ undefined, /*propertyName*/ undefined, name);
|
||||
}
|
||||
|
||||
function makeAssignmentElement(name: Identifier) {
|
||||
|
|
|
@ -875,6 +875,7 @@ namespace ts {
|
|||
|
||||
case SyntaxKind.YieldExpression:
|
||||
return updateYield(<YieldExpression>node,
|
||||
(<YieldExpression>node).asteriskToken,
|
||||
visitNode((<YieldExpression>node).expression, visitor, isExpression));
|
||||
|
||||
case SyntaxKind.SpreadElement:
|
||||
|
|
Loading…
Reference in a new issue