How to use isTypeNode method in stryker-parent

Best JavaScript code snippet using stryker-parent

visitorPublic.ts

Source:visitorPublic.ts Github

copy

Full Screen

1namespace ts {2 const isTypeNodeOrTypeParameterDeclaration = or(isTypeNode, isTypeParameterDeclaration);34 /**5 * Visits a Node using the supplied visitor, possibly returning a new Node in its place.6 *7 * @param node The Node to visit.8 * @param visitor The callback used to visit the Node.9 * @param test A callback to execute to verify the Node is valid.10 * @param lift An optional callback to execute to lift a NodeArray into a valid Node.11 */12 export function visitNode<T extends Node>(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: NodeArray<Node>) => T): T;1314 /**15 * Visits a Node using the supplied visitor, possibly returning a new Node in its place.16 *17 * @param node The Node to visit.18 * @param visitor The callback used to visit the Node.19 * @param test A callback to execute to verify the Node is valid.20 * @param lift An optional callback to execute to lift a NodeArray into a valid Node.21 */22 export function visitNode<T extends Node>(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: NodeArray<Node>) => T): T | undefined;2324 export function visitNode<T extends Node>(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: NodeArray<Node>) => T): T | undefined {25 if (node === undefined || visitor === undefined) {26 return node;27 }2829 aggregateTransformFlags(node);30 const visited = visitor(node);31 if (visited === node) {32 return node;33 }3435 let visitedNode: Node | undefined;36 if (visited === undefined) {37 return undefined;38 }39 else if (isArray(visited)) {40 visitedNode = (lift || extractSingleNode)(visited);41 }42 else {43 visitedNode = visited;44 }4546 Debug.assertNode(visitedNode, test);47 aggregateTransformFlags(visitedNode!);48 return <T>visitedNode;49 }5051 /**52 * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.53 *54 * @param nodes The NodeArray to visit.55 * @param visitor The callback used to visit a Node.56 * @param test A node test to execute for each node.57 * @param start An optional value indicating the starting offset at which to start visiting.58 * @param count An optional value indicating the maximum number of nodes to visit.59 */60 export function visitNodes<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;6162 /**63 * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.64 *65 * @param nodes The NodeArray to visit.66 * @param visitor The callback used to visit a Node.67 * @param test A node test to execute for each node.68 * @param start An optional value indicating the starting offset at which to start visiting.69 * @param count An optional value indicating the maximum number of nodes to visit.70 */71 export function visitNodes<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;7273 /**74 * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.75 *76 * @param nodes The NodeArray to visit.77 * @param visitor The callback used to visit a Node.78 * @param test A node test to execute for each node.79 * @param start An optional value indicating the starting offset at which to start visiting.80 * @param count An optional value indicating the maximum number of nodes to visit.81 */82 export function visitNodes<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined {83 if (nodes === undefined || visitor === undefined) {84 return nodes;85 }8687 let updated: MutableNodeArray<T> | undefined;8889 // Ensure start and count have valid values90 const length = nodes.length;91 if (start === undefined || start < 0) {92 start = 0;93 }9495 if (count === undefined || count > length - start) {96 count = length - start;97 }9899 if (start > 0 || count < length) {100 // If we are not visiting all of the original nodes, we must always create a new array.101 // Since this is a fragment of a node array, we do not copy over the previous location102 // and will only copy over `hasTrailingComma` if we are including the last element.103 updated = createNodeArray<T>([], /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length);104 }105106 // Visit each original node.107 for (let i = 0; i < count; i++) {108 const node = nodes[i + start];109 aggregateTransformFlags(node);110 const visited = node !== undefined ? visitor(node) : undefined;111 if (updated !== undefined || visited === undefined || visited !== node) {112 if (updated === undefined) {113 // Ensure we have a copy of `nodes`, up to the current index.114 updated = createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma);115 setTextRange(updated, nodes);116 }117 if (visited) {118 if (isArray(visited)) {119 for (const visitedNode of visited) {120 Debug.assertNode(visitedNode, test);121 aggregateTransformFlags(visitedNode);122 updated.push(<T>visitedNode);123 }124 }125 else {126 Debug.assertNode(visited, test);127 aggregateTransformFlags(visited);128 updated.push(<T>visited);129 }130 }131 }132 }133134 return updated || nodes;135 }136137 /**138 * Starts a new lexical environment and visits a statement list, ending the lexical environment139 * and merging hoisted declarations upon completion.140 */141 export function visitLexicalEnvironment(statements: NodeArray<Statement>, visitor: Visitor, context: TransformationContext, start?: number, ensureUseStrict?: boolean) {142 context.startLexicalEnvironment();143 statements = visitNodes(statements, visitor, isStatement, start);144 if (ensureUseStrict) statements = ts.ensureUseStrict(statements); // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier145 return mergeLexicalEnvironment(statements, context.endLexicalEnvironment());146 }147148 /**149 * Starts a new lexical environment and visits a parameter list, suspending the lexical150 * environment upon completion.151 */152 export function visitParameterList(nodes: NodeArray<ParameterDeclaration> | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor = visitNodes) {153 context.startLexicalEnvironment();154 const updated = nodesVisitor(nodes, visitor, isParameterDeclaration);155 context.suspendLexicalEnvironment();156 return updated;157 }158159 /**160 * Resumes a suspended lexical environment and visits a function body, ending the lexical161 * environment and merging hoisted declarations upon completion.162 */163 export function visitFunctionBody(node: FunctionBody, visitor: Visitor, context: TransformationContext): FunctionBody;164 /**165 * Resumes a suspended lexical environment and visits a function body, ending the lexical166 * environment and merging hoisted declarations upon completion.167 */168 export function visitFunctionBody(node: FunctionBody | undefined, visitor: Visitor, context: TransformationContext): FunctionBody | undefined;169 /**170 * Resumes a suspended lexical environment and visits a concise body, ending the lexical171 * environment and merging hoisted declarations upon completion.172 */173 export function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody;174 export function visitFunctionBody(node: ConciseBody | undefined, visitor: Visitor, context: TransformationContext): ConciseBody | undefined {175 context.resumeLexicalEnvironment();176 const updated = visitNode(node, visitor, isConciseBody);177 const declarations = context.endLexicalEnvironment();178 if (some(declarations)) {179 const block = convertToFunctionBody(updated);180 const statements = mergeLexicalEnvironment(block.statements, declarations);181 return updateBlock(block, statements);182 }183 return updated;184 }185186 /**187 * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.188 *189 * @param node The Node whose children will be visited.190 * @param visitor The callback used to visit each child.191 * @param context A lexical environment context for the visitor.192 */193 export function visitEachChild<T extends Node>(node: T, visitor: Visitor, context: TransformationContext): T;194195 /**196 * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.197 *198 * @param node The Node whose children will be visited.199 * @param visitor The callback used to visit each child.200 * @param context A lexical environment context for the visitor.201 */202 export function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;203204 export function visitEachChild(node: Node | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor = visitNodes, tokenVisitor?: Visitor): Node | undefined {205 if (node === undefined) {206 return undefined;207 }208209 const kind = node.kind;210211 // No need to visit nodes with no children.212 if ((kind > SyntaxKind.FirstToken && kind <= SyntaxKind.LastToken) || kind === SyntaxKind.ThisType) {213 return node;214 }215216 switch (kind) {217 // Names218219 case SyntaxKind.Identifier:220 return updateIdentifier(<Identifier>node, nodesVisitor((<Identifier>node).typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration));221222 case SyntaxKind.QualifiedName:223 return updateQualifiedName(<QualifiedName>node,224 visitNode((<QualifiedName>node).left, visitor, isEntityName),225 visitNode((<QualifiedName>node).right, visitor, isIdentifier));226227 case SyntaxKind.ComputedPropertyName:228 return updateComputedPropertyName(<ComputedPropertyName>node,229 visitNode((<ComputedPropertyName>node).expression, visitor, isExpression));230231 // Signature elements232 case SyntaxKind.TypeParameter:233 return updateTypeParameterDeclaration(<TypeParameterDeclaration>node,234 visitNode((<TypeParameterDeclaration>node).name, visitor, isIdentifier),235 visitNode((<TypeParameterDeclaration>node).constraint, visitor, isTypeNode),236 visitNode((<TypeParameterDeclaration>node).default, visitor, isTypeNode));237238 case SyntaxKind.Parameter:239 return updateParameter(<ParameterDeclaration>node,240 nodesVisitor((<ParameterDeclaration>node).decorators, visitor, isDecorator),241 nodesVisitor((<ParameterDeclaration>node).modifiers, visitor, isModifier),242 visitNode((<ParameterDeclaration>node).dotDotDotToken, tokenVisitor, isToken),243 visitNode((<ParameterDeclaration>node).name, visitor, isBindingName),244 visitNode((<ParameterDeclaration>node).questionToken, tokenVisitor, isToken),245 visitNode((<ParameterDeclaration>node).type, visitor, isTypeNode),246 visitNode((<ParameterDeclaration>node).initializer, visitor, isExpression));247248 case SyntaxKind.Decorator:249 return updateDecorator(<Decorator>node,250 visitNode((<Decorator>node).expression, visitor, isExpression));251252 // Type elements253 case SyntaxKind.PropertySignature:254 return updatePropertySignature((<PropertySignature>node),255 nodesVisitor((<PropertySignature>node).modifiers, visitor, isToken),256 visitNode((<PropertySignature>node).name, visitor, isPropertyName),257 visitNode((<PropertySignature>node).questionToken, tokenVisitor, isToken),258 visitNode((<PropertySignature>node).type, visitor, isTypeNode),259 visitNode((<PropertySignature>node).initializer, visitor, isExpression));260261 case SyntaxKind.PropertyDeclaration:262 return updateProperty(<PropertyDeclaration>node,263 nodesVisitor((<PropertyDeclaration>node).decorators, visitor, isDecorator),264 nodesVisitor((<PropertyDeclaration>node).modifiers, visitor, isModifier),265 visitNode((<PropertyDeclaration>node).name, visitor, isPropertyName),266 // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too267 visitNode((<PropertyDeclaration>node).questionToken || (<PropertyDeclaration>node).exclamationToken, tokenVisitor, isToken),268 visitNode((<PropertyDeclaration>node).type, visitor, isTypeNode),269 visitNode((<PropertyDeclaration>node).initializer, visitor, isExpression));270271 case SyntaxKind.MethodSignature:272 return updateMethodSignature(<MethodSignature>node,273 nodesVisitor((<MethodSignature>node).typeParameters, visitor, isTypeParameterDeclaration),274 nodesVisitor((<MethodSignature>node).parameters, visitor, isParameterDeclaration),275 visitNode((<MethodSignature>node).type, visitor, isTypeNode),276 visitNode((<MethodSignature>node).name, visitor, isPropertyName),277 visitNode((<MethodSignature>node).questionToken, tokenVisitor, isToken));278279 case SyntaxKind.MethodDeclaration:280 return updateMethod(<MethodDeclaration>node,281 nodesVisitor((<MethodDeclaration>node).decorators, visitor, isDecorator),282 nodesVisitor((<MethodDeclaration>node).modifiers, visitor, isModifier),283 visitNode((<MethodDeclaration>node).asteriskToken, tokenVisitor, isToken),284 visitNode((<MethodDeclaration>node).name, visitor, isPropertyName),285 visitNode((<MethodDeclaration>node).questionToken, tokenVisitor, isToken),286 nodesVisitor((<MethodDeclaration>node).typeParameters, visitor, isTypeParameterDeclaration),287 visitParameterList((<MethodDeclaration>node).parameters, visitor, context, nodesVisitor),288 visitNode((<MethodDeclaration>node).type, visitor, isTypeNode),289 visitFunctionBody((<MethodDeclaration>node).body!, visitor, context));290291 case SyntaxKind.Constructor:292 return updateConstructor(<ConstructorDeclaration>node,293 nodesVisitor((<ConstructorDeclaration>node).decorators, visitor, isDecorator),294 nodesVisitor((<ConstructorDeclaration>node).modifiers, visitor, isModifier),295 visitParameterList((<ConstructorDeclaration>node).parameters, visitor, context, nodesVisitor),296 visitFunctionBody((<ConstructorDeclaration>node).body!, visitor, context));297298 case SyntaxKind.GetAccessor:299 return updateGetAccessor(<GetAccessorDeclaration>node,300 nodesVisitor((<GetAccessorDeclaration>node).decorators, visitor, isDecorator),301 nodesVisitor((<GetAccessorDeclaration>node).modifiers, visitor, isModifier),302 visitNode((<GetAccessorDeclaration>node).name, visitor, isPropertyName),303 visitParameterList((<GetAccessorDeclaration>node).parameters, visitor, context, nodesVisitor),304 visitNode((<GetAccessorDeclaration>node).type, visitor, isTypeNode),305 visitFunctionBody((<GetAccessorDeclaration>node).body!, visitor, context));306307 case SyntaxKind.SetAccessor:308 return updateSetAccessor(<SetAccessorDeclaration>node,309 nodesVisitor((<SetAccessorDeclaration>node).decorators, visitor, isDecorator),310 nodesVisitor((<SetAccessorDeclaration>node).modifiers, visitor, isModifier),311 visitNode((<SetAccessorDeclaration>node).name, visitor, isPropertyName),312 visitParameterList((<SetAccessorDeclaration>node).parameters, visitor, context, nodesVisitor),313 visitFunctionBody((<SetAccessorDeclaration>node).body!, visitor, context));314315 case SyntaxKind.CallSignature:316 return updateCallSignature(<CallSignatureDeclaration>node,317 nodesVisitor((<CallSignatureDeclaration>node).typeParameters, visitor, isTypeParameterDeclaration),318 nodesVisitor((<CallSignatureDeclaration>node).parameters, visitor, isParameterDeclaration),319 visitNode((<CallSignatureDeclaration>node).type, visitor, isTypeNode));320321 case SyntaxKind.ConstructSignature:322 return updateConstructSignature(<ConstructSignatureDeclaration>node,323 nodesVisitor((<ConstructSignatureDeclaration>node).typeParameters, visitor, isTypeParameterDeclaration),324 nodesVisitor((<ConstructSignatureDeclaration>node).parameters, visitor, isParameterDeclaration),325 visitNode((<ConstructSignatureDeclaration>node).type, visitor, isTypeNode));326327 case SyntaxKind.IndexSignature:328 return updateIndexSignature(<IndexSignatureDeclaration>node,329 nodesVisitor((<IndexSignatureDeclaration>node).decorators, visitor, isDecorator),330 nodesVisitor((<IndexSignatureDeclaration>node).modifiers, visitor, isModifier),331 nodesVisitor((<IndexSignatureDeclaration>node).parameters, visitor, isParameterDeclaration),332 visitNode((<IndexSignatureDeclaration>node).type, visitor, isTypeNode));333334 // Types335 case SyntaxKind.TypePredicate:336 return updateTypePredicateNodeWithModifier(<TypePredicateNode>node,337 visitNode((<TypePredicateNode>node).assertsModifier, visitor),338 visitNode((<TypePredicateNode>node).parameterName, visitor),339 visitNode((<TypePredicateNode>node).type, visitor, isTypeNode));340341 case SyntaxKind.TypeReference:342 return updateTypeReferenceNode(<TypeReferenceNode>node,343 visitNode((<TypeReferenceNode>node).typeName, visitor, isEntityName),344 nodesVisitor((<TypeReferenceNode>node).typeArguments, visitor, isTypeNode));345346 case SyntaxKind.FunctionType:347 return updateFunctionTypeNode(<FunctionTypeNode>node,348 nodesVisitor((<FunctionTypeNode>node).typeParameters, visitor, isTypeParameterDeclaration),349 nodesVisitor((<FunctionTypeNode>node).parameters, visitor, isParameterDeclaration),350 visitNode((<FunctionTypeNode>node).type, visitor, isTypeNode));351352 case SyntaxKind.ConstructorType:353 return updateConstructorTypeNode(<ConstructorTypeNode>node,354 nodesVisitor((<ConstructorTypeNode>node).typeParameters, visitor, isTypeParameterDeclaration),355 nodesVisitor((<ConstructorTypeNode>node).parameters, visitor, isParameterDeclaration),356 visitNode((<ConstructorTypeNode>node).type, visitor, isTypeNode));357358 case SyntaxKind.TypeQuery:359 return updateTypeQueryNode((<TypeQueryNode>node),360 visitNode((<TypeQueryNode>node).exprName, visitor, isEntityName));361362 case SyntaxKind.TypeLiteral:363 return updateTypeLiteralNode((<TypeLiteralNode>node),364 nodesVisitor((<TypeLiteralNode>node).members, visitor, isTypeElement));365366 case SyntaxKind.ArrayType:367 return updateArrayTypeNode(<ArrayTypeNode>node,368 visitNode((<ArrayTypeNode>node).elementType, visitor, isTypeNode));369370 case SyntaxKind.TupleType:371 return updateTupleTypeNode((<TupleTypeNode>node),372 nodesVisitor((<TupleTypeNode>node).elementTypes, visitor, isTypeNode));373374 case SyntaxKind.OptionalType:375 return updateOptionalTypeNode((<OptionalTypeNode>node),376 visitNode((<OptionalTypeNode>node).type, visitor, isTypeNode));377378 case SyntaxKind.RestType:379 return updateRestTypeNode((<RestTypeNode>node),380 visitNode((<RestTypeNode>node).type, visitor, isTypeNode));381382 case SyntaxKind.UnionType:383 return updateUnionTypeNode(<UnionTypeNode>node,384 nodesVisitor((<UnionTypeNode>node).types, visitor, isTypeNode));385386 case SyntaxKind.IntersectionType:387 return updateIntersectionTypeNode(<IntersectionTypeNode>node,388 nodesVisitor((<IntersectionTypeNode>node).types, visitor, isTypeNode));389390 case SyntaxKind.ConditionalType:391 return updateConditionalTypeNode(<ConditionalTypeNode>node,392 visitNode((<ConditionalTypeNode>node).checkType, visitor, isTypeNode),393 visitNode((<ConditionalTypeNode>node).extendsType, visitor, isTypeNode),394 visitNode((<ConditionalTypeNode>node).trueType, visitor, isTypeNode),395 visitNode((<ConditionalTypeNode>node).falseType, visitor, isTypeNode));396397 case SyntaxKind.InferType:398 return updateInferTypeNode(<InferTypeNode>node,399 visitNode((<InferTypeNode>node).typeParameter, visitor, isTypeParameterDeclaration));400401 case SyntaxKind.ImportType:402 return updateImportTypeNode(<ImportTypeNode>node,403 visitNode((<ImportTypeNode>node).argument, visitor, isTypeNode),404 visitNode((<ImportTypeNode>node).qualifier, visitor, isEntityName),405 visitNodes((<ImportTypeNode>node).typeArguments, visitor, isTypeNode),406 (<ImportTypeNode>node).isTypeOf407 );408409 case SyntaxKind.ParenthesizedType:410 return updateParenthesizedType(<ParenthesizedTypeNode>node,411 visitNode((<ParenthesizedTypeNode>node).type, visitor, isTypeNode));412413 case SyntaxKind.TypeOperator:414 return updateTypeOperatorNode(<TypeOperatorNode>node,415 visitNode((<TypeOperatorNode>node).type, visitor, isTypeNode));416417 case SyntaxKind.IndexedAccessType:418 return updateIndexedAccessTypeNode((<IndexedAccessTypeNode>node),419 visitNode((<IndexedAccessTypeNode>node).objectType, visitor, isTypeNode),420 visitNode((<IndexedAccessTypeNode>node).indexType, visitor, isTypeNode));421422 case SyntaxKind.MappedType:423 return updateMappedTypeNode((<MappedTypeNode>node),424 visitNode((<MappedTypeNode>node).readonlyToken, tokenVisitor, isToken),425 visitNode((<MappedTypeNode>node).typeParameter, visitor, isTypeParameterDeclaration),426 visitNode((<MappedTypeNode>node).questionToken, tokenVisitor, isToken),427 visitNode((<MappedTypeNode>node).type, visitor, isTypeNode));428429 case SyntaxKind.LiteralType:430 return updateLiteralTypeNode(<LiteralTypeNode>node,431 visitNode((<LiteralTypeNode>node).literal, visitor, isExpression));432433 // Binding patterns434 case SyntaxKind.ObjectBindingPattern:435 return updateObjectBindingPattern(<ObjectBindingPattern>node,436 nodesVisitor((<ObjectBindingPattern>node).elements, visitor, isBindingElement));437438 case SyntaxKind.ArrayBindingPattern:439 return updateArrayBindingPattern(<ArrayBindingPattern>node,440 nodesVisitor((<ArrayBindingPattern>node).elements, visitor, isArrayBindingElement));441442 case SyntaxKind.BindingElement:443 return updateBindingElement(<BindingElement>node,444 visitNode((<BindingElement>node).dotDotDotToken, tokenVisitor, isToken),445 visitNode((<BindingElement>node).propertyName, visitor, isPropertyName),446 visitNode((<BindingElement>node).name, visitor, isBindingName),447 visitNode((<BindingElement>node).initializer, visitor, isExpression));448449 // Expression450 case SyntaxKind.ArrayLiteralExpression:451 return updateArrayLiteral(<ArrayLiteralExpression>node,452 nodesVisitor((<ArrayLiteralExpression>node).elements, visitor, isExpression));453454 case SyntaxKind.ObjectLiteralExpression:455 return updateObjectLiteral(<ObjectLiteralExpression>node,456 nodesVisitor((<ObjectLiteralExpression>node).properties, visitor, isObjectLiteralElementLike));457458 case SyntaxKind.PropertyAccessExpression:459 if (node.flags & NodeFlags.OptionalChain) {460 return updatePropertyAccessChain(<PropertyAccessChain>node,461 visitNode((<PropertyAccessChain>node).expression, visitor, isExpression),462 visitNode((<PropertyAccessChain>node).questionDotToken, visitor, isToken),463 visitNode((<PropertyAccessChain>node).name, visitor, isIdentifier));464 }465 return updatePropertyAccess(<PropertyAccessExpression>node,466 visitNode((<PropertyAccessExpression>node).expression, visitor, isExpression),467 visitNode((<PropertyAccessExpression>node).name, visitor, isIdentifier));468469 case SyntaxKind.ElementAccessExpression:470 if (node.flags & NodeFlags.OptionalChain) {471 return updateElementAccessChain(<ElementAccessChain>node,472 visitNode((<ElementAccessChain>node).expression, visitor, isExpression),473 visitNode((<ElementAccessChain>node).questionDotToken, visitor, isToken),474 visitNode((<ElementAccessChain>node).argumentExpression, visitor, isExpression));475 }476 return updateElementAccess(<ElementAccessExpression>node,477 visitNode((<ElementAccessExpression>node).expression, visitor, isExpression),478 visitNode((<ElementAccessExpression>node).argumentExpression, visitor, isExpression));479480 case SyntaxKind.CallExpression:481 if (node.flags & NodeFlags.OptionalChain) {482 return updateCallChain(<CallChain>node,483 visitNode((<CallChain>node).expression, visitor, isExpression),484 visitNode((<CallChain>node).questionDotToken, visitor, isToken),485 nodesVisitor((<CallChain>node).typeArguments, visitor, isTypeNode),486 nodesVisitor((<CallChain>node).arguments, visitor, isExpression));487 }488 return updateCall(<CallExpression>node,489 visitNode((<CallExpression>node).expression, visitor, isExpression),490 nodesVisitor((<CallExpression>node).typeArguments, visitor, isTypeNode),491 nodesVisitor((<CallExpression>node).arguments, visitor, isExpression));492493 case SyntaxKind.NewExpression:494 return updateNew(<NewExpression>node,495 visitNode((<NewExpression>node).expression, visitor, isExpression),496 nodesVisitor((<NewExpression>node).typeArguments, visitor, isTypeNode),497 nodesVisitor((<NewExpression>node).arguments, visitor, isExpression));498499 case SyntaxKind.TaggedTemplateExpression:500 return updateTaggedTemplate(<TaggedTemplateExpression>node,501 visitNode((<TaggedTemplateExpression>node).tag, visitor, isExpression),502 visitNodes((<TaggedTemplateExpression>node).typeArguments, visitor, isExpression),503 visitNode((<TaggedTemplateExpression>node).template, visitor, isTemplateLiteral));504505 case SyntaxKind.TypeAssertionExpression:506 return updateTypeAssertion(<TypeAssertion>node,507 visitNode((<TypeAssertion>node).type, visitor, isTypeNode),508 visitNode((<TypeAssertion>node).expression, visitor, isExpression));509510 case SyntaxKind.ParenthesizedExpression:511 return updateParen(<ParenthesizedExpression>node,512 visitNode((<ParenthesizedExpression>node).expression, visitor, isExpression));513514 case SyntaxKind.FunctionExpression:515 return updateFunctionExpression(<FunctionExpression>node,516 nodesVisitor((<FunctionExpression>node).modifiers, visitor, isModifier),517 visitNode((<FunctionExpression>node).asteriskToken, tokenVisitor, isToken),518 visitNode((<FunctionExpression>node).name, visitor, isIdentifier),519 nodesVisitor((<FunctionExpression>node).typeParameters, visitor, isTypeParameterDeclaration),520 visitParameterList((<FunctionExpression>node).parameters, visitor, context, nodesVisitor),521 visitNode((<FunctionExpression>node).type, visitor, isTypeNode),522 visitFunctionBody((<FunctionExpression>node).body, visitor, context));523524 case SyntaxKind.ArrowFunction:525 return updateArrowFunction(<ArrowFunction>node,526 nodesVisitor((<ArrowFunction>node).modifiers, visitor, isModifier),527 nodesVisitor((<ArrowFunction>node).typeParameters, visitor, isTypeParameterDeclaration),528 visitParameterList((<ArrowFunction>node).parameters, visitor, context, nodesVisitor),529 visitNode((<ArrowFunction>node).type, visitor, isTypeNode),530 visitNode((<ArrowFunction>node).equalsGreaterThanToken, visitor, isToken),531 visitFunctionBody((<ArrowFunction>node).body, visitor, context));532533 case SyntaxKind.DeleteExpression:534 return updateDelete(<DeleteExpression>node,535 visitNode((<DeleteExpression>node).expression, visitor, isExpression));536537 case SyntaxKind.TypeOfExpression:538 return updateTypeOf(<TypeOfExpression>node,539 visitNode((<TypeOfExpression>node).expression, visitor, isExpression));540541 case SyntaxKind.VoidExpression:542 return updateVoid(<VoidExpression>node,543 visitNode((<VoidExpression>node).expression, visitor, isExpression));544545 case SyntaxKind.AwaitExpression:546 return updateAwait(<AwaitExpression>node,547 visitNode((<AwaitExpression>node).expression, visitor, isExpression));548549 case SyntaxKind.PrefixUnaryExpression:550 return updatePrefix(<PrefixUnaryExpression>node,551 visitNode((<PrefixUnaryExpression>node).operand, visitor, isExpression));552553 case SyntaxKind.PostfixUnaryExpression:554 return updatePostfix(<PostfixUnaryExpression>node,555 visitNode((<PostfixUnaryExpression>node).operand, visitor, isExpression));556557 case SyntaxKind.BinaryExpression:558 return updateBinary(<BinaryExpression>node,559 visitNode((<BinaryExpression>node).left, visitor, isExpression),560 visitNode((<BinaryExpression>node).right, visitor, isExpression),561 visitNode((<BinaryExpression>node).operatorToken, visitor, isToken));562563 case SyntaxKind.ConditionalExpression:564 return updateConditional(<ConditionalExpression>node,565 visitNode((<ConditionalExpression>node).condition, visitor, isExpression),566 visitNode((<ConditionalExpression>node).questionToken, visitor, isToken),567 visitNode((<ConditionalExpression>node).whenTrue, visitor, isExpression),568 visitNode((<ConditionalExpression>node).colonToken, visitor, isToken),569 visitNode((<ConditionalExpression>node).whenFalse, visitor, isExpression));570571 case SyntaxKind.TemplateExpression:572 return updateTemplateExpression(<TemplateExpression>node,573 visitNode((<TemplateExpression>node).head, visitor, isTemplateHead),574 nodesVisitor((<TemplateExpression>node).templateSpans, visitor, isTemplateSpan));575576 case SyntaxKind.YieldExpression:577 return updateYield(<YieldExpression>node,578 visitNode((<YieldExpression>node).asteriskToken, tokenVisitor, isToken),579 visitNode((<YieldExpression>node).expression, visitor, isExpression));580581 case SyntaxKind.SpreadElement:582 return updateSpread(<SpreadElement>node,583 visitNode((<SpreadElement>node).expression, visitor, isExpression));584585 case SyntaxKind.ClassExpression:586 return updateClassExpression(<ClassExpression>node,587 nodesVisitor((<ClassExpression>node).modifiers, visitor, isModifier),588 visitNode((<ClassExpression>node).name, visitor, isIdentifier),589 nodesVisitor((<ClassExpression>node).typeParameters, visitor, isTypeParameterDeclaration),590 nodesVisitor((<ClassExpression>node).heritageClauses, visitor, isHeritageClause),591 nodesVisitor((<ClassExpression>node).members, visitor, isClassElement));592593 case SyntaxKind.ExpressionWithTypeArguments:594 return updateExpressionWithTypeArguments(<ExpressionWithTypeArguments>node,595 nodesVisitor((<ExpressionWithTypeArguments>node).typeArguments, visitor, isTypeNode),596 visitNode((<ExpressionWithTypeArguments>node).expression, visitor, isExpression));597598 case SyntaxKind.AsExpression:599 return updateAsExpression(<AsExpression>node,600 visitNode((<AsExpression>node).expression, visitor, isExpression),601 visitNode((<AsExpression>node).type, visitor, isTypeNode));602603 case SyntaxKind.NonNullExpression:604 return updateNonNullExpression(<NonNullExpression>node,605 visitNode((<NonNullExpression>node).expression, visitor, isExpression));606607 case SyntaxKind.MetaProperty:608 return updateMetaProperty(<MetaProperty>node,609 visitNode((<MetaProperty>node).name, visitor, isIdentifier));610611 // Misc612 case SyntaxKind.TemplateSpan:613 return updateTemplateSpan(<TemplateSpan>node,614 visitNode((<TemplateSpan>node).expression, visitor, isExpression),615 visitNode((<TemplateSpan>node).literal, visitor, isTemplateMiddleOrTemplateTail));616617 // Element618 case SyntaxKind.Block:619 return updateBlock(<Block>node,620 nodesVisitor((<Block>node).statements, visitor, isStatement));621622 case SyntaxKind.VariableStatement:623 return updateVariableStatement(<VariableStatement>node,624 nodesVisitor((<VariableStatement>node).modifiers, visitor, isModifier),625 visitNode((<VariableStatement>node).declarationList, visitor, isVariableDeclarationList));626627 case SyntaxKind.ExpressionStatement:628 return updateExpressionStatement(<ExpressionStatement>node,629 visitNode((<ExpressionStatement>node).expression, visitor, isExpression));630631 case SyntaxKind.IfStatement:632 return updateIf(<IfStatement>node,633 visitNode((<IfStatement>node).expression, visitor, isExpression),634 visitNode((<IfStatement>node).thenStatement, visitor, isStatement, liftToBlock),635 visitNode((<IfStatement>node).elseStatement, visitor, isStatement, liftToBlock));636637 case SyntaxKind.DoStatement:638 return updateDo(<DoStatement>node,639 visitNode((<DoStatement>node).statement, visitor, isStatement, liftToBlock),640 visitNode((<DoStatement>node).expression, visitor, isExpression));641642 case SyntaxKind.WhileStatement:643 return updateWhile(<WhileStatement>node,644 visitNode((<WhileStatement>node).expression, visitor, isExpression),645 visitNode((<WhileStatement>node).statement, visitor, isStatement, liftToBlock));646647 case SyntaxKind.ForStatement:648 return updateFor(<ForStatement>node,649 visitNode((<ForStatement>node).initializer, visitor, isForInitializer),650 visitNode((<ForStatement>node).condition, visitor, isExpression),651 visitNode((<ForStatement>node).incrementor, visitor, isExpression),652 visitNode((<ForStatement>node).statement, visitor, isStatement, liftToBlock));653654 case SyntaxKind.ForInStatement:655 return updateForIn(<ForInStatement>node,656 visitNode((<ForInStatement>node).initializer, visitor, isForInitializer),657 visitNode((<ForInStatement>node).expression, visitor, isExpression),658 visitNode((<ForInStatement>node).statement, visitor, isStatement, liftToBlock));659660 case SyntaxKind.ForOfStatement:661 return updateForOf(<ForOfStatement>node,662 visitNode((<ForOfStatement>node).awaitModifier, visitor, isToken),663 visitNode((<ForOfStatement>node).initializer, visitor, isForInitializer),664 visitNode((<ForOfStatement>node).expression, visitor, isExpression),665 visitNode((<ForOfStatement>node).statement, visitor, isStatement, liftToBlock));666667 case SyntaxKind.ContinueStatement:668 return updateContinue(<ContinueStatement>node,669 visitNode((<ContinueStatement>node).label, visitor, isIdentifier));670671 case SyntaxKind.BreakStatement:672 return updateBreak(<BreakStatement>node,673 visitNode((<BreakStatement>node).label, visitor, isIdentifier));674675 case SyntaxKind.ReturnStatement:676 return updateReturn(<ReturnStatement>node,677 visitNode((<ReturnStatement>node).expression, visitor, isExpression));678679 case SyntaxKind.WithStatement:680 return updateWith(<WithStatement>node,681 visitNode((<WithStatement>node).expression, visitor, isExpression),682 visitNode((<WithStatement>node).statement, visitor, isStatement, liftToBlock));683684 case SyntaxKind.SwitchStatement:685 return updateSwitch(<SwitchStatement>node,686 visitNode((<SwitchStatement>node).expression, visitor, isExpression),687 visitNode((<SwitchStatement>node).caseBlock, visitor, isCaseBlock));688689 case SyntaxKind.LabeledStatement:690 return updateLabel(<LabeledStatement>node,691 visitNode((<LabeledStatement>node).label, visitor, isIdentifier),692 visitNode((<LabeledStatement>node).statement, visitor, isStatement, liftToBlock));693694 case SyntaxKind.ThrowStatement:695 return updateThrow(<ThrowStatement>node,696 visitNode((<ThrowStatement>node).expression, visitor, isExpression));697698 case SyntaxKind.TryStatement:699 return updateTry(<TryStatement>node,700 visitNode((<TryStatement>node).tryBlock, visitor, isBlock),701 visitNode((<TryStatement>node).catchClause, visitor, isCatchClause),702 visitNode((<TryStatement>node).finallyBlock, visitor, isBlock));703704 case SyntaxKind.VariableDeclaration:705 return updateTypeScriptVariableDeclaration(<VariableDeclaration>node,706 visitNode((<VariableDeclaration>node).name, visitor, isBindingName),707 visitNode((<VariableDeclaration>node).exclamationToken, tokenVisitor, isToken),708 visitNode((<VariableDeclaration>node).type, visitor, isTypeNode),709 visitNode((<VariableDeclaration>node).initializer, visitor, isExpression));710711 case SyntaxKind.VariableDeclarationList:712 return updateVariableDeclarationList(<VariableDeclarationList>node,713 nodesVisitor((<VariableDeclarationList>node).declarations, visitor, isVariableDeclaration));714715 case SyntaxKind.FunctionDeclaration:716 return updateFunctionDeclaration(<FunctionDeclaration>node,717 nodesVisitor((<FunctionDeclaration>node).decorators, visitor, isDecorator),718 nodesVisitor((<FunctionDeclaration>node).modifiers, visitor, isModifier),719 visitNode((<FunctionDeclaration>node).asteriskToken, tokenVisitor, isToken),720 visitNode((<FunctionDeclaration>node).name, visitor, isIdentifier),721 nodesVisitor((<FunctionDeclaration>node).typeParameters, visitor, isTypeParameterDeclaration),722 visitParameterList((<FunctionDeclaration>node).parameters, visitor, context, nodesVisitor),723 visitNode((<FunctionDeclaration>node).type, visitor, isTypeNode),724 visitFunctionBody((<FunctionExpression>node).body, visitor, context));725726 case SyntaxKind.ClassDeclaration:727 return updateClassDeclaration(<ClassDeclaration>node,728 nodesVisitor((<ClassDeclaration>node).decorators, visitor, isDecorator),729 nodesVisitor((<ClassDeclaration>node).modifiers, visitor, isModifier),730 visitNode((<ClassDeclaration>node).name, visitor, isIdentifier),731 nodesVisitor((<ClassDeclaration>node).typeParameters, visitor, isTypeParameterDeclaration),732 nodesVisitor((<ClassDeclaration>node).heritageClauses, visitor, isHeritageClause),733 nodesVisitor((<ClassDeclaration>node).members, visitor, isClassElement));734735 case SyntaxKind.InterfaceDeclaration:736 return updateInterfaceDeclaration(<InterfaceDeclaration>node,737 nodesVisitor((<InterfaceDeclaration>node).decorators, visitor, isDecorator),738 nodesVisitor((<InterfaceDeclaration>node).modifiers, visitor, isModifier),739 visitNode((<InterfaceDeclaration>node).name, visitor, isIdentifier),740 nodesVisitor((<InterfaceDeclaration>node).typeParameters, visitor, isTypeParameterDeclaration),741 nodesVisitor((<InterfaceDeclaration>node).heritageClauses, visitor, isHeritageClause),742 nodesVisitor((<InterfaceDeclaration>node).members, visitor, isTypeElement));743744 case SyntaxKind.TypeAliasDeclaration:745 return updateTypeAliasDeclaration(<TypeAliasDeclaration>node,746 nodesVisitor((<TypeAliasDeclaration>node).decorators, visitor, isDecorator),747 nodesVisitor((<TypeAliasDeclaration>node).modifiers, visitor, isModifier),748 visitNode((<TypeAliasDeclaration>node).name, visitor, isIdentifier),749 nodesVisitor((<TypeAliasDeclaration>node).typeParameters, visitor, isTypeParameterDeclaration),750 visitNode((<TypeAliasDeclaration>node).type, visitor, isTypeNode));751752 case SyntaxKind.EnumDeclaration:753 return updateEnumDeclaration(<EnumDeclaration>node,754 nodesVisitor((<EnumDeclaration>node).decorators, visitor, isDecorator),755 nodesVisitor((<EnumDeclaration>node).modifiers, visitor, isModifier),756 visitNode((<EnumDeclaration>node).name, visitor, isIdentifier),757 nodesVisitor((<EnumDeclaration>node).members, visitor, isEnumMember));758759 case SyntaxKind.ModuleDeclaration:760 return updateModuleDeclaration(<ModuleDeclaration>node,761 nodesVisitor((<ModuleDeclaration>node).decorators, visitor, isDecorator),762 nodesVisitor((<ModuleDeclaration>node).modifiers, visitor, isModifier),763 visitNode((<ModuleDeclaration>node).name, visitor, isIdentifier),764 visitNode((<ModuleDeclaration>node).body, visitor, isModuleBody));765766 case SyntaxKind.ModuleBlock:767 return updateModuleBlock(<ModuleBlock>node,768 nodesVisitor((<ModuleBlock>node).statements, visitor, isStatement));769770 case SyntaxKind.CaseBlock:771 return updateCaseBlock(<CaseBlock>node,772 nodesVisitor((<CaseBlock>node).clauses, visitor, isCaseOrDefaultClause));773774 case SyntaxKind.NamespaceExportDeclaration:775 return updateNamespaceExportDeclaration(<NamespaceExportDeclaration>node,776 visitNode((<NamespaceExportDeclaration>node).name, visitor, isIdentifier));777778 case SyntaxKind.ImportEqualsDeclaration:779 return updateImportEqualsDeclaration(<ImportEqualsDeclaration>node,780 nodesVisitor((<ImportEqualsDeclaration>node).decorators, visitor, isDecorator),781 nodesVisitor((<ImportEqualsDeclaration>node).modifiers, visitor, isModifier),782 visitNode((<ImportEqualsDeclaration>node).name, visitor, isIdentifier),783 visitNode((<ImportEqualsDeclaration>node).moduleReference, visitor, isModuleReference));784785 case SyntaxKind.ImportDeclaration:786 return updateImportDeclaration(<ImportDeclaration>node,787 nodesVisitor((<ImportDeclaration>node).decorators, visitor, isDecorator),788 nodesVisitor((<ImportDeclaration>node).modifiers, visitor, isModifier),789 visitNode((<ImportDeclaration>node).importClause, visitor, isImportClause),790 visitNode((<ImportDeclaration>node).moduleSpecifier, visitor, isExpression));791792 case SyntaxKind.ImportClause:793 return updateImportClause(<ImportClause>node,794 visitNode((<ImportClause>node).name, visitor, isIdentifier),795 visitNode((<ImportClause>node).namedBindings, visitor, isNamedImportBindings));796797 case SyntaxKind.NamespaceImport:798 return updateNamespaceImport(<NamespaceImport>node,799 visitNode((<NamespaceImport>node).name, visitor, isIdentifier));800801 case SyntaxKind.NamedImports:802 return updateNamedImports(<NamedImports>node,803 nodesVisitor((<NamedImports>node).elements, visitor, isImportSpecifier));804805 case SyntaxKind.ImportSpecifier:806 return updateImportSpecifier(<ImportSpecifier>node,807 visitNode((<ImportSpecifier>node).propertyName, visitor, isIdentifier),808 visitNode((<ImportSpecifier>node).name, visitor, isIdentifier));809810 case SyntaxKind.ExportAssignment:811 return updateExportAssignment(<ExportAssignment>node,812 nodesVisitor((<ExportAssignment>node).decorators, visitor, isDecorator),813 nodesVisitor((<ExportAssignment>node).modifiers, visitor, isModifier),814 visitNode((<ExportAssignment>node).expression, visitor, isExpression));815816 case SyntaxKind.ExportDeclaration:817 return updateExportDeclaration(<ExportDeclaration>node,818 nodesVisitor((<ExportDeclaration>node).decorators, visitor, isDecorator),819 nodesVisitor((<ExportDeclaration>node).modifiers, visitor, isModifier),820 visitNode((<ExportDeclaration>node).exportClause, visitor, isNamedExports),821 visitNode((<ExportDeclaration>node).moduleSpecifier, visitor, isExpression));822823 case SyntaxKind.NamedExports:824 return updateNamedExports(<NamedExports>node,825 nodesVisitor((<NamedExports>node).elements, visitor, isExportSpecifier));826827 case SyntaxKind.ExportSpecifier:828 return updateExportSpecifier(<ExportSpecifier>node,829 visitNode((<ExportSpecifier>node).propertyName, visitor, isIdentifier),830 visitNode((<ExportSpecifier>node).name, visitor, isIdentifier));831832 // Module references833 case SyntaxKind.ExternalModuleReference:834 return updateExternalModuleReference(<ExternalModuleReference>node,835 visitNode((<ExternalModuleReference>node).expression, visitor, isExpression));836837 // JSX838 case SyntaxKind.JsxElement:839 return updateJsxElement(<JsxElement>node,840 visitNode((<JsxElement>node).openingElement, visitor, isJsxOpeningElement),841 nodesVisitor((<JsxElement>node).children, visitor, isJsxChild),842 visitNode((<JsxElement>node).closingElement, visitor, isJsxClosingElement));843844 case SyntaxKind.JsxSelfClosingElement:845 return updateJsxSelfClosingElement(<JsxSelfClosingElement>node,846 visitNode((<JsxSelfClosingElement>node).tagName, visitor, isJsxTagNameExpression),847 nodesVisitor((<JsxSelfClosingElement>node).typeArguments, visitor, isTypeNode),848 visitNode((<JsxSelfClosingElement>node).attributes, visitor, isJsxAttributes));849850 case SyntaxKind.JsxOpeningElement:851 return updateJsxOpeningElement(<JsxOpeningElement>node,852 visitNode((<JsxOpeningElement>node).tagName, visitor, isJsxTagNameExpression),853 nodesVisitor((<JsxSelfClosingElement>node).typeArguments, visitor, isTypeNode),854 visitNode((<JsxOpeningElement>node).attributes, visitor, isJsxAttributes));855856 case SyntaxKind.JsxClosingElement:857 return updateJsxClosingElement(<JsxClosingElement>node,858 visitNode((<JsxClosingElement>node).tagName, visitor, isJsxTagNameExpression));859860 case SyntaxKind.JsxFragment:861 return updateJsxFragment(<JsxFragment>node,862 visitNode((<JsxFragment>node).openingFragment, visitor, isJsxOpeningFragment),863 nodesVisitor((<JsxFragment>node).children, visitor, isJsxChild),864 visitNode((<JsxFragment>node).closingFragment, visitor, isJsxClosingFragment));865866 case SyntaxKind.JsxAttribute:867 return updateJsxAttribute(<JsxAttribute>node,868 visitNode((<JsxAttribute>node).name, visitor, isIdentifier),869 visitNode((<JsxAttribute>node).initializer, visitor, isStringLiteralOrJsxExpression));870871 case SyntaxKind.JsxAttributes:872 return updateJsxAttributes(<JsxAttributes>node,873 nodesVisitor((<JsxAttributes>node).properties, visitor, isJsxAttributeLike));874875 case SyntaxKind.JsxSpreadAttribute:876 return updateJsxSpreadAttribute(<JsxSpreadAttribute>node,877 visitNode((<JsxSpreadAttribute>node).expression, visitor, isExpression));878879 case SyntaxKind.JsxExpression:880 return updateJsxExpression(<JsxExpression>node,881 visitNode((<JsxExpression>node).expression, visitor, isExpression));882883 // Clauses884 case SyntaxKind.CaseClause:885 return updateCaseClause(<CaseClause>node,886 visitNode((<CaseClause>node).expression, visitor, isExpression),887 nodesVisitor((<CaseClause>node).statements, visitor, isStatement));888889 case SyntaxKind.DefaultClause:890 return updateDefaultClause(<DefaultClause>node,891 nodesVisitor((<DefaultClause>node).statements, visitor, isStatement));892893 case SyntaxKind.HeritageClause:894 return updateHeritageClause(<HeritageClause>node,895 nodesVisitor((<HeritageClause>node).types, visitor, isExpressionWithTypeArguments));896897 case SyntaxKind.CatchClause:898 return updateCatchClause(<CatchClause>node,899 visitNode((<CatchClause>node).variableDeclaration, visitor, isVariableDeclaration),900 visitNode((<CatchClause>node).block, visitor, isBlock));901902 // Property assignments903 case SyntaxKind.PropertyAssignment:904 return updatePropertyAssignment(<PropertyAssignment>node,905 visitNode((<PropertyAssignment>node).name, visitor, isPropertyName),906 visitNode((<PropertyAssignment>node).initializer, visitor, isExpression));907908 case SyntaxKind.ShorthandPropertyAssignment:909 return updateShorthandPropertyAssignment(<ShorthandPropertyAssignment>node,910 visitNode((<ShorthandPropertyAssignment>node).name, visitor, isIdentifier),911 visitNode((<ShorthandPropertyAssignment>node).objectAssignmentInitializer, visitor, isExpression));912913 case SyntaxKind.SpreadAssignment:914 return updateSpreadAssignment(<SpreadAssignment>node,915 visitNode((<SpreadAssignment>node).expression, visitor, isExpression));916917 // Enum918 case SyntaxKind.EnumMember:919 return updateEnumMember(<EnumMember>node,920 visitNode((<EnumMember>node).name, visitor, isPropertyName),921 visitNode((<EnumMember>node).initializer, visitor, isExpression));922923 // Top-level nodes924 case SyntaxKind.SourceFile:925 return updateSourceFileNode(<SourceFile>node,926 visitLexicalEnvironment((<SourceFile>node).statements, visitor, context));927928 // Transformation nodes929 case SyntaxKind.PartiallyEmittedExpression:930 return updatePartiallyEmittedExpression(<PartiallyEmittedExpression>node,931 visitNode((<PartiallyEmittedExpression>node).expression, visitor, isExpression));932933 case SyntaxKind.CommaListExpression:934 return updateCommaList(<CommaListExpression>node,935 nodesVisitor((<CommaListExpression>node).elements, visitor, isExpression));936937 default:938 // No need to visit nodes with no children.939 return node;940 }941942 }943944 /**945 * Extracts the single node from a NodeArray.946 *947 * @param nodes The NodeArray.948 */949 function extractSingleNode(nodes: readonly Node[]): Node | undefined {950 Debug.assert(nodes.length <= 1, "Too many nodes written to output.");951 return singleOrUndefined(nodes);952 } ...

Full Screen

Full Screen

processBarcode-test.js

Source:processBarcode-test.js Github

copy

Full Screen

1import { processBarcode } from '../PickListContainer';2import sinon from 'sinon';3import { Observable } from 'rxjs';4describe('processBarcode', () => {5 const appSession = {6 accessToken: '1234',7 museumId: 99,8 collectionId: 'd3982b48-0000-0000-0000-6e38b59d57ed'9 };10 const barCodeWithUUID = {11 uuid: true,12 code: 'd3982b48-56c7-4d27-bc81-6e38b59d57ed'13 };14 const barCodeWithNumber = {15 number: true,16 code: 12345678917 };18 it('should emit error when receiving a uuid that does not exist', () => {19 const emitError = sinon.spy();20 const props = {21 findNodeByUUID: () => Observable.of(null),22 isTypeNode: true,23 classExistsOnDom: () => false,24 appSession,25 emitError26 };27 processBarcode(barCodeWithUUID, props);28 expect(emitError.calledOnce).toBe(true);29 });30 it('should emit error when receiving a uuid when not on node picklist', () => {31 const emitError = sinon.spy();32 const props = {33 findNodeByUUID: () => Observable.of(null),34 isTypeNode: false,35 classExistsOnDom: () => false,36 appSession,37 emitError38 };39 processBarcode(barCodeWithUUID, props);40 expect(emitError.calledOnce).toBe(true);41 });42 it('should update move dialog when receiving a uuid that exists when move dialog is open', () => {43 const updateMoveDialog = sinon.spy();44 const props = {45 findNodeByUUID: () =>46 Observable.of({47 id: 1,48 name: 'Test'49 }),50 isTypeNode: true,51 classExistsOnDom: clazz => clazz === 'moveDialog',52 appSession,53 updateMoveDialog54 };55 processBarcode(barCodeWithUUID, props);56 expect(updateMoveDialog.calledOnce).toBe(true);57 });58 it('should add to node picklist when receiving a uuid that exists', () => {59 const addNode = sinon.spy();60 const props = {61 findNodeByUUID: () =>62 Observable.of({63 id: 1,64 name: 'Test'65 }),66 isTypeNode: true,67 classExistsOnDom: () => false,68 appSession,69 addNode70 };71 processBarcode(barCodeWithUUID, props);72 expect(addNode.calledOnce).toBe(true);73 });74 it('should emit error when receiving a number that does not exists when node picklist is active', () => {75 const emitError = sinon.spy();76 const props = {77 findNodeByBarcode: () => Observable.of(null),78 isTypeNode: true,79 classExistsOnDom: () => false,80 appSession,81 emitError82 };83 processBarcode(barCodeWithNumber, props);84 expect(emitError.calledOnce).toBe(true);85 });86 it('should emit error when receiving a number that does not exists when object picklist is active', () => {87 const emitError = sinon.spy();88 const props = {89 findObjectByBarcode: () => Observable.of(null),90 isTypeNode: false,91 classExistsOnDom: () => false,92 appSession,93 emitError94 };95 processBarcode(barCodeWithNumber, props);96 expect(emitError.calledOnce).toBe(true);97 });98 it('should emit error when receiving a number that is not found when move dialog is active', () => {99 const emitError = sinon.spy();100 const props = {101 findNodeByBarcode: () => Observable.of(null),102 isTypeNode: false,103 classExistsOnDom: clazz => clazz === 'moveDialog',104 appSession,105 emitError106 };107 processBarcode(barCodeWithNumber, props);108 expect(emitError.calledOnce).toBe(true);109 });110 it('should add to object picklist when receiving a number that resolves to a single object', () => {111 const addObject = sinon.spy();112 const props = {113 findObjectByBarcode: () =>114 Observable.of([115 {116 id: 1,117 term: 'Fugl'118 }119 ]),120 isTypeNode: false,121 classExistsOnDom: () => false,122 appSession,123 addObject124 };125 processBarcode(barCodeWithNumber, props);126 expect(addObject.calledOnce).toBe(true);127 });128 it('should emit error when receiving a number that resolves to multiple objects', () => {129 const emitError = sinon.spy();130 const props = {131 findObjectByBarcode: () =>132 Observable.of([133 {134 id: 1,135 term: 'Fugl'136 },137 {138 id: 2,139 term: 'Fisk'140 }141 ]),142 isTypeNode: false,143 classExistsOnDom: () => false,144 appSession,145 emitError146 };147 processBarcode(barCodeWithNumber, props);148 expect(emitError.calledOnce).toBe(true);149 });150 it('should update move dialog when receiving a number that resolves to a single node', () => {151 const updateMoveDialog = sinon.spy();152 const props = {153 findNodeByBarcode: () =>154 Observable.of({155 id: 1,156 name: 'Test',157 nodeId: '1234'158 }),159 isTypeNode: true,160 classExistsOnDom: clazz => clazz === 'moveDialog',161 appSession,162 updateMoveDialog163 };164 processBarcode(barCodeWithNumber, props);165 expect(updateMoveDialog.calledOnce).toBe(true);166 });167 it('should add to node picklist when receiving a number that resolves to a single node', () => {168 const addNode = sinon.spy();169 const props = {170 findNodeByBarcode: () =>171 Observable.of({172 id: 1,173 name: 'Test',174 nodeId: '1234'175 }),176 isTypeNode: true,177 classExistsOnDom: () => false,178 appSession,179 addNode180 };181 processBarcode(barCodeWithNumber, props);182 expect(addNode.calledOnce).toBe(true);183 });184 it('should emit error when receiving a number that resolves to a bogus response (nodes active)', () => {185 const emitError = sinon.spy();186 const props = {187 findNodeByBarcode: () =>188 Observable.of({189 id: 1,190 name: 'Test'191 // Missing nodeId!192 }),193 isTypeNode: true,194 classExistsOnDom: () => false,195 appSession,196 emitError197 };198 processBarcode(barCodeWithNumber, props);199 expect(emitError.calledOnce).toBe(true);200 });201 it('should emit error when receiving a number that resolves to a bogus response (objects active)', () => {202 const emitError = sinon.spy();203 const props = {204 findObjectByBarcode: () =>205 Observable.of({206 id: 1,207 name: 'Test'208 // Missing nodeId!209 }),210 isTypeNode: false,211 classExistsOnDom: () => false,212 appSession,213 emitError214 };215 processBarcode(barCodeWithNumber, props);216 expect(emitError.calledOnce).toBe(true);217 });...

Full Screen

Full Screen

isInTypeAnnotation.ts

Source:isInTypeAnnotation.ts Github

copy

Full Screen

...13 const {parent, parentPath} = path;14 if (parent === undefined || parentPath === undefined) {15 return undefined;16 }17 if (isTypeNode(parent)) {18 return parent;19 }20 if (isTypeNode(parentPath.parent)) {21 return parentPath.parent;22 }23 return undefined;24}25export default function isInTypeAnnotation(path: Path): boolean {26 const match = getTypeNode(path);27 if (match === undefined) {28 return false;29 }30 if (isTypeExpressionWrapperNode(match)) {31 return false;32 } else {33 return true;34 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isTypeNode } = require('stryker-parent');2const { isTypeNode } = require('stryker-parent');3const { isTypeNode } = require('stryker-parent');4const { isTypeNode } = require('stryker-parent');5const { isTypeNode } = require('stryker-parent');6const { isTypeNode } = require('stryker-parent');7const { isTypeNode } = require('stryker-parent');8const { isTypeNode } = require('stryker-parent');9const { isTypeNode } = require('stryker-parent');10const { isTypeNode } = require('stryker-parent');11const { isTypeNode } = require('stryker-parent');12const { isTypeNode } = require('stryker-parent');13const { isTypeNode } = require('stryker-parent');14const { isTypeNode } = require('stryker-parent');15const { isTypeNode } = require('stryker-parent');16const { isTypeNode } = require('stryker-parent');17const { isTypeNode } = require('stryker-parent');18const { isTypeNode } = require('stryker-parent');19const { isTypeNode } = require('stryker-parent');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isTypeNode } = require('stryker-parent');2console.log(isTypeNode());3const { isTypeNode } = require('stryker-parent');4console.log(isTypeNode());5const { isTypeNode } = require('stryker-parent');6console.log(isTypeNode());7const { isTypeNode } = require('stryker-parent');8console.log(isTypeNode());9const { isTypeNode } = require('stryker-parent');10console.log(isTypeNode());11const { isTypeNode } = require('stryker-parent');12console.log(isTypeNode());13const { isTypeNode } = require('stryker-parent');14console.log(isTypeNode());15const { isTypeNode } = require('stryker-parent');16console.log(isTypeNode());17const { isTypeNode } = require('stryker-parent');18console.log(isTypeNode());19const { isTypeNode } = require('stryker-parent');20console.log(isTypeNode());21const { isTypeNode } = require('stryker-parent');22console.log(isTypeNode());23const { is

Full Screen

Using AI Code Generation

copy

Full Screen

1var isTypeNode = require('stryker-parent').isTypeNode;2var node = {3};4console.log(isTypeNode(node));5var isTypeNode = require('stryker-parent').isTypeNode;6var node = {7};8console.log(isTypeNode(node));9var isTypeNode = require('stryker-parent').isTypeNode;10var node = {11};12console.log(isTypeNode(node));13var isTypeNode = require('stryker-parent').isTypeNode;14var node = {15};16console.log(isTypeNode(node));17var isTypeNode = require('stryker-parent').isTypeNode;18var node = {19};20console.log(isTypeNode(node));21var isTypeNode = require('stryker-parent').isTypeNode;22var node = {23};24console.log(isTypeNode(node));25var isTypeNode = require('stryker-parent').isTypeNode;26var node = {27};28console.log(isTypeNode(node));29var isTypeNode = require('stryker-parent').isTypeNode;30var node = {31};32console.log(isTypeNode(node));33var isTypeNode = require('stryker-parent').isTypeNode;34var node = {35};36console.log(isTypeNode(node));37var isTypeNode = require('stryker-parent').isTypeNode;38var node = {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { isTypeNode } from 'stryker-parent';2export class Test {3}4export function isTypeNode(node) {5 return node.kind === ts.SyntaxKind.TypeNode;6}

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isTypeNode } = require('stryker-parent');2console.log(isTypeNode());3const isTypeNode = () => {4 return process.env.NODE_ENV === 'test';5};6exports.isTypeNode = isTypeNode;7"test": {8 "options": {9 }10}11"test": {12 "options": {13 }14}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { isTypeNode } from 'stryker-parent';2export function isTypeNode(node) {3 return isTypeNode(node);4}5 at isTypeNode (test.js:4:17)6import { isTypeNode } from 'stryker-parent';7export function isTypeNode(node) {8 return isTypeNode(node);9}10import { isTypeNode } from 'stryker-parent';11export function isTypeNode(node) {12 return isTypeNode(node);13}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful