function forEachChild(node, cbNode, cbNodeArray) {
        if (!node) {
            return;
        }
        // The visitXXX functions could be written as local functions that close over the cbNode and cbNodeArray
        // callback parameters, but that causes a closure allocation for each invocation with noticeable effects
        // on performance.
        var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode;
        var cbNodes = cbNodeArray || cbNode;
        switch (node.kind) {
            case 135 /* QualifiedName */:
                return visitNode(cbNode, node.left) ||
                    visitNode(cbNode, node.right);
            case 137 /* TypeParameter */:
                return visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.constraint) ||
                    visitNode(cbNode, node.expression);
            case 246 /* ShorthandPropertyAssignment */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.questionToken) ||
                    visitNode(cbNode, node.equalsToken) ||
                    visitNode(cbNode, node.objectAssignmentInitializer);
            case 138 /* Parameter */:
            case 141 /* PropertyDeclaration */:
            case 140 /* PropertySignature */:
            case 245 /* PropertyAssignment */:
            case 211 /* VariableDeclaration */:
            case 163 /* BindingElement */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.propertyName) ||
                    visitNode(cbNode, node.dotDotDotToken) ||
                    visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.questionToken) ||
                    visitNode(cbNode, node.type) ||
                    visitNode(cbNode, node.initializer);
            case 152 /* FunctionType */:
            case 153 /* ConstructorType */:
            case 147 /* CallSignature */:
            case 148 /* ConstructSignature */:
            case 149 /* IndexSignature */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNodes(cbNodes, node.typeParameters) ||
                    visitNodes(cbNodes, node.parameters) ||
                    visitNode(cbNode, node.type);
            case 143 /* MethodDeclaration */:
            case 142 /* MethodSignature */:
            case 144 /* Constructor */:
            case 145 /* GetAccessor */:
            case 146 /* SetAccessor */:
            case 173 /* FunctionExpression */:
            case 213 /* FunctionDeclaration */:
            case 174 /* ArrowFunction */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.asteriskToken) ||
                    visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.questionToken) ||
                    visitNodes(cbNodes, node.typeParameters) ||
                    visitNodes(cbNodes, node.parameters) ||
                    visitNode(cbNode, node.type) ||
                    visitNode(cbNode, node.equalsGreaterThanToken) ||
                    visitNode(cbNode, node.body);
            case 151 /* TypeReference */:
                return visitNode(cbNode, node.typeName) ||
                    visitNodes(cbNodes, node.typeArguments);
            case 150 /* TypePredicate */:
                return visitNode(cbNode, node.parameterName) ||
                    visitNode(cbNode, node.type);
            case 154 /* TypeQuery */:
                return visitNode(cbNode, node.exprName);
            case 155 /* TypeLiteral */:
                return visitNodes(cbNodes, node.members);
            case 156 /* ArrayType */:
                return visitNode(cbNode, node.elementType);
            case 157 /* TupleType */:
                return visitNodes(cbNodes, node.elementTypes);
            case 158 /* UnionType */:
            case 159 /* IntersectionType */:
                return visitNodes(cbNodes, node.types);
            case 160 /* ParenthesizedType */:
                return visitNode(cbNode, node.type);
            case 161 /* ObjectBindingPattern */:
            case 162 /* ArrayBindingPattern */:
                return visitNodes(cbNodes, node.elements);
            case 164 /* ArrayLiteralExpression */:
                return visitNodes(cbNodes, node.elements);
            case 165 /* ObjectLiteralExpression */:
                return visitNodes(cbNodes, node.properties);
            case 166 /* PropertyAccessExpression */:
                return visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.dotToken) ||
                    visitNode(cbNode, node.name);
            case 167 /* ElementAccessExpression */:
                return visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.argumentExpression);
            case 168 /* CallExpression */:
            case 169 /* NewExpression */:
                return visitNode(cbNode, node.expression) ||
                    visitNodes(cbNodes, node.typeArguments) ||
                    visitNodes(cbNodes, node.arguments);
            case 170 /* TaggedTemplateExpression */:
                return visitNode(cbNode, node.tag) ||
                    visitNode(cbNode, node.template);
            case 171 /* TypeAssertionExpression */:
                return visitNode(cbNode, node.type) ||
                    visitNode(cbNode, node.expression);
            case 172 /* ParenthesizedExpression */:
                return visitNode(cbNode, node.expression);
            case 175 /* DeleteExpression */:
                return visitNode(cbNode, node.expression);
            case 176 /* TypeOfExpression */:
                return visitNode(cbNode, node.expression);
            case 177 /* VoidExpression */:
                return visitNode(cbNode, node.expression);
            case 179 /* PrefixUnaryExpression */:
                return visitNode(cbNode, node.operand);
            case 184 /* YieldExpression */:
                return visitNode(cbNode, node.asteriskToken) ||
                    visitNode(cbNode, node.expression);
            case 178 /* AwaitExpression */:
                return visitNode(cbNode, node.expression);
            case 180 /* PostfixUnaryExpression */:
                return visitNode(cbNode, node.operand);
            case 181 /* BinaryExpression */:
                return visitNode(cbNode, node.left) ||
                    visitNode(cbNode, node.operatorToken) ||
                    visitNode(cbNode, node.right);
            case 189 /* AsExpression */:
                return visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.type);
            case 182 /* ConditionalExpression */:
                return visitNode(cbNode, node.condition) ||
                    visitNode(cbNode, node.questionToken) ||
                    visitNode(cbNode, node.whenTrue) ||
                    visitNode(cbNode, node.colonToken) ||
                    visitNode(cbNode, node.whenFalse);
            case 185 /* SpreadElementExpression */:
                return visitNode(cbNode, node.expression);
            case 192 /* Block */:
            case 219 /* ModuleBlock */:
                return visitNodes(cbNodes, node.statements);
            case 248 /* SourceFile */:
                return visitNodes(cbNodes, node.statements) ||
                    visitNode(cbNode, node.endOfFileToken);
            case 193 /* VariableStatement */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.declarationList);
            case 212 /* VariableDeclarationList */:
                return visitNodes(cbNodes, node.declarations);
            case 195 /* ExpressionStatement */:
                return visitNode(cbNode, node.expression);
            case 196 /* IfStatement */:
                return visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.thenStatement) ||
                    visitNode(cbNode, node.elseStatement);
            case 197 /* DoStatement */:
                return visitNode(cbNode, node.statement) ||
                    visitNode(cbNode, node.expression);
            case 198 /* WhileStatement */:
                return visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.statement);
            case 199 /* ForStatement */:
                return visitNode(cbNode, node.initializer) ||
                    visitNode(cbNode, node.condition) ||
                    visitNode(cbNode, node.incrementor) ||
                    visitNode(cbNode, node.statement);
            case 200 /* ForInStatement */:
                return visitNode(cbNode, node.initializer) ||
                    visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.statement);
            case 201 /* ForOfStatement */:
                return visitNode(cbNode, node.initializer) ||
                    visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.statement);
            case 202 /* ContinueStatement */:
            case 203 /* BreakStatement */:
                return visitNode(cbNode, node.label);
            case 204 /* ReturnStatement */:
                return visitNode(cbNode, node.expression);
            case 205 /* WithStatement */:
                return visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.statement);
            case 206 /* SwitchStatement */:
                return visitNode(cbNode, node.expression) ||
                    visitNode(cbNode, node.caseBlock);
            case 220 /* CaseBlock */:
                return visitNodes(cbNodes, node.clauses);
            case 241 /* CaseClause */:
                return visitNode(cbNode, node.expression) ||
                    visitNodes(cbNodes, node.statements);
            case 242 /* DefaultClause */:
                return visitNodes(cbNodes, node.statements);
            case 207 /* LabeledStatement */:
                return visitNode(cbNode, node.label) ||
                    visitNode(cbNode, node.statement);
            case 208 /* ThrowStatement */:
                return visitNode(cbNode, node.expression);
            case 209 /* TryStatement */:
                return visitNode(cbNode, node.tryBlock) ||
                    visitNode(cbNode, node.catchClause) ||
                    visitNode(cbNode, node.finallyBlock);
            case 244 /* CatchClause */:
                return visitNode(cbNode, node.variableDeclaration) ||
                    visitNode(cbNode, node.block);
            case 139 /* Decorator */:
                return visitNode(cbNode, node.expression);
            case 214 /* ClassDeclaration */:
            case 186 /* ClassExpression */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.name) ||
                    visitNodes(cbNodes, node.typeParameters) ||
                    visitNodes(cbNodes, node.heritageClauses) ||
                    visitNodes(cbNodes, node.members);
            case 215 /* InterfaceDeclaration */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.name) ||
                    visitNodes(cbNodes, node.typeParameters) ||
                    visitNodes(cbNodes, node.heritageClauses) ||
                    visitNodes(cbNodes, node.members);
            case 216 /* TypeAliasDeclaration */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.name) ||
                    visitNodes(cbNodes, node.typeParameters) ||
                    visitNode(cbNode, node.type);
            case 217 /* EnumDeclaration */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.name) ||
                    visitNodes(cbNodes, node.members);
            case 247 /* EnumMember */:
                return visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.initializer);
            case 218 /* ModuleDeclaration */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.body);
            case 221 /* ImportEqualsDeclaration */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.moduleReference);
            case 222 /* ImportDeclaration */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.importClause) ||
                    visitNode(cbNode, node.moduleSpecifier);
            case 223 /* ImportClause */:
                return visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.namedBindings);
            case 224 /* NamespaceImport */:
                return visitNode(cbNode, node.name);
            case 225 /* NamedImports */:
            case 229 /* NamedExports */:
                return visitNodes(cbNodes, node.elements);
            case 228 /* ExportDeclaration */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.exportClause) ||
                    visitNode(cbNode, node.moduleSpecifier);
            case 226 /* ImportSpecifier */:
            case 230 /* ExportSpecifier */:
                return visitNode(cbNode, node.propertyName) ||
                    visitNode(cbNode, node.name);
            case 227 /* ExportAssignment */:
                return visitNodes(cbNodes, node.decorators) ||
                    visitNodes(cbNodes, node.modifiers) ||
                    visitNode(cbNode, node.expression);
            case 183 /* TemplateExpression */:
                return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans);
            case 190 /* TemplateSpan */:
                return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
            case 136 /* ComputedPropertyName */:
                return visitNode(cbNode, node.expression);
            case 243 /* HeritageClause */:
                return visitNodes(cbNodes, node.types);
            case 188 /* ExpressionWithTypeArguments */:
                return visitNode(cbNode, node.expression) ||
                    visitNodes(cbNodes, node.typeArguments);
            case 232 /* ExternalModuleReference */:
                return visitNode(cbNode, node.expression);
            case 231 /* MissingDeclaration */:
                return visitNodes(cbNodes, node.decorators);
            case 233 /* JsxElement */:
                return visitNode(cbNode, node.openingElement) ||
                    visitNodes(cbNodes, node.children) ||
                    visitNode(cbNode, node.closingElement);
            case 234 /* JsxSelfClosingElement */:
            case 235 /* JsxOpeningElement */:
                return visitNode(cbNode, node.tagName) ||
                    visitNodes(cbNodes, node.attributes);
            case 238 /* JsxAttribute */:
                return visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.initializer);
            case 239 /* JsxSpreadAttribute */:
                return visitNode(cbNode, node.expression);
            case 240 /* JsxExpression */:
                return visitNode(cbNode, node.expression);
            case 237 /* JsxClosingElement */:
                return visitNode(cbNode, node.tagName);
            case 249 /* JSDocTypeExpression */:
                return visitNode(cbNode, node.type);
            case 253 /* JSDocUnionType */:
                return visitNodes(cbNodes, node.types);
            case 254 /* JSDocTupleType */:
                return visitNodes(cbNodes, node.types);
            case 252 /* JSDocArrayType */:
                return visitNode(cbNode, node.elementType);
            case 256 /* JSDocNonNullableType */:
                return visitNode(cbNode, node.type);
            case 255 /* JSDocNullableType */:
                return visitNode(cbNode, node.type);
            case 257 /* JSDocRecordType */:
                return visitNodes(cbNodes, node.members);
            case 259 /* JSDocTypeReference */:
                return visitNode(cbNode, node.name) ||
                    visitNodes(cbNodes, node.typeArguments);
            case 260 /* JSDocOptionalType */:
                return visitNode(cbNode, node.type);
            case 261 /* JSDocFunctionType */:
                return visitNodes(cbNodes, node.parameters) ||
                    visitNode(cbNode, node.type);
            case 262 /* JSDocVariadicType */:
                return visitNode(cbNode, node.type);
            case 263 /* JSDocConstructorType */:
                return visitNode(cbNode, node.type);
            case 264 /* JSDocThisType */:
                return visitNode(cbNode, node.type);
            case 258 /* JSDocRecordMember */:
                return visitNode(cbNode, node.name) ||
                    visitNode(cbNode, node.type);
            case 265 /* JSDocComment */:
                return visitNodes(cbNodes, node.tags);
            case 267 /* JSDocParameterTag */:
                return visitNode(cbNode, node.preParameterName) ||
                    visitNode(cbNode, node.typeExpression) ||
                    visitNode(cbNode, node.postParameterName);
            case 268 /* JSDocReturnTag */:
                return visitNode(cbNode, node.typeExpression);
            case 269 /* JSDocTypeTag */:
                return visitNode(cbNode, node.typeExpression);
            case 270 /* JSDocTemplateTag */:
                return visitNodes(cbNodes, node.typeParameters);
        }
    }