@typescript-deploys/pr-build 5.0.0-pr-52280-2 → 5.0.0-pr-52280-7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-insiders.20230117`;
26
+ var version = `${versionMajorMinor}.0-insiders.20230118`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -6857,7 +6857,7 @@ var Diagnostics = {
6857
6857
  Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
6858
6858
  Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
6859
6859
  Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."),
6860
- Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_bundler_and_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_bundler_and_eithe_5096", "Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'bundler' and either 'noEmit' or 'emitDeclarationOnly' is set."),
6860
+ Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
6861
6861
  An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
6862
6862
  Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
6863
6863
  Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(5099, 1 /* Error */, "Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Aster_5099", `Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`),
@@ -8370,10 +8370,7 @@ function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {
8370
8370
  initial
8371
8371
  );
8372
8372
  }
8373
- function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {
8374
- if (!comments) {
8375
- comments = [];
8376
- }
8373
+ function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments = []) {
8377
8374
  comments.push({ kind, pos, end, hasTrailingNewLine });
8378
8375
  return comments;
8379
8376
  }
@@ -10074,7 +10071,10 @@ function getOriginalNode(node, nodeTest) {
10074
10071
  node = node.original;
10075
10072
  }
10076
10073
  }
10077
- return !nodeTest || nodeTest(node) ? node : void 0;
10074
+ if (!node || !nodeTest) {
10075
+ return node;
10076
+ }
10077
+ return nodeTest(node) ? node : void 0;
10078
10078
  }
10079
10079
  function findAncestor(node, callback) {
10080
10080
  while (node) {
@@ -10548,9 +10548,6 @@ function isNodeKind(kind) {
10548
10548
  function isTokenKind(kind) {
10549
10549
  return kind >= 0 /* FirstToken */ && kind <= 162 /* LastToken */;
10550
10550
  }
10551
- function isToken(n) {
10552
- return isTokenKind(n.kind);
10553
- }
10554
10551
  function isNodeArray(array) {
10555
10552
  return hasProperty(array, "pos") && hasProperty(array, "end");
10556
10553
  }
@@ -10764,6 +10761,9 @@ function isDeclarationBindingElement(bindingElement) {
10764
10761
  }
10765
10762
  return false;
10766
10763
  }
10764
+ function isBindingOrAssignmentElement(node) {
10765
+ return isVariableDeclaration(node) || isParameter(node) || isObjectBindingOrAssignmentElement(node) || isArrayBindingOrAssignmentElement(node);
10766
+ }
10767
10767
  function isBindingOrAssignmentPattern(node) {
10768
10768
  return isObjectBindingOrAssignmentPattern(node) || isArrayBindingOrAssignmentPattern(node);
10769
10769
  }
@@ -10793,6 +10793,24 @@ function isArrayBindingOrAssignmentPattern(node) {
10793
10793
  }
10794
10794
  return false;
10795
10795
  }
10796
+ function isArrayBindingOrAssignmentElement(node) {
10797
+ switch (node.kind) {
10798
+ case 205 /* BindingElement */:
10799
+ case 229 /* OmittedExpression */:
10800
+ case 227 /* SpreadElement */:
10801
+ case 206 /* ArrayLiteralExpression */:
10802
+ case 207 /* ObjectLiteralExpression */:
10803
+ case 79 /* Identifier */:
10804
+ case 208 /* PropertyAccessExpression */:
10805
+ case 209 /* ElementAccessExpression */:
10806
+ return true;
10807
+ }
10808
+ return isAssignmentExpression(
10809
+ node,
10810
+ /*excludeCompoundAssignment*/
10811
+ true
10812
+ );
10813
+ }
10796
10814
  function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
10797
10815
  const kind = node.kind;
10798
10816
  return kind === 208 /* PropertyAccessExpression */ || kind === 163 /* QualifiedName */ || kind === 202 /* ImportType */;
@@ -10874,6 +10892,18 @@ function isUnaryExpressionKind(kind) {
10874
10892
  return isLeftHandSideExpressionKind(kind);
10875
10893
  }
10876
10894
  }
10895
+ function isLiteralTypeLiteral(node) {
10896
+ node = skipPartiallyEmittedExpressions(node);
10897
+ switch (skipPartiallyEmittedExpressions(node).kind) {
10898
+ case 104 /* NullKeyword */:
10899
+ case 110 /* TrueKeyword */:
10900
+ case 95 /* FalseKeyword */:
10901
+ case 221 /* PrefixUnaryExpression */:
10902
+ return true;
10903
+ default:
10904
+ return isLiteralExpression(node);
10905
+ }
10906
+ }
10877
10907
  function isExpression(node) {
10878
10908
  return isExpressionKind(skipPartiallyEmittedExpressions(node).kind);
10879
10909
  }
@@ -11155,9 +11185,6 @@ function hasOnlyExpressionInitializer(node) {
11155
11185
  return false;
11156
11186
  }
11157
11187
  }
11158
- function isObjectLiteralElement(node) {
11159
- return node.kind === 288 /* JsxAttribute */ || node.kind === 290 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
11160
- }
11161
11188
  function isTypeReferenceType(node) {
11162
11189
  return node.kind === 180 /* TypeReference */ || node.kind === 230 /* ExpressionWithTypeArguments */;
11163
11190
  }
@@ -15070,7 +15097,7 @@ function getInitializedVariables(node) {
15070
15097
  return filter(node.declarations, isInitializedVariable);
15071
15098
  }
15072
15099
  function isInitializedVariable(node) {
15073
- return node.initializer !== void 0;
15100
+ return isVariableDeclaration(node) && node.initializer !== void 0;
15074
15101
  }
15075
15102
  function isWatchSet(options) {
15076
15103
  return options.watch && hasProperty(options, "watch");
@@ -15231,7 +15258,7 @@ function getLastChild(node) {
15231
15258
  return lastChild;
15232
15259
  }
15233
15260
  function isTypeNodeKind(kind) {
15234
- return kind >= 179 /* FirstTypeNode */ && kind <= 202 /* LastTypeNode */ || kind === 131 /* AnyKeyword */ || kind === 157 /* UnknownKeyword */ || kind === 148 /* NumberKeyword */ || kind === 160 /* BigIntKeyword */ || kind === 149 /* ObjectKeyword */ || kind === 134 /* BooleanKeyword */ || kind === 152 /* StringKeyword */ || kind === 153 /* SymbolKeyword */ || kind === 114 /* VoidKeyword */ || kind === 155 /* UndefinedKeyword */ || kind === 144 /* NeverKeyword */ || kind === 230 /* ExpressionWithTypeArguments */ || kind === 315 /* JSDocAllType */ || kind === 316 /* JSDocUnknownType */ || kind === 317 /* JSDocNullableType */ || kind === 318 /* JSDocNonNullableType */ || kind === 319 /* JSDocOptionalType */ || kind === 320 /* JSDocFunctionType */ || kind === 321 /* JSDocVariadicType */;
15261
+ return kind >= 179 /* FirstTypeNode */ && kind <= 202 /* LastTypeNode */ || kind === 131 /* AnyKeyword */ || kind === 157 /* UnknownKeyword */ || kind === 148 /* NumberKeyword */ || kind === 160 /* BigIntKeyword */ || kind === 149 /* ObjectKeyword */ || kind === 134 /* BooleanKeyword */ || kind === 152 /* StringKeyword */ || kind === 153 /* SymbolKeyword */ || kind === 114 /* VoidKeyword */ || kind === 155 /* UndefinedKeyword */ || kind === 144 /* NeverKeyword */ || kind === 139 /* IntrinsicKeyword */ || kind === 230 /* ExpressionWithTypeArguments */ || kind === 315 /* JSDocAllType */ || kind === 316 /* JSDocUnknownType */ || kind === 317 /* JSDocNullableType */ || kind === 318 /* JSDocNonNullableType */ || kind === 319 /* JSDocOptionalType */ || kind === 320 /* JSDocFunctionType */ || kind === 321 /* JSDocVariadicType */;
15235
15262
  }
15236
15263
  function isAccessExpression(node) {
15237
15264
  return node.kind === 208 /* PropertyAccessExpression */ || node.kind === 209 /* ElementAccessExpression */;
@@ -33225,7 +33252,7 @@ var commandOptionsWithoutBuild = [
33225
33252
  {
33226
33253
  name: "allowImportingTsExtensions",
33227
33254
  type: "boolean",
33228
- affectsModuleResolution: true,
33255
+ affectsSemanticDiagnostics: true,
33229
33256
  category: Diagnostics.Modules,
33230
33257
  description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
33231
33258
  defaultValueDescription: false
@@ -35394,6 +35421,7 @@ function validateSpecs(specs, errors, disallowTrailingRecursion, jsonSourceFile,
35394
35421
  }
35395
35422
  }
35396
35423
  function specToDiagnostic(spec, disallowTrailingRecursion) {
35424
+ Debug.assert(typeof spec === "string");
35397
35425
  if (disallowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
35398
35426
  return [Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
35399
35427
  } else if (invalidDotDotAfterRecursiveWildcard(spec)) {
@@ -37813,7 +37841,7 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
37813
37841
  }
37814
37842
  }
37815
37843
  function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
37816
- return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && (!!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName));
37844
+ return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
37817
37845
  }
37818
37846
  function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
37819
37847
  const traceEnabled = isTraceEnabled(compilerOptions, host);
@@ -42536,7 +42564,7 @@ function createTypeChecker(host) {
42536
42564
  if (jsxFragmentPragma) {
42537
42565
  const chosenPragma = isArray(jsxFragmentPragma) ? jsxFragmentPragma[0] : jsxFragmentPragma;
42538
42566
  file.localJsxFragmentFactory = parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
42539
- visitNode(file.localJsxFragmentFactory, markAsSynthetic);
42567
+ visitNode(file.localJsxFragmentFactory, markAsSynthetic, isEntityName);
42540
42568
  if (file.localJsxFragmentFactory) {
42541
42569
  return file.localJsxFragmentNamespace = getFirstIdentifier(file.localJsxFragmentFactory).escapedText;
42542
42570
  }
@@ -42579,7 +42607,7 @@ function createTypeChecker(host) {
42579
42607
  if (jsxPragma) {
42580
42608
  const chosenPragma = isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
42581
42609
  file.localJsxFactory = parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
42582
- visitNode(file.localJsxFactory, markAsSynthetic);
42610
+ visitNode(file.localJsxFactory, markAsSynthetic, isEntityName);
42583
42611
  if (file.localJsxFactory) {
42584
42612
  return file.localJsxNamespace = getFirstIdentifier(file.localJsxFactory).escapedText;
42585
42613
  }
@@ -44090,6 +44118,7 @@ function createTypeChecker(host) {
44090
44118
  return valueSymbol;
44091
44119
  }
44092
44120
  const result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
44121
+ Debug.assert(valueSymbol.declarations || typeSymbol.declarations);
44093
44122
  result.declarations = deduplicate(concatenate(valueSymbol.declarations, typeSymbol.declarations), equateValues);
44094
44123
  result.parent = valueSymbol.parent || typeSymbol.parent;
44095
44124
  if (valueSymbol.valueDeclaration)
@@ -47729,7 +47758,7 @@ function createTypeChecker(host) {
47729
47758
  }
47730
47759
  let hadError = false;
47731
47760
  const file = getSourceFileOfNode(existing);
47732
- const transformed = visitNode(existing, visitExistingNodeTreeSymbols);
47761
+ const transformed = visitNode(existing, visitExistingNodeTreeSymbols, isTypeNode);
47733
47762
  if (hadError) {
47734
47763
  return void 0;
47735
47764
  }
@@ -47742,16 +47771,16 @@ function createTypeChecker(host) {
47742
47771
  return factory.createKeywordTypeNode(157 /* UnknownKeyword */);
47743
47772
  }
47744
47773
  if (isJSDocNullableType(node)) {
47745
- return factory.createUnionTypeNode([visitNode(node.type, visitExistingNodeTreeSymbols), factory.createLiteralTypeNode(factory.createNull())]);
47774
+ return factory.createUnionTypeNode([visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode), factory.createLiteralTypeNode(factory.createNull())]);
47746
47775
  }
47747
47776
  if (isJSDocOptionalType(node)) {
47748
- return factory.createUnionTypeNode([visitNode(node.type, visitExistingNodeTreeSymbols), factory.createKeywordTypeNode(155 /* UndefinedKeyword */)]);
47777
+ return factory.createUnionTypeNode([visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode), factory.createKeywordTypeNode(155 /* UndefinedKeyword */)]);
47749
47778
  }
47750
47779
  if (isJSDocNonNullableType(node)) {
47751
47780
  return visitNode(node.type, visitExistingNodeTreeSymbols);
47752
47781
  }
47753
47782
  if (isJSDocVariadicType(node)) {
47754
- return factory.createArrayTypeNode(visitNode(node.type, visitExistingNodeTreeSymbols));
47783
+ return factory.createArrayTypeNode(visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
47755
47784
  }
47756
47785
  if (isJSDocTypeLiteral(node)) {
47757
47786
  return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
@@ -47763,7 +47792,7 @@ function createTypeChecker(host) {
47763
47792
  void 0,
47764
47793
  name,
47765
47794
  t.isBracketed || t.typeExpression && isJSDocOptionalType(t.typeExpression.type) ? factory.createToken(57 /* QuestionToken */) : void 0,
47766
- overrideTypeNode || t.typeExpression && visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols) || factory.createKeywordTypeNode(131 /* AnyKeyword */)
47795
+ overrideTypeNode || t.typeExpression && visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(131 /* AnyKeyword */)
47767
47796
  );
47768
47797
  }));
47769
47798
  }
@@ -47782,9 +47811,9 @@ function createTypeChecker(host) {
47782
47811
  "x",
47783
47812
  /*questionToken*/
47784
47813
  void 0,
47785
- visitNode(node.typeArguments[0], visitExistingNodeTreeSymbols)
47814
+ visitNode(node.typeArguments[0], visitExistingNodeTreeSymbols, isTypeNode)
47786
47815
  )],
47787
- visitNode(node.typeArguments[1], visitExistingNodeTreeSymbols)
47816
+ visitNode(node.typeArguments[1], visitExistingNodeTreeSymbols, isTypeNode)
47788
47817
  )]);
47789
47818
  }
47790
47819
  if (isJSDocFunctionType(node)) {
@@ -47793,33 +47822,33 @@ function createTypeChecker(host) {
47793
47822
  return factory.createConstructorTypeNode(
47794
47823
  /*modifiers*/
47795
47824
  void 0,
47796
- visitNodes2(node.typeParameters, visitExistingNodeTreeSymbols),
47825
+ visitNodes2(node.typeParameters, visitExistingNodeTreeSymbols, isTypeParameterDeclaration),
47797
47826
  mapDefined(node.parameters, (p, i) => p.name && isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode = p.type, void 0) : factory.createParameterDeclaration(
47798
47827
  /*modifiers*/
47799
47828
  void 0,
47800
47829
  getEffectiveDotDotDotForParameter(p),
47801
47830
  getNameForJSDocFunctionParameter(p, i),
47802
47831
  p.questionToken,
47803
- visitNode(p.type, visitExistingNodeTreeSymbols),
47832
+ visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
47804
47833
  /*initializer*/
47805
47834
  void 0
47806
47835
  )),
47807
- visitNode(newTypeNode || node.type, visitExistingNodeTreeSymbols) || factory.createKeywordTypeNode(131 /* AnyKeyword */)
47836
+ visitNode(newTypeNode || node.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(131 /* AnyKeyword */)
47808
47837
  );
47809
47838
  } else {
47810
47839
  return factory.createFunctionTypeNode(
47811
- visitNodes2(node.typeParameters, visitExistingNodeTreeSymbols),
47840
+ visitNodes2(node.typeParameters, visitExistingNodeTreeSymbols, isTypeParameterDeclaration),
47812
47841
  map(node.parameters, (p, i) => factory.createParameterDeclaration(
47813
47842
  /*modifiers*/
47814
47843
  void 0,
47815
47844
  getEffectiveDotDotDotForParameter(p),
47816
47845
  getNameForJSDocFunctionParameter(p, i),
47817
47846
  p.questionToken,
47818
- visitNode(p.type, visitExistingNodeTreeSymbols),
47847
+ visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
47819
47848
  /*initializer*/
47820
47849
  void 0
47821
47850
  )),
47822
- visitNode(node.type, visitExistingNodeTreeSymbols) || factory.createKeywordTypeNode(131 /* AnyKeyword */)
47851
+ visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(131 /* AnyKeyword */)
47823
47852
  );
47824
47853
  }
47825
47854
  }
@@ -48741,7 +48770,7 @@ function createTypeChecker(host) {
48741
48770
  break;
48742
48771
  }
48743
48772
  case 268 /* ImportEqualsDeclaration */:
48744
- if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, isJsonSourceFile)) {
48773
+ if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) {
48745
48774
  serializeMaybeAliasAssignment(symbol);
48746
48775
  break;
48747
48776
  }
@@ -64216,7 +64245,7 @@ function createTypeChecker(host) {
64216
64245
  return getNonMissingTypeOfSymbol(symbol);
64217
64246
  }
64218
64247
  function getControlFlowContainer(node) {
64219
- return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */);
64248
+ return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 295 /* CatchClause */ || node2.kind === 169 /* PropertyDeclaration */);
64220
64249
  }
64221
64250
  function isSymbolAssigned(symbol) {
64222
64251
  if (!symbol.valueDeclaration) {
@@ -64474,13 +64503,14 @@ function createTypeChecker(host) {
64474
64503
  const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */;
64475
64504
  const declarationContainer = getControlFlowContainer(declaration);
64476
64505
  let flowContainer = getControlFlowContainer(node);
64506
+ const isCatch = flowContainer.kind === 295 /* CatchClause */;
64477
64507
  const isOuterVariable = flowContainer !== declarationContainer;
64478
64508
  const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
64479
64509
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
64480
64510
  while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
64481
64511
  flowContainer = getControlFlowContainer(flowContainer);
64482
64512
  }
64483
- const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
64513
+ const assumeInitialized = isParameter2 || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
64484
64514
  const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
64485
64515
  const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
64486
64516
  if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -81085,13 +81115,10 @@ var SymbolTrackerImpl = class {
81085
81115
 
81086
81116
  // src/compiler/visitorPublic.ts
81087
81117
  function visitNode(node, visitor, test, lift) {
81088
- if (node === void 0 || visitor === void 0) {
81118
+ if (node === void 0) {
81089
81119
  return node;
81090
81120
  }
81091
81121
  const visited = visitor(node);
81092
- if (visited === node) {
81093
- return node;
81094
- }
81095
81122
  let visitedNode;
81096
81123
  if (visited === void 0) {
81097
81124
  return void 0;
@@ -81104,7 +81131,7 @@ function visitNode(node, visitor, test, lift) {
81104
81131
  return visitedNode;
81105
81132
  }
81106
81133
  function visitNodes2(nodes, visitor, test, start, count) {
81107
- if (nodes === void 0 || visitor === void 0) {
81134
+ if (nodes === void 0) {
81108
81135
  return nodes;
81109
81136
  }
81110
81137
  const length2 = nodes.length;
@@ -81153,25 +81180,30 @@ function visitArrayWorker(nodes, visitor, test, start, count) {
81153
81180
  }
81154
81181
  for (let i = 0; i < count; i++) {
81155
81182
  const node = nodes[i + start];
81156
- const visited = node !== void 0 ? visitor(node) : void 0;
81183
+ const visited = node !== void 0 ? visitor ? visitor(node) : node : void 0;
81157
81184
  if (updated !== void 0 || visited === void 0 || visited !== node) {
81158
81185
  if (updated === void 0) {
81159
81186
  updated = nodes.slice(0, i);
81187
+ Debug.assertEachNode(updated, test);
81160
81188
  }
81161
81189
  if (visited) {
81162
81190
  if (isArray(visited)) {
81163
81191
  for (const visitedNode of visited) {
81164
- void Debug.assertNode(visitedNode, test);
81192
+ Debug.assertNode(visitedNode, test);
81165
81193
  updated.push(visitedNode);
81166
81194
  }
81167
81195
  } else {
81168
- void Debug.assertNode(visited, test);
81196
+ Debug.assertNode(visited, test);
81169
81197
  updated.push(visited);
81170
81198
  }
81171
81199
  }
81172
81200
  }
81173
81201
  }
81174
- return updated != null ? updated : nodes;
81202
+ if (updated) {
81203
+ return updated;
81204
+ }
81205
+ Debug.assertEachNode(nodes, test);
81206
+ return nodes;
81175
81207
  }
81176
81208
  function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict, nodesVisitor = visitNodes2) {
81177
81209
  context.startLexicalEnvironment();
@@ -81185,7 +81217,7 @@ function visitParameterList(nodes, visitor, context, nodesVisitor = visitNodes2)
81185
81217
  context.startLexicalEnvironment();
81186
81218
  if (nodes) {
81187
81219
  context.setLexicalEnvironmentFlags(1 /* InParameters */, true);
81188
- updated = nodesVisitor(nodes, visitor, isParameterDeclaration);
81220
+ updated = nodesVisitor(nodes, visitor, isParameter);
81189
81221
  if (context.getLexicalEnvironmentFlags() & 2 /* VariablesHoistedInParameters */ && getEmitScriptTarget(context.getCompilerOptions()) >= 2 /* ES2015 */) {
81190
81222
  updated = addDefaultValueAssignmentsIfNeeded(updated, context);
81191
81223
  }
@@ -81307,6 +81339,7 @@ function visitFunctionBody(node, visitor, context, nodeVisitor = visitNode) {
81307
81339
  function visitIterationBody(body, visitor, context, nodeVisitor = visitNode) {
81308
81340
  context.startBlockScope();
81309
81341
  const updated = nodeVisitor(body, visitor, isStatement, context.factory.liftToBlock);
81342
+ Debug.assert(updated);
81310
81343
  const declarations = context.endBlockScope();
81311
81344
  if (some(declarations)) {
81312
81345
  if (isBlock(updated)) {
@@ -81329,14 +81362,14 @@ var visitEachChildTable = {
81329
81362
  [163 /* QualifiedName */]: function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81330
81363
  return context.factory.updateQualifiedName(
81331
81364
  node,
81332
- nodeVisitor(node.left, visitor, isEntityName),
81333
- nodeVisitor(node.right, visitor, isIdentifier)
81365
+ Debug.checkDefined(nodeVisitor(node.left, visitor, isEntityName)),
81366
+ Debug.checkDefined(nodeVisitor(node.right, visitor, isIdentifier))
81334
81367
  );
81335
81368
  },
81336
81369
  [164 /* ComputedPropertyName */]: function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81337
81370
  return context.factory.updateComputedPropertyName(
81338
81371
  node,
81339
- nodeVisitor(node.expression, visitor, isExpression)
81372
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81340
81373
  );
81341
81374
  },
81342
81375
  // Signature elements
@@ -81344,7 +81377,7 @@ var visitEachChildTable = {
81344
81377
  return context.factory.updateTypeParameterDeclaration(
81345
81378
  node,
81346
81379
  nodesVisitor(node.modifiers, visitor, isModifier),
81347
- nodeVisitor(node.name, visitor, isIdentifier),
81380
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
81348
81381
  nodeVisitor(node.constraint, visitor, isTypeNode),
81349
81382
  nodeVisitor(node.default, visitor, isTypeNode)
81350
81383
  );
@@ -81353,9 +81386,9 @@ var visitEachChildTable = {
81353
81386
  return context.factory.updateParameterDeclaration(
81354
81387
  node,
81355
81388
  nodesVisitor(node.modifiers, visitor, isModifierLike),
81356
- nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken),
81357
- nodeVisitor(node.name, visitor, isBindingName),
81358
- nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken),
81389
+ tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
81390
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isBindingName)),
81391
+ tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
81359
81392
  nodeVisitor(node.type, visitor, isTypeNode),
81360
81393
  nodeVisitor(node.initializer, visitor, isExpression)
81361
81394
  );
@@ -81363,7 +81396,7 @@ var visitEachChildTable = {
81363
81396
  [167 /* Decorator */]: function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81364
81397
  return context.factory.updateDecorator(
81365
81398
  node,
81366
- nodeVisitor(node.expression, visitor, isExpression)
81399
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81367
81400
  );
81368
81401
  },
81369
81402
  // Type elements
@@ -81371,19 +81404,19 @@ var visitEachChildTable = {
81371
81404
  return context.factory.updatePropertySignature(
81372
81405
  node,
81373
81406
  nodesVisitor(node.modifiers, visitor, isModifier),
81374
- nodeVisitor(node.name, visitor, isPropertyName),
81375
- nodeVisitor(node.questionToken, tokenVisitor, isToken),
81407
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)),
81408
+ tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
81376
81409
  nodeVisitor(node.type, visitor, isTypeNode)
81377
81410
  );
81378
81411
  },
81379
81412
  [169 /* PropertyDeclaration */]: function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
81380
- var _a2;
81413
+ var _a2, _b;
81381
81414
  return context.factory.updatePropertyDeclaration(
81382
81415
  node,
81383
81416
  nodesVisitor(node.modifiers, visitor, isModifierLike),
81384
- nodeVisitor(node.name, visitor, isPropertyName),
81417
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)),
81385
81418
  // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration
81386
- nodeVisitor((_a2 = node.questionToken) != null ? _a2 : node.exclamationToken, tokenVisitor, isQuestionOrExclamationToken),
81419
+ tokenVisitor ? nodeVisitor((_a2 = node.questionToken) != null ? _a2 : node.exclamationToken, tokenVisitor, isQuestionOrExclamationToken) : (_b = node.questionToken) != null ? _b : node.exclamationToken,
81387
81420
  nodeVisitor(node.type, visitor, isTypeNode),
81388
81421
  nodeVisitor(node.initializer, visitor, isExpression)
81389
81422
  );
@@ -81392,10 +81425,10 @@ var visitEachChildTable = {
81392
81425
  return context.factory.updateMethodSignature(
81393
81426
  node,
81394
81427
  nodesVisitor(node.modifiers, visitor, isModifier),
81395
- nodeVisitor(node.name, visitor, isPropertyName),
81396
- nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken),
81428
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)),
81429
+ tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
81397
81430
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
81398
- nodesVisitor(node.parameters, visitor, isParameterDeclaration),
81431
+ nodesVisitor(node.parameters, visitor, isParameter),
81399
81432
  nodeVisitor(node.type, visitor, isTypeNode)
81400
81433
  );
81401
81434
  },
@@ -81403,9 +81436,9 @@ var visitEachChildTable = {
81403
81436
  return context.factory.updateMethodDeclaration(
81404
81437
  node,
81405
81438
  nodesVisitor(node.modifiers, visitor, isModifierLike),
81406
- nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken),
81407
- nodeVisitor(node.name, visitor, isPropertyName),
81408
- nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken),
81439
+ tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken,
81440
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)),
81441
+ tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
81409
81442
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
81410
81443
  visitParameterList(node.parameters, visitor, context, nodesVisitor),
81411
81444
  nodeVisitor(node.type, visitor, isTypeNode),
@@ -81424,7 +81457,7 @@ var visitEachChildTable = {
81424
81457
  return context.factory.updateGetAccessorDeclaration(
81425
81458
  node,
81426
81459
  nodesVisitor(node.modifiers, visitor, isModifierLike),
81427
- nodeVisitor(node.name, visitor, isPropertyName),
81460
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)),
81428
81461
  visitParameterList(node.parameters, visitor, context, nodesVisitor),
81429
81462
  nodeVisitor(node.type, visitor, isTypeNode),
81430
81463
  visitFunctionBody(node.body, visitor, context, nodeVisitor)
@@ -81434,7 +81467,7 @@ var visitEachChildTable = {
81434
81467
  return context.factory.updateSetAccessorDeclaration(
81435
81468
  node,
81436
81469
  nodesVisitor(node.modifiers, visitor, isModifierLike),
81437
- nodeVisitor(node.name, visitor, isPropertyName),
81470
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)),
81438
81471
  visitParameterList(node.parameters, visitor, context, nodesVisitor),
81439
81472
  visitFunctionBody(node.body, visitor, context, nodeVisitor)
81440
81473
  );
@@ -81451,7 +81484,7 @@ var visitEachChildTable = {
81451
81484
  return context.factory.updateCallSignature(
81452
81485
  node,
81453
81486
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
81454
- nodesVisitor(node.parameters, visitor, isParameterDeclaration),
81487
+ nodesVisitor(node.parameters, visitor, isParameter),
81455
81488
  nodeVisitor(node.type, visitor, isTypeNode)
81456
81489
  );
81457
81490
  },
@@ -81459,7 +81492,7 @@ var visitEachChildTable = {
81459
81492
  return context.factory.updateConstructSignature(
81460
81493
  node,
81461
81494
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
81462
- nodesVisitor(node.parameters, visitor, isParameterDeclaration),
81495
+ nodesVisitor(node.parameters, visitor, isParameter),
81463
81496
  nodeVisitor(node.type, visitor, isTypeNode)
81464
81497
  );
81465
81498
  },
@@ -81467,8 +81500,8 @@ var visitEachChildTable = {
81467
81500
  return context.factory.updateIndexSignature(
81468
81501
  node,
81469
81502
  nodesVisitor(node.modifiers, visitor, isModifier),
81470
- nodesVisitor(node.parameters, visitor, isParameterDeclaration),
81471
- nodeVisitor(node.type, visitor, isTypeNode)
81503
+ nodesVisitor(node.parameters, visitor, isParameter),
81504
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81472
81505
  );
81473
81506
  },
81474
81507
  // Types
@@ -81476,14 +81509,14 @@ var visitEachChildTable = {
81476
81509
  return context.factory.updateTypePredicateNode(
81477
81510
  node,
81478
81511
  nodeVisitor(node.assertsModifier, visitor, isAssertsKeyword),
81479
- nodeVisitor(node.parameterName, visitor, isIdentifierOrThisTypeNode),
81512
+ Debug.checkDefined(nodeVisitor(node.parameterName, visitor, isIdentifierOrThisTypeNode)),
81480
81513
  nodeVisitor(node.type, visitor, isTypeNode)
81481
81514
  );
81482
81515
  },
81483
81516
  [180 /* TypeReference */]: function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
81484
81517
  return context.factory.updateTypeReferenceNode(
81485
81518
  node,
81486
- nodeVisitor(node.typeName, visitor, isEntityName),
81519
+ Debug.checkDefined(nodeVisitor(node.typeName, visitor, isEntityName)),
81487
81520
  nodesVisitor(node.typeArguments, visitor, isTypeNode)
81488
81521
  );
81489
81522
  },
@@ -81491,8 +81524,8 @@ var visitEachChildTable = {
81491
81524
  return context.factory.updateFunctionTypeNode(
81492
81525
  node,
81493
81526
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
81494
- nodesVisitor(node.parameters, visitor, isParameterDeclaration),
81495
- nodeVisitor(node.type, visitor, isTypeNode)
81527
+ nodesVisitor(node.parameters, visitor, isParameter),
81528
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81496
81529
  );
81497
81530
  },
81498
81531
  [182 /* ConstructorType */]: function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
@@ -81500,14 +81533,14 @@ var visitEachChildTable = {
81500
81533
  node,
81501
81534
  nodesVisitor(node.modifiers, visitor, isModifier),
81502
81535
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
81503
- nodesVisitor(node.parameters, visitor, isParameterDeclaration),
81504
- nodeVisitor(node.type, visitor, isTypeNode)
81536
+ nodesVisitor(node.parameters, visitor, isParameter),
81537
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81505
81538
  );
81506
81539
  },
81507
81540
  [183 /* TypeQuery */]: function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
81508
81541
  return context.factory.updateTypeQueryNode(
81509
81542
  node,
81510
- nodeVisitor(node.exprName, visitor, isEntityName),
81543
+ Debug.checkDefined(nodeVisitor(node.exprName, visitor, isEntityName)),
81511
81544
  nodesVisitor(node.typeArguments, visitor, isTypeNode)
81512
81545
  );
81513
81546
  },
@@ -81520,7 +81553,7 @@ var visitEachChildTable = {
81520
81553
  [185 /* ArrayType */]: function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81521
81554
  return context.factory.updateArrayTypeNode(
81522
81555
  node,
81523
- nodeVisitor(node.elementType, visitor, isTypeNode)
81556
+ Debug.checkDefined(nodeVisitor(node.elementType, visitor, isTypeNode))
81524
81557
  );
81525
81558
  },
81526
81559
  [186 /* TupleType */]: function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
@@ -81532,13 +81565,13 @@ var visitEachChildTable = {
81532
81565
  [187 /* OptionalType */]: function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81533
81566
  return context.factory.updateOptionalTypeNode(
81534
81567
  node,
81535
- nodeVisitor(node.type, visitor, isTypeNode)
81568
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81536
81569
  );
81537
81570
  },
81538
81571
  [188 /* RestType */]: function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81539
81572
  return context.factory.updateRestTypeNode(
81540
81573
  node,
81541
- nodeVisitor(node.type, visitor, isTypeNode)
81574
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81542
81575
  );
81543
81576
  },
81544
81577
  [189 /* UnionType */]: function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
@@ -81556,22 +81589,22 @@ var visitEachChildTable = {
81556
81589
  [191 /* ConditionalType */]: function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81557
81590
  return context.factory.updateConditionalTypeNode(
81558
81591
  node,
81559
- nodeVisitor(node.checkType, visitor, isTypeNode),
81560
- nodeVisitor(node.extendsType, visitor, isTypeNode),
81561
- nodeVisitor(node.trueType, visitor, isTypeNode),
81562
- nodeVisitor(node.falseType, visitor, isTypeNode)
81592
+ Debug.checkDefined(nodeVisitor(node.checkType, visitor, isTypeNode)),
81593
+ Debug.checkDefined(nodeVisitor(node.extendsType, visitor, isTypeNode)),
81594
+ Debug.checkDefined(nodeVisitor(node.trueType, visitor, isTypeNode)),
81595
+ Debug.checkDefined(nodeVisitor(node.falseType, visitor, isTypeNode))
81563
81596
  );
81564
81597
  },
81565
81598
  [192 /* InferType */]: function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81566
81599
  return context.factory.updateInferTypeNode(
81567
81600
  node,
81568
- nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration)
81601
+ Debug.checkDefined(nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration))
81569
81602
  );
81570
81603
  },
81571
81604
  [202 /* ImportType */]: function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
81572
81605
  return context.factory.updateImportTypeNode(
81573
81606
  node,
81574
- nodeVisitor(node.argument, visitor, isTypeNode),
81607
+ Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)),
81575
81608
  nodeVisitor(node.assertions, visitor, isImportTypeAssertionContainer),
81576
81609
  nodeVisitor(node.qualifier, visitor, isEntityName),
81577
81610
  nodesVisitor(node.typeArguments, visitor, isTypeNode),
@@ -81581,45 +81614,45 @@ var visitEachChildTable = {
81581
81614
  [298 /* ImportTypeAssertionContainer */]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81582
81615
  return context.factory.updateImportTypeAssertionContainer(
81583
81616
  node,
81584
- nodeVisitor(node.assertClause, visitor, isAssertClause),
81617
+ Debug.checkDefined(nodeVisitor(node.assertClause, visitor, isAssertClause)),
81585
81618
  node.multiLine
81586
81619
  );
81587
81620
  },
81588
81621
  [199 /* NamedTupleMember */]: function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
81589
81622
  return context.factory.updateNamedTupleMember(
81590
81623
  node,
81591
- nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken),
81592
- nodeVisitor(node.name, visitor, isIdentifier),
81593
- nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken),
81594
- nodeVisitor(node.type, visitor, isTypeNode)
81624
+ tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
81625
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
81626
+ tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
81627
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81595
81628
  );
81596
81629
  },
81597
81630
  [193 /* ParenthesizedType */]: function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81598
81631
  return context.factory.updateParenthesizedType(
81599
81632
  node,
81600
- nodeVisitor(node.type, visitor, isTypeNode)
81633
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81601
81634
  );
81602
81635
  },
81603
81636
  [195 /* TypeOperator */]: function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81604
81637
  return context.factory.updateTypeOperatorNode(
81605
81638
  node,
81606
- nodeVisitor(node.type, visitor, isTypeNode)
81639
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81607
81640
  );
81608
81641
  },
81609
81642
  [196 /* IndexedAccessType */]: function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81610
81643
  return context.factory.updateIndexedAccessTypeNode(
81611
81644
  node,
81612
- nodeVisitor(node.objectType, visitor, isTypeNode),
81613
- nodeVisitor(node.indexType, visitor, isTypeNode)
81645
+ Debug.checkDefined(nodeVisitor(node.objectType, visitor, isTypeNode)),
81646
+ Debug.checkDefined(nodeVisitor(node.indexType, visitor, isTypeNode))
81614
81647
  );
81615
81648
  },
81616
81649
  [197 /* MappedType */]: function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
81617
81650
  return context.factory.updateMappedTypeNode(
81618
81651
  node,
81619
- nodeVisitor(node.readonlyToken, tokenVisitor, isReadonlyKeywordOrPlusOrMinusToken),
81620
- nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration),
81652
+ tokenVisitor ? nodeVisitor(node.readonlyToken, tokenVisitor, isReadonlyKeywordOrPlusOrMinusToken) : node.readonlyToken,
81653
+ Debug.checkDefined(nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration)),
81621
81654
  nodeVisitor(node.nameType, visitor, isTypeNode),
81622
- nodeVisitor(node.questionToken, tokenVisitor, isQuestionOrPlusOrMinusToken),
81655
+ tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionOrPlusOrMinusToken) : node.questionToken,
81623
81656
  nodeVisitor(node.type, visitor, isTypeNode),
81624
81657
  nodesVisitor(node.members, visitor, isTypeElement)
81625
81658
  );
@@ -81627,21 +81660,21 @@ var visitEachChildTable = {
81627
81660
  [198 /* LiteralType */]: function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81628
81661
  return context.factory.updateLiteralTypeNode(
81629
81662
  node,
81630
- nodeVisitor(node.literal, visitor, isExpression)
81663
+ Debug.checkDefined(nodeVisitor(node.literal, visitor, isLiteralTypeLiteral))
81631
81664
  );
81632
81665
  },
81633
81666
  [200 /* TemplateLiteralType */]: function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
81634
81667
  return context.factory.updateTemplateLiteralType(
81635
81668
  node,
81636
- nodeVisitor(node.head, visitor, isTemplateHead),
81669
+ Debug.checkDefined(nodeVisitor(node.head, visitor, isTemplateHead)),
81637
81670
  nodesVisitor(node.templateSpans, visitor, isTemplateLiteralTypeSpan)
81638
81671
  );
81639
81672
  },
81640
81673
  [201 /* TemplateLiteralTypeSpan */]: function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81641
81674
  return context.factory.updateTemplateLiteralTypeSpan(
81642
81675
  node,
81643
- nodeVisitor(node.type, visitor, isTypeNode),
81644
- nodeVisitor(node.literal, visitor, isTemplateMiddleOrTemplateTail)
81676
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)),
81677
+ Debug.checkDefined(nodeVisitor(node.literal, visitor, isTemplateMiddleOrTemplateTail))
81645
81678
  );
81646
81679
  },
81647
81680
  // Binding patterns
@@ -81660,9 +81693,9 @@ var visitEachChildTable = {
81660
81693
  [205 /* BindingElement */]: function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
81661
81694
  return context.factory.updateBindingElement(
81662
81695
  node,
81663
- nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken),
81696
+ tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
81664
81697
  nodeVisitor(node.propertyName, visitor, isPropertyName),
81665
- nodeVisitor(node.name, visitor, isBindingName),
81698
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isBindingName)),
81666
81699
  nodeVisitor(node.initializer, visitor, isExpression)
81667
81700
  );
81668
81701
  },
@@ -81682,37 +81715,37 @@ var visitEachChildTable = {
81682
81715
  [208 /* PropertyAccessExpression */]: function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
81683
81716
  return isPropertyAccessChain(node) ? context.factory.updatePropertyAccessChain(
81684
81717
  node,
81685
- nodeVisitor(node.expression, visitor, isExpression),
81686
- nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken),
81687
- nodeVisitor(node.name, visitor, isMemberName)
81718
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81719
+ tokenVisitor ? nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken) : node.questionDotToken,
81720
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isMemberName))
81688
81721
  ) : context.factory.updatePropertyAccessExpression(
81689
81722
  node,
81690
- nodeVisitor(node.expression, visitor, isExpression),
81691
- nodeVisitor(node.name, visitor, isMemberName)
81723
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81724
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isMemberName))
81692
81725
  );
81693
81726
  },
81694
81727
  [209 /* ElementAccessExpression */]: function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
81695
81728
  return isElementAccessChain(node) ? context.factory.updateElementAccessChain(
81696
81729
  node,
81697
- nodeVisitor(node.expression, visitor, isExpression),
81698
- nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken),
81699
- nodeVisitor(node.argumentExpression, visitor, isExpression)
81730
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81731
+ tokenVisitor ? nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken) : node.questionDotToken,
81732
+ Debug.checkDefined(nodeVisitor(node.argumentExpression, visitor, isExpression))
81700
81733
  ) : context.factory.updateElementAccessExpression(
81701
81734
  node,
81702
- nodeVisitor(node.expression, visitor, isExpression),
81703
- nodeVisitor(node.argumentExpression, visitor, isExpression)
81735
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81736
+ Debug.checkDefined(nodeVisitor(node.argumentExpression, visitor, isExpression))
81704
81737
  );
81705
81738
  },
81706
81739
  [210 /* CallExpression */]: function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
81707
81740
  return isCallChain(node) ? context.factory.updateCallChain(
81708
81741
  node,
81709
- nodeVisitor(node.expression, visitor, isExpression),
81710
- nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken),
81742
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81743
+ tokenVisitor ? nodeVisitor(node.questionDotToken, tokenVisitor, isQuestionDotToken) : node.questionDotToken,
81711
81744
  nodesVisitor(node.typeArguments, visitor, isTypeNode),
81712
81745
  nodesVisitor(node.arguments, visitor, isExpression)
81713
81746
  ) : context.factory.updateCallExpression(
81714
81747
  node,
81715
- nodeVisitor(node.expression, visitor, isExpression),
81748
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81716
81749
  nodesVisitor(node.typeArguments, visitor, isTypeNode),
81717
81750
  nodesVisitor(node.arguments, visitor, isExpression)
81718
81751
  );
@@ -81720,7 +81753,7 @@ var visitEachChildTable = {
81720
81753
  [211 /* NewExpression */]: function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
81721
81754
  return context.factory.updateNewExpression(
81722
81755
  node,
81723
- nodeVisitor(node.expression, visitor, isExpression),
81756
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81724
81757
  nodesVisitor(node.typeArguments, visitor, isTypeNode),
81725
81758
  nodesVisitor(node.arguments, visitor, isExpression)
81726
81759
  );
@@ -81728,29 +81761,29 @@ var visitEachChildTable = {
81728
81761
  [212 /* TaggedTemplateExpression */]: function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
81729
81762
  return context.factory.updateTaggedTemplateExpression(
81730
81763
  node,
81731
- nodeVisitor(node.tag, visitor, isExpression),
81764
+ Debug.checkDefined(nodeVisitor(node.tag, visitor, isExpression)),
81732
81765
  nodesVisitor(node.typeArguments, visitor, isTypeNode),
81733
- nodeVisitor(node.template, visitor, isTemplateLiteral)
81766
+ Debug.checkDefined(nodeVisitor(node.template, visitor, isTemplateLiteral))
81734
81767
  );
81735
81768
  },
81736
81769
  [213 /* TypeAssertionExpression */]: function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81737
81770
  return context.factory.updateTypeAssertion(
81738
81771
  node,
81739
- nodeVisitor(node.type, visitor, isTypeNode),
81740
- nodeVisitor(node.expression, visitor, isExpression)
81772
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)),
81773
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81741
81774
  );
81742
81775
  },
81743
81776
  [214 /* ParenthesizedExpression */]: function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81744
81777
  return context.factory.updateParenthesizedExpression(
81745
81778
  node,
81746
- nodeVisitor(node.expression, visitor, isExpression)
81779
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81747
81780
  );
81748
81781
  },
81749
81782
  [215 /* FunctionExpression */]: function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) {
81750
81783
  return context.factory.updateFunctionExpression(
81751
81784
  node,
81752
81785
  nodesVisitor(node.modifiers, visitor, isModifier),
81753
- nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken),
81786
+ tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken,
81754
81787
  nodeVisitor(node.name, visitor, isIdentifier),
81755
81788
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
81756
81789
  visitParameterList(node.parameters, visitor, context, nodesVisitor),
@@ -81765,82 +81798,82 @@ var visitEachChildTable = {
81765
81798
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
81766
81799
  visitParameterList(node.parameters, visitor, context, nodesVisitor),
81767
81800
  nodeVisitor(node.type, visitor, isTypeNode),
81768
- nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, isEqualsGreaterThanToken),
81801
+ tokenVisitor ? Debug.checkDefined(nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, isEqualsGreaterThanToken)) : node.equalsGreaterThanToken,
81769
81802
  visitFunctionBody(node.body, visitor, context, nodeVisitor)
81770
81803
  );
81771
81804
  },
81772
81805
  [217 /* DeleteExpression */]: function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81773
81806
  return context.factory.updateDeleteExpression(
81774
81807
  node,
81775
- nodeVisitor(node.expression, visitor, isExpression)
81808
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81776
81809
  );
81777
81810
  },
81778
81811
  [218 /* TypeOfExpression */]: function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81779
81812
  return context.factory.updateTypeOfExpression(
81780
81813
  node,
81781
- nodeVisitor(node.expression, visitor, isExpression)
81814
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81782
81815
  );
81783
81816
  },
81784
81817
  [219 /* VoidExpression */]: function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81785
81818
  return context.factory.updateVoidExpression(
81786
81819
  node,
81787
- nodeVisitor(node.expression, visitor, isExpression)
81820
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81788
81821
  );
81789
81822
  },
81790
81823
  [220 /* AwaitExpression */]: function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81791
81824
  return context.factory.updateAwaitExpression(
81792
81825
  node,
81793
- nodeVisitor(node.expression, visitor, isExpression)
81826
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81794
81827
  );
81795
81828
  },
81796
81829
  [221 /* PrefixUnaryExpression */]: function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81797
81830
  return context.factory.updatePrefixUnaryExpression(
81798
81831
  node,
81799
- nodeVisitor(node.operand, visitor, isExpression)
81832
+ Debug.checkDefined(nodeVisitor(node.operand, visitor, isExpression))
81800
81833
  );
81801
81834
  },
81802
81835
  [222 /* PostfixUnaryExpression */]: function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81803
81836
  return context.factory.updatePostfixUnaryExpression(
81804
81837
  node,
81805
- nodeVisitor(node.operand, visitor, isExpression)
81838
+ Debug.checkDefined(nodeVisitor(node.operand, visitor, isExpression))
81806
81839
  );
81807
81840
  },
81808
81841
  [223 /* BinaryExpression */]: function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
81809
81842
  return context.factory.updateBinaryExpression(
81810
81843
  node,
81811
- nodeVisitor(node.left, visitor, isExpression),
81812
- nodeVisitor(node.operatorToken, tokenVisitor, isBinaryOperatorToken),
81813
- nodeVisitor(node.right, visitor, isExpression)
81844
+ Debug.checkDefined(nodeVisitor(node.left, visitor, isExpression)),
81845
+ tokenVisitor ? Debug.checkDefined(nodeVisitor(node.operatorToken, tokenVisitor, isBinaryOperatorToken)) : node.operatorToken,
81846
+ Debug.checkDefined(nodeVisitor(node.right, visitor, isExpression))
81814
81847
  );
81815
81848
  },
81816
81849
  [224 /* ConditionalExpression */]: function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
81817
81850
  return context.factory.updateConditionalExpression(
81818
81851
  node,
81819
- nodeVisitor(node.condition, visitor, isExpression),
81820
- nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken),
81821
- nodeVisitor(node.whenTrue, visitor, isExpression),
81822
- nodeVisitor(node.colonToken, tokenVisitor, isColonToken),
81823
- nodeVisitor(node.whenFalse, visitor, isExpression)
81852
+ Debug.checkDefined(nodeVisitor(node.condition, visitor, isExpression)),
81853
+ tokenVisitor ? Debug.checkDefined(nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken)) : node.questionToken,
81854
+ Debug.checkDefined(nodeVisitor(node.whenTrue, visitor, isExpression)),
81855
+ tokenVisitor ? Debug.checkDefined(nodeVisitor(node.colonToken, tokenVisitor, isColonToken)) : node.colonToken,
81856
+ Debug.checkDefined(nodeVisitor(node.whenFalse, visitor, isExpression))
81824
81857
  );
81825
81858
  },
81826
81859
  [225 /* TemplateExpression */]: function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
81827
81860
  return context.factory.updateTemplateExpression(
81828
81861
  node,
81829
- nodeVisitor(node.head, visitor, isTemplateHead),
81862
+ Debug.checkDefined(nodeVisitor(node.head, visitor, isTemplateHead)),
81830
81863
  nodesVisitor(node.templateSpans, visitor, isTemplateSpan)
81831
81864
  );
81832
81865
  },
81833
81866
  [226 /* YieldExpression */]: function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
81834
81867
  return context.factory.updateYieldExpression(
81835
81868
  node,
81836
- nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken),
81869
+ tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken,
81837
81870
  nodeVisitor(node.expression, visitor, isExpression)
81838
81871
  );
81839
81872
  },
81840
81873
  [227 /* SpreadElement */]: function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81841
81874
  return context.factory.updateSpreadElement(
81842
81875
  node,
81843
- nodeVisitor(node.expression, visitor, isExpression)
81876
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81844
81877
  );
81845
81878
  },
81846
81879
  [228 /* ClassExpression */]: function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
@@ -81856,45 +81889,45 @@ var visitEachChildTable = {
81856
81889
  [230 /* ExpressionWithTypeArguments */]: function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
81857
81890
  return context.factory.updateExpressionWithTypeArguments(
81858
81891
  node,
81859
- nodeVisitor(node.expression, visitor, isExpression),
81892
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81860
81893
  nodesVisitor(node.typeArguments, visitor, isTypeNode)
81861
81894
  );
81862
81895
  },
81863
81896
  [231 /* AsExpression */]: function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81864
81897
  return context.factory.updateAsExpression(
81865
81898
  node,
81866
- nodeVisitor(node.expression, visitor, isExpression),
81867
- nodeVisitor(node.type, visitor, isTypeNode)
81899
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81900
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81868
81901
  );
81869
81902
  },
81870
81903
  [235 /* SatisfiesExpression */]: function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81871
81904
  return context.factory.updateSatisfiesExpression(
81872
81905
  node,
81873
- nodeVisitor(node.expression, visitor, isExpression),
81874
- nodeVisitor(node.type, visitor, isTypeNode)
81906
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81907
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
81875
81908
  );
81876
81909
  },
81877
81910
  [232 /* NonNullExpression */]: function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81878
81911
  return isOptionalChain(node) ? context.factory.updateNonNullChain(
81879
81912
  node,
81880
- nodeVisitor(node.expression, visitor, isExpression)
81913
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81881
81914
  ) : context.factory.updateNonNullExpression(
81882
81915
  node,
81883
- nodeVisitor(node.expression, visitor, isExpression)
81916
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81884
81917
  );
81885
81918
  },
81886
81919
  [233 /* MetaProperty */]: function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81887
81920
  return context.factory.updateMetaProperty(
81888
81921
  node,
81889
- nodeVisitor(node.name, visitor, isIdentifier)
81922
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
81890
81923
  );
81891
81924
  },
81892
81925
  // Misc
81893
81926
  [236 /* TemplateSpan */]: function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81894
81927
  return context.factory.updateTemplateSpan(
81895
81928
  node,
81896
- nodeVisitor(node.expression, visitor, isExpression),
81897
- nodeVisitor(node.literal, visitor, isTemplateMiddleOrTemplateTail)
81929
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81930
+ Debug.checkDefined(nodeVisitor(node.literal, visitor, isTemplateMiddleOrTemplateTail))
81898
81931
  );
81899
81932
  },
81900
81933
  // Element
@@ -81908,20 +81941,20 @@ var visitEachChildTable = {
81908
81941
  return context.factory.updateVariableStatement(
81909
81942
  node,
81910
81943
  nodesVisitor(node.modifiers, visitor, isModifier),
81911
- nodeVisitor(node.declarationList, visitor, isVariableDeclarationList)
81944
+ Debug.checkDefined(nodeVisitor(node.declarationList, visitor, isVariableDeclarationList))
81912
81945
  );
81913
81946
  },
81914
81947
  [241 /* ExpressionStatement */]: function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81915
81948
  return context.factory.updateExpressionStatement(
81916
81949
  node,
81917
- nodeVisitor(node.expression, visitor, isExpression)
81950
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81918
81951
  );
81919
81952
  },
81920
81953
  [242 /* IfStatement */]: function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81921
81954
  return context.factory.updateIfStatement(
81922
81955
  node,
81923
- nodeVisitor(node.expression, visitor, isExpression),
81924
- nodeVisitor(node.thenStatement, visitor, isStatement, context.factory.liftToBlock),
81956
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81957
+ Debug.checkDefined(nodeVisitor(node.thenStatement, visitor, isStatement, context.factory.liftToBlock)),
81925
81958
  nodeVisitor(node.elseStatement, visitor, isStatement, context.factory.liftToBlock)
81926
81959
  );
81927
81960
  },
@@ -81929,13 +81962,13 @@ var visitEachChildTable = {
81929
81962
  return context.factory.updateDoStatement(
81930
81963
  node,
81931
81964
  visitIterationBody(node.statement, visitor, context, nodeVisitor),
81932
- nodeVisitor(node.expression, visitor, isExpression)
81965
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
81933
81966
  );
81934
81967
  },
81935
81968
  [244 /* WhileStatement */]: function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81936
81969
  return context.factory.updateWhileStatement(
81937
81970
  node,
81938
- nodeVisitor(node.expression, visitor, isExpression),
81971
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81939
81972
  visitIterationBody(node.statement, visitor, context, nodeVisitor)
81940
81973
  );
81941
81974
  },
@@ -81951,17 +81984,17 @@ var visitEachChildTable = {
81951
81984
  [246 /* ForInStatement */]: function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81952
81985
  return context.factory.updateForInStatement(
81953
81986
  node,
81954
- nodeVisitor(node.initializer, visitor, isForInitializer),
81955
- nodeVisitor(node.expression, visitor, isExpression),
81987
+ Debug.checkDefined(nodeVisitor(node.initializer, visitor, isForInitializer)),
81988
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81956
81989
  visitIterationBody(node.statement, visitor, context, nodeVisitor)
81957
81990
  );
81958
81991
  },
81959
81992
  [247 /* ForOfStatement */]: function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
81960
81993
  return context.factory.updateForOfStatement(
81961
81994
  node,
81962
- nodeVisitor(node.awaitModifier, tokenVisitor, isAwaitKeyword),
81963
- nodeVisitor(node.initializer, visitor, isForInitializer),
81964
- nodeVisitor(node.expression, visitor, isExpression),
81995
+ tokenVisitor ? nodeVisitor(node.awaitModifier, tokenVisitor, isAwaitKeyword) : node.awaitModifier,
81996
+ Debug.checkDefined(nodeVisitor(node.initializer, visitor, isForInitializer)),
81997
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
81965
81998
  visitIterationBody(node.statement, visitor, context, nodeVisitor)
81966
81999
  );
81967
82000
  },
@@ -81986,34 +82019,34 @@ var visitEachChildTable = {
81986
82019
  [251 /* WithStatement */]: function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81987
82020
  return context.factory.updateWithStatement(
81988
82021
  node,
81989
- nodeVisitor(node.expression, visitor, isExpression),
81990
- nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)
82022
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
82023
+ Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock))
81991
82024
  );
81992
82025
  },
81993
82026
  [252 /* SwitchStatement */]: function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
81994
82027
  return context.factory.updateSwitchStatement(
81995
82028
  node,
81996
- nodeVisitor(node.expression, visitor, isExpression),
81997
- nodeVisitor(node.caseBlock, visitor, isCaseBlock)
82029
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
82030
+ Debug.checkDefined(nodeVisitor(node.caseBlock, visitor, isCaseBlock))
81998
82031
  );
81999
82032
  },
82000
82033
  [253 /* LabeledStatement */]: function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82001
82034
  return context.factory.updateLabeledStatement(
82002
82035
  node,
82003
- nodeVisitor(node.label, visitor, isIdentifier),
82004
- nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)
82036
+ Debug.checkDefined(nodeVisitor(node.label, visitor, isIdentifier)),
82037
+ Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock))
82005
82038
  );
82006
82039
  },
82007
82040
  [254 /* ThrowStatement */]: function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82008
82041
  return context.factory.updateThrowStatement(
82009
82042
  node,
82010
- nodeVisitor(node.expression, visitor, isExpression)
82043
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
82011
82044
  );
82012
82045
  },
82013
82046
  [255 /* TryStatement */]: function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82014
82047
  return context.factory.updateTryStatement(
82015
82048
  node,
82016
- nodeVisitor(node.tryBlock, visitor, isBlock),
82049
+ Debug.checkDefined(nodeVisitor(node.tryBlock, visitor, isBlock)),
82017
82050
  nodeVisitor(node.catchClause, visitor, isCatchClause),
82018
82051
  nodeVisitor(node.finallyBlock, visitor, isBlock)
82019
82052
  );
@@ -82021,8 +82054,8 @@ var visitEachChildTable = {
82021
82054
  [257 /* VariableDeclaration */]: function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) {
82022
82055
  return context.factory.updateVariableDeclaration(
82023
82056
  node,
82024
- nodeVisitor(node.name, visitor, isBindingName),
82025
- nodeVisitor(node.exclamationToken, tokenVisitor, isExclamationToken),
82057
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isBindingName)),
82058
+ tokenVisitor ? nodeVisitor(node.exclamationToken, tokenVisitor, isExclamationToken) : node.exclamationToken,
82026
82059
  nodeVisitor(node.type, visitor, isTypeNode),
82027
82060
  nodeVisitor(node.initializer, visitor, isExpression)
82028
82061
  );
@@ -82037,7 +82070,7 @@ var visitEachChildTable = {
82037
82070
  return context.factory.updateFunctionDeclaration(
82038
82071
  node,
82039
82072
  nodesVisitor(node.modifiers, visitor, isModifier),
82040
- nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken),
82073
+ tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken,
82041
82074
  nodeVisitor(node.name, visitor, isIdentifier),
82042
82075
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
82043
82076
  visitParameterList(node.parameters, visitor, context, nodesVisitor),
@@ -82059,7 +82092,7 @@ var visitEachChildTable = {
82059
82092
  return context.factory.updateInterfaceDeclaration(
82060
82093
  node,
82061
82094
  nodesVisitor(node.modifiers, visitor, isModifier),
82062
- nodeVisitor(node.name, visitor, isIdentifier),
82095
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
82063
82096
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
82064
82097
  nodesVisitor(node.heritageClauses, visitor, isHeritageClause),
82065
82098
  nodesVisitor(node.members, visitor, isTypeElement)
@@ -82069,16 +82102,16 @@ var visitEachChildTable = {
82069
82102
  return context.factory.updateTypeAliasDeclaration(
82070
82103
  node,
82071
82104
  nodesVisitor(node.modifiers, visitor, isModifier),
82072
- nodeVisitor(node.name, visitor, isIdentifier),
82105
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
82073
82106
  nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration),
82074
- nodeVisitor(node.type, visitor, isTypeNode)
82107
+ Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
82075
82108
  );
82076
82109
  },
82077
82110
  [263 /* EnumDeclaration */]: function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
82078
82111
  return context.factory.updateEnumDeclaration(
82079
82112
  node,
82080
82113
  nodesVisitor(node.modifiers, visitor, isModifier),
82081
- nodeVisitor(node.name, visitor, isIdentifier),
82114
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
82082
82115
  nodesVisitor(node.members, visitor, isEnumMember)
82083
82116
  );
82084
82117
  },
@@ -82086,7 +82119,7 @@ var visitEachChildTable = {
82086
82119
  return context.factory.updateModuleDeclaration(
82087
82120
  node,
82088
82121
  nodesVisitor(node.modifiers, visitor, isModifier),
82089
- nodeVisitor(node.name, visitor, isModuleName),
82122
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleName)),
82090
82123
  nodeVisitor(node.body, visitor, isModuleBody)
82091
82124
  );
82092
82125
  },
@@ -82105,7 +82138,7 @@ var visitEachChildTable = {
82105
82138
  [267 /* NamespaceExportDeclaration */]: function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82106
82139
  return context.factory.updateNamespaceExportDeclaration(
82107
82140
  node,
82108
- nodeVisitor(node.name, visitor, isIdentifier)
82141
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
82109
82142
  );
82110
82143
  },
82111
82144
  [268 /* ImportEqualsDeclaration */]: function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
@@ -82113,8 +82146,8 @@ var visitEachChildTable = {
82113
82146
  node,
82114
82147
  nodesVisitor(node.modifiers, visitor, isModifier),
82115
82148
  node.isTypeOnly,
82116
- nodeVisitor(node.name, visitor, isIdentifier),
82117
- nodeVisitor(node.moduleReference, visitor, isModuleReference)
82149
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
82150
+ Debug.checkDefined(nodeVisitor(node.moduleReference, visitor, isModuleReference))
82118
82151
  );
82119
82152
  },
82120
82153
  [269 /* ImportDeclaration */]: function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
@@ -82122,7 +82155,7 @@ var visitEachChildTable = {
82122
82155
  node,
82123
82156
  nodesVisitor(node.modifiers, visitor, isModifier),
82124
82157
  nodeVisitor(node.importClause, visitor, isImportClause),
82125
- nodeVisitor(node.moduleSpecifier, visitor, isExpression),
82158
+ Debug.checkDefined(nodeVisitor(node.moduleSpecifier, visitor, isExpression)),
82126
82159
  nodeVisitor(node.assertClause, visitor, isAssertClause)
82127
82160
  );
82128
82161
  },
@@ -82136,8 +82169,8 @@ var visitEachChildTable = {
82136
82169
  [297 /* AssertEntry */]: function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82137
82170
  return context.factory.updateAssertEntry(
82138
82171
  node,
82139
- nodeVisitor(node.name, visitor, isAssertionKey),
82140
- nodeVisitor(node.value, visitor, isExpression)
82172
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isAssertionKey)),
82173
+ Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression))
82141
82174
  );
82142
82175
  },
82143
82176
  [270 /* ImportClause */]: function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
@@ -82151,13 +82184,13 @@ var visitEachChildTable = {
82151
82184
  [271 /* NamespaceImport */]: function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82152
82185
  return context.factory.updateNamespaceImport(
82153
82186
  node,
82154
- nodeVisitor(node.name, visitor, isIdentifier)
82187
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
82155
82188
  );
82156
82189
  },
82157
82190
  [277 /* NamespaceExport */]: function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82158
82191
  return context.factory.updateNamespaceExport(
82159
82192
  node,
82160
- nodeVisitor(node.name, visitor, isIdentifier)
82193
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
82161
82194
  );
82162
82195
  },
82163
82196
  [272 /* NamedImports */]: function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
@@ -82171,14 +82204,14 @@ var visitEachChildTable = {
82171
82204
  node,
82172
82205
  node.isTypeOnly,
82173
82206
  nodeVisitor(node.propertyName, visitor, isIdentifier),
82174
- nodeVisitor(node.name, visitor, isIdentifier)
82207
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
82175
82208
  );
82176
82209
  },
82177
82210
  [274 /* ExportAssignment */]: function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
82178
82211
  return context.factory.updateExportAssignment(
82179
82212
  node,
82180
82213
  nodesVisitor(node.modifiers, visitor, isModifier),
82181
- nodeVisitor(node.expression, visitor, isExpression)
82214
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
82182
82215
  );
82183
82216
  },
82184
82217
  [275 /* ExportDeclaration */]: function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
@@ -82202,59 +82235,59 @@ var visitEachChildTable = {
82202
82235
  node,
82203
82236
  node.isTypeOnly,
82204
82237
  nodeVisitor(node.propertyName, visitor, isIdentifier),
82205
- nodeVisitor(node.name, visitor, isIdentifier)
82238
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
82206
82239
  );
82207
82240
  },
82208
82241
  // Module references
82209
82242
  [280 /* ExternalModuleReference */]: function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82210
82243
  return context.factory.updateExternalModuleReference(
82211
82244
  node,
82212
- nodeVisitor(node.expression, visitor, isExpression)
82245
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
82213
82246
  );
82214
82247
  },
82215
82248
  // JSX
82216
82249
  [281 /* JsxElement */]: function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
82217
82250
  return context.factory.updateJsxElement(
82218
82251
  node,
82219
- nodeVisitor(node.openingElement, visitor, isJsxOpeningElement),
82252
+ Debug.checkDefined(nodeVisitor(node.openingElement, visitor, isJsxOpeningElement)),
82220
82253
  nodesVisitor(node.children, visitor, isJsxChild),
82221
- nodeVisitor(node.closingElement, visitor, isJsxClosingElement)
82254
+ Debug.checkDefined(nodeVisitor(node.closingElement, visitor, isJsxClosingElement))
82222
82255
  );
82223
82256
  },
82224
82257
  [282 /* JsxSelfClosingElement */]: function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
82225
82258
  return context.factory.updateJsxSelfClosingElement(
82226
82259
  node,
82227
- nodeVisitor(node.tagName, visitor, isJsxTagNameExpression),
82260
+ Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)),
82228
82261
  nodesVisitor(node.typeArguments, visitor, isTypeNode),
82229
- nodeVisitor(node.attributes, visitor, isJsxAttributes)
82262
+ Debug.checkDefined(nodeVisitor(node.attributes, visitor, isJsxAttributes))
82230
82263
  );
82231
82264
  },
82232
82265
  [283 /* JsxOpeningElement */]: function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
82233
82266
  return context.factory.updateJsxOpeningElement(
82234
82267
  node,
82235
- nodeVisitor(node.tagName, visitor, isJsxTagNameExpression),
82268
+ Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)),
82236
82269
  nodesVisitor(node.typeArguments, visitor, isTypeNode),
82237
- nodeVisitor(node.attributes, visitor, isJsxAttributes)
82270
+ Debug.checkDefined(nodeVisitor(node.attributes, visitor, isJsxAttributes))
82238
82271
  );
82239
82272
  },
82240
82273
  [284 /* JsxClosingElement */]: function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82241
82274
  return context.factory.updateJsxClosingElement(
82242
82275
  node,
82243
- nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)
82276
+ Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression))
82244
82277
  );
82245
82278
  },
82246
82279
  [285 /* JsxFragment */]: function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
82247
82280
  return context.factory.updateJsxFragment(
82248
82281
  node,
82249
- nodeVisitor(node.openingFragment, visitor, isJsxOpeningFragment),
82282
+ Debug.checkDefined(nodeVisitor(node.openingFragment, visitor, isJsxOpeningFragment)),
82250
82283
  nodesVisitor(node.children, visitor, isJsxChild),
82251
- nodeVisitor(node.closingFragment, visitor, isJsxClosingFragment)
82284
+ Debug.checkDefined(nodeVisitor(node.closingFragment, visitor, isJsxClosingFragment))
82252
82285
  );
82253
82286
  },
82254
82287
  [288 /* JsxAttribute */]: function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82255
82288
  return context.factory.updateJsxAttribute(
82256
82289
  node,
82257
- nodeVisitor(node.name, visitor, isIdentifier),
82290
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
82258
82291
  nodeVisitor(node.initializer, visitor, isStringLiteralOrJsxExpression)
82259
82292
  );
82260
82293
  },
@@ -82267,20 +82300,20 @@ var visitEachChildTable = {
82267
82300
  [290 /* JsxSpreadAttribute */]: function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82268
82301
  return context.factory.updateJsxSpreadAttribute(
82269
82302
  node,
82270
- nodeVisitor(node.expression, visitor, isExpression)
82303
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
82271
82304
  );
82272
82305
  },
82273
82306
  [291 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82274
82307
  return context.factory.updateJsxExpression(
82275
82308
  node,
82276
- nodeVisitor(node.expression, visitor, isExpression)
82309
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
82277
82310
  );
82278
82311
  },
82279
82312
  // Clauses
82280
82313
  [292 /* CaseClause */]: function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) {
82281
82314
  return context.factory.updateCaseClause(
82282
82315
  node,
82283
- nodeVisitor(node.expression, visitor, isExpression),
82316
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)),
82284
82317
  nodesVisitor(node.statements, visitor, isStatement)
82285
82318
  );
82286
82319
  },
@@ -82300,35 +82333,35 @@ var visitEachChildTable = {
82300
82333
  return context.factory.updateCatchClause(
82301
82334
  node,
82302
82335
  nodeVisitor(node.variableDeclaration, visitor, isVariableDeclaration),
82303
- nodeVisitor(node.block, visitor, isBlock)
82336
+ Debug.checkDefined(nodeVisitor(node.block, visitor, isBlock))
82304
82337
  );
82305
82338
  },
82306
82339
  // Property assignments
82307
82340
  [299 /* PropertyAssignment */]: function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82308
82341
  return context.factory.updatePropertyAssignment(
82309
82342
  node,
82310
- nodeVisitor(node.name, visitor, isPropertyName),
82311
- nodeVisitor(node.initializer, visitor, isExpression)
82343
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)),
82344
+ Debug.checkDefined(nodeVisitor(node.initializer, visitor, isExpression))
82312
82345
  );
82313
82346
  },
82314
82347
  [300 /* ShorthandPropertyAssignment */]: function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82315
82348
  return context.factory.updateShorthandPropertyAssignment(
82316
82349
  node,
82317
- nodeVisitor(node.name, visitor, isIdentifier),
82350
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
82318
82351
  nodeVisitor(node.objectAssignmentInitializer, visitor, isExpression)
82319
82352
  );
82320
82353
  },
82321
82354
  [301 /* SpreadAssignment */]: function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82322
82355
  return context.factory.updateSpreadAssignment(
82323
82356
  node,
82324
- nodeVisitor(node.expression, visitor, isExpression)
82357
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
82325
82358
  );
82326
82359
  },
82327
82360
  // Enum
82328
82361
  [302 /* EnumMember */]: function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82329
82362
  return context.factory.updateEnumMember(
82330
82363
  node,
82331
- nodeVisitor(node.name, visitor, isPropertyName),
82364
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)),
82332
82365
  nodeVisitor(node.initializer, visitor, isExpression)
82333
82366
  );
82334
82367
  },
@@ -82343,7 +82376,7 @@ var visitEachChildTable = {
82343
82376
  [356 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
82344
82377
  return context.factory.updatePartiallyEmittedExpression(
82345
82378
  node,
82346
- nodeVisitor(node.expression, visitor, isExpression)
82379
+ Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
82347
82380
  );
82348
82381
  },
82349
82382
  [357 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
@@ -83129,7 +83162,7 @@ function flattenDestructuringAssignment(node, visitor, context, level, needsValu
83129
83162
  location = node = value;
83130
83163
  value = node.right;
83131
83164
  } else {
83132
- return visitNode(value, visitor, isExpression);
83165
+ return Debug.checkDefined(visitNode(value, visitor, isExpression));
83133
83166
  }
83134
83167
  }
83135
83168
  }
@@ -83148,6 +83181,7 @@ function flattenDestructuringAssignment(node, visitor, context, level, needsValu
83148
83181
  };
83149
83182
  if (value) {
83150
83183
  value = visitNode(value, visitor, isExpression);
83184
+ Debug.assert(value);
83151
83185
  if (isIdentifier(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node)) {
83152
83186
  value = ensureIdentifier(
83153
83187
  flattenContext,
@@ -83189,7 +83223,7 @@ function flattenDestructuringAssignment(node, visitor, context, level, needsValu
83189
83223
  function emitBindingOrAssignment(target, value2, location2, original) {
83190
83224
  Debug.assertNode(target, createAssignmentCallback ? isIdentifier : isExpression);
83191
83225
  const expression = createAssignmentCallback ? createAssignmentCallback(target, value2, location2) : setTextRange(
83192
- context.factory.createAssignment(visitNode(target, visitor, isExpression), value2),
83226
+ context.factory.createAssignment(Debug.checkDefined(visitNode(target, visitor, isExpression)), value2),
83193
83227
  location2
83194
83228
  );
83195
83229
  expression.original = original;
@@ -83246,7 +83280,7 @@ function flattenDestructuringBinding(node, visitor, context, level, rval, hoistT
83246
83280
  if (initializer && (isIdentifier(initializer) && bindingOrAssignmentElementAssignsToName(node, initializer.escapedText) || bindingOrAssignmentElementContainsNonLiteralComputedName(node))) {
83247
83281
  initializer = ensureIdentifier(
83248
83282
  flattenContext,
83249
- visitNode(initializer, flattenContext.visitor),
83283
+ Debug.checkDefined(visitNode(initializer, flattenContext.visitor, isExpression)),
83250
83284
  /*reuseIdentifierExpressions*/
83251
83285
  false,
83252
83286
  initializer
@@ -83367,7 +83401,7 @@ function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern
83367
83401
  if (!getRestIndicatorOfBindingOrAssignmentElement(element)) {
83368
83402
  const propertyName = getPropertyNameOfBindingOrAssignmentElement(element);
83369
83403
  if (flattenContext.level >= 1 /* ObjectRest */ && !(element.transformFlags & (32768 /* ContainsRestOrSpread */ | 65536 /* ContainsObjectRestOrSpread */)) && !(getTargetOfBindingOrAssignmentElement(element).transformFlags & (32768 /* ContainsRestOrSpread */ | 65536 /* ContainsObjectRestOrSpread */)) && !isComputedPropertyName(propertyName)) {
83370
- bindingElements = append(bindingElements, visitNode(element, flattenContext.visitor));
83404
+ bindingElements = append(bindingElements, visitNode(element, flattenContext.visitor, isBindingOrAssignmentElement));
83371
83405
  } else {
83372
83406
  if (bindingElements) {
83373
83407
  flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
@@ -83505,7 +83539,7 @@ function createDestructuringPropertyAccess(flattenContext, value, propertyName)
83505
83539
  if (isComputedPropertyName(propertyName)) {
83506
83540
  const argumentExpression = ensureIdentifier(
83507
83541
  flattenContext,
83508
- visitNode(propertyName.expression, flattenContext.visitor),
83542
+ Debug.checkDefined(visitNode(propertyName.expression, flattenContext.visitor, isExpression)),
83509
83543
  /*reuseIdentifierExpressions*/
83510
83544
  false,
83511
83545
  /*location*/
@@ -83548,6 +83582,7 @@ function makeArrayBindingPattern(factory2, elements) {
83548
83582
  return factory2.createArrayBindingPattern(elements);
83549
83583
  }
83550
83584
  function makeArrayAssignmentPattern(factory2, elements) {
83585
+ Debug.assertEachNode(elements, isArrayBindingOrAssignmentElement);
83551
83586
  return factory2.createArrayLiteralExpression(map(elements, factory2.converters.convertToArrayAssignmentElement));
83552
83587
  }
83553
83588
  function makeObjectBindingPattern(factory2, elements) {
@@ -83555,6 +83590,7 @@ function makeObjectBindingPattern(factory2, elements) {
83555
83590
  return factory2.createObjectBindingPattern(elements);
83556
83591
  }
83557
83592
  function makeObjectAssignmentPattern(factory2, elements) {
83593
+ Debug.assertEachNode(elements, isObjectBindingOrAssignmentElement);
83558
83594
  return factory2.createObjectLiteralExpression(map(elements, factory2.converters.convertToObjectAssignmentElement));
83559
83595
  }
83560
83596
  function makeBindingElement(factory2, name) {
@@ -83573,6 +83609,7 @@ function makeAssignmentElement(name) {
83573
83609
  // src/compiler/transformers/taggedTemplate.ts
83574
83610
  function processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, level) {
83575
83611
  const tag = visitNode(node.tag, visitor, isExpression);
83612
+ Debug.assert(tag);
83576
83613
  const templateArguments = [void 0];
83577
83614
  const cookedStrings = [];
83578
83615
  const rawStrings = [];
@@ -83589,7 +83626,7 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
83589
83626
  for (const templateSpan of template.templateSpans) {
83590
83627
  cookedStrings.push(createTemplateCooked(templateSpan.literal));
83591
83628
  rawStrings.push(getRawLiteral(templateSpan.literal, currentSourceFile));
83592
- templateArguments.push(visitNode(templateSpan.expression, visitor, isExpression));
83629
+ templateArguments.push(Debug.checkDefined(visitNode(templateSpan.expression, visitor, isExpression)));
83593
83630
  }
83594
83631
  }
83595
83632
  const helperCall = context.getEmitHelperFactory().createTemplateObjectHelper(
@@ -83962,7 +83999,7 @@ function transformTypeScript(context) {
83962
83999
  function visitObjectLiteralExpression(node) {
83963
84000
  return factory2.updateObjectLiteralExpression(
83964
84001
  node,
83965
- visitNodes2(node.properties, getObjectLiteralElementVisitor(node), isObjectLiteralElement)
84002
+ visitNodes2(node.properties, getObjectLiteralElementVisitor(node), isObjectLiteralElementLike)
83966
84003
  );
83967
84004
  }
83968
84005
  function getClassFacts(node, staticProperties) {
@@ -84160,6 +84197,7 @@ function transformTypeScript(context) {
84160
84197
  const decorators = [];
84161
84198
  for (const parameterDecorator of parameterDecorators) {
84162
84199
  const expression = visitNode(parameterDecorator.expression, visitor, isExpression);
84200
+ Debug.assert(expression);
84163
84201
  const helper = emitHelpers().createParamHelper(expression, parameterOffset);
84164
84202
  setTextRange(helper, parameterDecorator.expression);
84165
84203
  setEmitFlags(helper, 3072 /* NoComments */);
@@ -84283,6 +84321,7 @@ function transformTypeScript(context) {
84283
84321
  const name = member.name;
84284
84322
  if (isComputedPropertyName(name) && (!hasStaticModifier(member) && currentClassHasParameterProperties || hasDecorators(member))) {
84285
84323
  const expression = visitNode(name.expression, visitor, isExpression);
84324
+ Debug.assert(expression);
84286
84325
  const innerExpression = skipPartiallyEmittedExpressions(expression);
84287
84326
  if (!isSimpleInlineableExpression(innerExpression)) {
84288
84327
  const generatedName = factory2.getGeneratedNameForNode(name);
@@ -84290,7 +84329,7 @@ function transformTypeScript(context) {
84290
84329
  return factory2.updateComputedPropertyName(name, factory2.createAssignment(generatedName, expression));
84291
84330
  }
84292
84331
  }
84293
- return visitNode(name, visitor, isPropertyName);
84332
+ return Debug.checkDefined(visitNode(name, visitor, isPropertyName));
84294
84333
  }
84295
84334
  function visitHeritageClause(node) {
84296
84335
  if (node.token === 117 /* ImplementsKeyword */) {
@@ -84301,7 +84340,7 @@ function transformTypeScript(context) {
84301
84340
  function visitExpressionWithTypeArguments(node) {
84302
84341
  return factory2.updateExpressionWithTypeArguments(
84303
84342
  node,
84304
- visitNode(node.expression, visitor, isLeftHandSideExpression),
84343
+ Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression)),
84305
84344
  /*typeArguments*/
84306
84345
  void 0
84307
84346
  );
@@ -84320,7 +84359,7 @@ function transformTypeScript(context) {
84320
84359
  return factory2.updatePropertyDeclaration(
84321
84360
  node,
84322
84361
  concatenate(decorators, factory2.createModifiersFromModifierFlags(2 /* Ambient */)),
84323
- visitNode(node.name, visitor, isPropertyName),
84362
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
84324
84363
  /*questionOrExclamationToken*/
84325
84364
  void 0,
84326
84365
  /*type*/
@@ -84337,7 +84376,7 @@ function transformTypeScript(context) {
84337
84376
  void 0,
84338
84377
  /*type*/
84339
84378
  void 0,
84340
- visitNode(node.initializer, visitor)
84379
+ visitNode(node.initializer, visitor, isExpression)
84341
84380
  );
84342
84381
  }
84343
84382
  function visitConstructor(node) {
@@ -84556,7 +84595,7 @@ function transformTypeScript(context) {
84556
84595
  elideNodes(factory2, node.modifiers),
84557
84596
  // preserve positions, if available
84558
84597
  node.dotDotDotToken,
84559
- visitNode(node.name, visitor, isBindingName),
84598
+ Debug.checkDefined(visitNode(node.name, visitor, isBindingName)),
84560
84599
  /*questionToken*/
84561
84600
  void 0,
84562
84601
  /*type*/
@@ -84605,7 +84644,7 @@ function transformTypeScript(context) {
84605
84644
  return setTextRange(
84606
84645
  factory2.createAssignment(
84607
84646
  getNamespaceMemberNameWithSourceMapsAndWithoutComments(name),
84608
- visitNode(node.initializer, visitor, isExpression)
84647
+ Debug.checkDefined(visitNode(node.initializer, visitor, isExpression))
84609
84648
  ),
84610
84649
  /*location*/
84611
84650
  node
@@ -84615,7 +84654,7 @@ function transformTypeScript(context) {
84615
84654
  function visitVariableDeclaration(node) {
84616
84655
  const updated = factory2.updateVariableDeclaration(
84617
84656
  node,
84618
- visitNode(node.name, visitor, isBindingName),
84657
+ Debug.checkDefined(visitNode(node.name, visitor, isBindingName)),
84619
84658
  /*exclamationToken*/
84620
84659
  void 0,
84621
84660
  /*type*/
@@ -84631,26 +84670,30 @@ function transformTypeScript(context) {
84631
84670
  const innerExpression = skipOuterExpressions(node.expression, ~6 /* Assertions */);
84632
84671
  if (isAssertionExpression(innerExpression)) {
84633
84672
  const expression = visitNode(node.expression, visitor, isExpression);
84673
+ Debug.assert(expression);
84634
84674
  return factory2.createPartiallyEmittedExpression(expression, node);
84635
84675
  }
84636
84676
  return visitEachChild(node, visitor, context);
84637
84677
  }
84638
84678
  function visitAssertionExpression(node) {
84639
84679
  const expression = visitNode(node.expression, visitor, isExpression);
84680
+ Debug.assert(expression);
84640
84681
  return factory2.createPartiallyEmittedExpression(expression, node);
84641
84682
  }
84642
84683
  function visitNonNullExpression(node) {
84643
84684
  const expression = visitNode(node.expression, visitor, isLeftHandSideExpression);
84685
+ Debug.assert(expression);
84644
84686
  return factory2.createPartiallyEmittedExpression(expression, node);
84645
84687
  }
84646
84688
  function visitSatisfiesExpression(node) {
84647
84689
  const expression = visitNode(node.expression, visitor, isExpression);
84690
+ Debug.assert(expression);
84648
84691
  return factory2.createPartiallyEmittedExpression(expression, node);
84649
84692
  }
84650
84693
  function visitCallExpression(node) {
84651
84694
  return factory2.updateCallExpression(
84652
84695
  node,
84653
- visitNode(node.expression, visitor, isExpression),
84696
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
84654
84697
  /*typeArguments*/
84655
84698
  void 0,
84656
84699
  visitNodes2(node.arguments, visitor, isExpression)
@@ -84659,7 +84702,7 @@ function transformTypeScript(context) {
84659
84702
  function visitNewExpression(node) {
84660
84703
  return factory2.updateNewExpression(
84661
84704
  node,
84662
- visitNode(node.expression, visitor, isExpression),
84705
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
84663
84706
  /*typeArguments*/
84664
84707
  void 0,
84665
84708
  visitNodes2(node.arguments, visitor, isExpression)
@@ -84668,28 +84711,28 @@ function transformTypeScript(context) {
84668
84711
  function visitTaggedTemplateExpression(node) {
84669
84712
  return factory2.updateTaggedTemplateExpression(
84670
84713
  node,
84671
- visitNode(node.tag, visitor, isExpression),
84714
+ Debug.checkDefined(visitNode(node.tag, visitor, isExpression)),
84672
84715
  /*typeArguments*/
84673
84716
  void 0,
84674
- visitNode(node.template, visitor, isExpression)
84717
+ Debug.checkDefined(visitNode(node.template, visitor, isTemplateLiteral))
84675
84718
  );
84676
84719
  }
84677
84720
  function visitJsxSelfClosingElement(node) {
84678
84721
  return factory2.updateJsxSelfClosingElement(
84679
84722
  node,
84680
- visitNode(node.tagName, visitor, isJsxTagNameExpression),
84723
+ Debug.checkDefined(visitNode(node.tagName, visitor, isJsxTagNameExpression)),
84681
84724
  /*typeArguments*/
84682
84725
  void 0,
84683
- visitNode(node.attributes, visitor, isJsxAttributes)
84726
+ Debug.checkDefined(visitNode(node.attributes, visitor, isJsxAttributes))
84684
84727
  );
84685
84728
  }
84686
84729
  function visitJsxJsxOpeningElement(node) {
84687
84730
  return factory2.updateJsxOpeningElement(
84688
84731
  node,
84689
- visitNode(node.tagName, visitor, isJsxTagNameExpression),
84732
+ Debug.checkDefined(visitNode(node.tagName, visitor, isJsxTagNameExpression)),
84690
84733
  /*typeArguments*/
84691
84734
  void 0,
84692
- visitNode(node.attributes, visitor, isJsxAttributes)
84735
+ Debug.checkDefined(visitNode(node.attributes, visitor, isJsxAttributes))
84693
84736
  );
84694
84737
  }
84695
84738
  function shouldEmitEnumDeclaration(node) {
@@ -84835,7 +84878,7 @@ function transformTypeScript(context) {
84835
84878
  } else {
84836
84879
  enableSubstitutionForNonQualifiedEnumMembers();
84837
84880
  if (member.initializer) {
84838
- return visitNode(member.initializer, visitor, isExpression);
84881
+ return Debug.checkDefined(visitNode(member.initializer, visitor, isExpression));
84839
84882
  } else {
84840
84883
  return factory2.createVoidZero();
84841
84884
  }
@@ -85116,7 +85159,7 @@ function transformTypeScript(context) {
85116
85159
  return allowEmpty || some(elements) ? factory2.updateNamedExports(node, elements) : void 0;
85117
85160
  }
85118
85161
  function visitNamespaceExports(node) {
85119
- return factory2.updateNamespaceExport(node, visitNode(node.name, visitor, isIdentifier));
85162
+ return factory2.updateNamespaceExport(node, Debug.checkDefined(visitNode(node.name, visitor, isIdentifier)));
85120
85163
  }
85121
85164
  function visitNamedExportBindings(node, allowEmpty) {
85122
85165
  return isNamespaceExport(node) ? visitNamespaceExports(node) : visitNamedExports(node, allowEmpty);
@@ -85588,6 +85631,7 @@ function transformClassFields(context) {
85588
85631
  const info = accessPrivateIdentifier(node.left);
85589
85632
  if (info) {
85590
85633
  const receiver = visitNode(node.right, visitor, isExpression);
85634
+ Debug.assert(receiver);
85591
85635
  return setOriginalNode(
85592
85636
  context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver),
85593
85637
  node
@@ -85605,6 +85649,7 @@ function transformClassFields(context) {
85605
85649
  }
85606
85650
  function visitComputedPropertyName(node) {
85607
85651
  let expression = visitNode(node.expression, visitor, isExpression);
85652
+ Debug.assert(expression);
85608
85653
  if (some(pendingExpressions)) {
85609
85654
  if (isParenthesizedExpression(expression)) {
85610
85655
  expression = factory2.updateParenthesizedExpression(expression, factory2.inlineExpressions([...pendingExpressions, expression.expression]));
@@ -85686,6 +85731,7 @@ function transformClassFields(context) {
85686
85731
  const temp = factory2.createTempVariable(hoistVariableDeclaration);
85687
85732
  setSourceMapRange(temp, name.expression);
85688
85733
  const expression = visitNode(name.expression, visitor, isExpression);
85734
+ Debug.assert(expression);
85689
85735
  const assignment = factory2.createAssignment(temp, expression);
85690
85736
  setSourceMapRange(assignment, name.expression);
85691
85737
  getterName = factory2.updateComputedPropertyName(name, factory2.inlineExpressions([assignment, temp]));
@@ -85768,7 +85814,7 @@ function transformClassFields(context) {
85768
85814
  return transformFieldInitializer(node);
85769
85815
  }
85770
85816
  function createPrivateIdentifierAccess(info, receiver) {
85771
- return createPrivateIdentifierAccessHelper(info, visitNode(receiver, visitor, isExpression));
85817
+ return createPrivateIdentifierAccessHelper(info, Debug.checkDefined(visitNode(receiver, visitor, isExpression)));
85772
85818
  }
85773
85819
  function createPrivateIdentifierAccessHelper(info, receiver) {
85774
85820
  setCommentRange(receiver, moveRangePos(receiver, -1));
@@ -85838,7 +85884,7 @@ function transformClassFields(context) {
85838
85884
  if (classConstructor && superClassReference) {
85839
85885
  const superProperty = factory2.createReflectGetCall(
85840
85886
  superClassReference,
85841
- visitNode(node.argumentExpression, visitor, isExpression),
85887
+ Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression)),
85842
85888
  classConstructor
85843
85889
  );
85844
85890
  setOriginalNode(superProperty, node.expression);
@@ -85855,6 +85901,7 @@ function transformClassFields(context) {
85855
85901
  let info;
85856
85902
  if (info = accessPrivateIdentifier(operand.name)) {
85857
85903
  const receiver = visitNode(operand.expression, visitor, isExpression);
85904
+ Debug.assert(receiver);
85858
85905
  const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
85859
85906
  let expression = createPrivateIdentifierAccess(info, readExpression);
85860
85907
  const temp = isPrefixUnaryExpression(node) || valueIsDiscarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration);
@@ -85891,7 +85938,7 @@ function transformClassFields(context) {
85891
85938
  getterName = setterName = operand.argumentExpression;
85892
85939
  } else {
85893
85940
  getterName = factory2.createTempVariable(hoistVariableDeclaration);
85894
- setterName = factory2.createAssignment(getterName, visitNode(operand.argumentExpression, visitor, isExpression));
85941
+ setterName = factory2.createAssignment(getterName, Debug.checkDefined(visitNode(operand.argumentExpression, visitor, isExpression)));
85895
85942
  }
85896
85943
  }
85897
85944
  if (setterName && getterName) {
@@ -85925,7 +85972,7 @@ function transformClassFields(context) {
85925
85972
  function visitExpressionStatement(node) {
85926
85973
  return factory2.updateExpressionStatement(
85927
85974
  node,
85928
- visitNode(node.expression, discardedValueVisitor, isExpression)
85975
+ Debug.checkDefined(visitNode(node.expression, discardedValueVisitor, isExpression))
85929
85976
  );
85930
85977
  }
85931
85978
  function createCopiableReceiverExpr(receiver) {
@@ -85943,25 +85990,25 @@ function transformClassFields(context) {
85943
85990
  if (isCallChain(node)) {
85944
85991
  return factory2.updateCallChain(
85945
85992
  node,
85946
- factory2.createPropertyAccessChain(visitNode(target, visitor), node.questionDotToken, "call"),
85993
+ factory2.createPropertyAccessChain(Debug.checkDefined(visitNode(target, visitor, isExpression)), node.questionDotToken, "call"),
85947
85994
  /*questionDotToken*/
85948
85995
  void 0,
85949
85996
  /*typeArguments*/
85950
85997
  void 0,
85951
- [visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)]
85998
+ [Debug.checkDefined(visitNode(thisArg, visitor, isExpression)), ...visitNodes2(node.arguments, visitor, isExpression)]
85952
85999
  );
85953
86000
  }
85954
86001
  return factory2.updateCallExpression(
85955
86002
  node,
85956
- factory2.createPropertyAccessExpression(visitNode(target, visitor), "call"),
86003
+ factory2.createPropertyAccessExpression(Debug.checkDefined(visitNode(target, visitor, isExpression)), "call"),
85957
86004
  /*typeArguments*/
85958
86005
  void 0,
85959
- [visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)]
86006
+ [Debug.checkDefined(visitNode(thisArg, visitor, isExpression)), ...visitNodes2(node.arguments, visitor, isExpression)]
85960
86007
  );
85961
86008
  }
85962
86009
  if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment == null ? void 0 : currentClassLexicalEnvironment.classConstructor)) {
85963
86010
  const invocation = factory2.createFunctionCallCall(
85964
- visitNode(node.expression, visitor, isExpression),
86011
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
85965
86012
  currentClassLexicalEnvironment.classConstructor,
85966
86013
  visitNodes2(node.arguments, visitor, isExpression)
85967
86014
  );
@@ -85977,19 +86024,19 @@ function transformClassFields(context) {
85977
86024
  return factory2.updateTaggedTemplateExpression(
85978
86025
  node,
85979
86026
  factory2.createCallExpression(
85980
- factory2.createPropertyAccessExpression(visitNode(target, visitor), "bind"),
86027
+ factory2.createPropertyAccessExpression(Debug.checkDefined(visitNode(target, visitor, isExpression)), "bind"),
85981
86028
  /*typeArguments*/
85982
86029
  void 0,
85983
- [visitNode(thisArg, visitor, isExpression)]
86030
+ [Debug.checkDefined(visitNode(thisArg, visitor, isExpression))]
85984
86031
  ),
85985
86032
  /*typeArguments*/
85986
86033
  void 0,
85987
- visitNode(node.template, visitor, isTemplateLiteral)
86034
+ Debug.checkDefined(visitNode(node.template, visitor, isTemplateLiteral))
85988
86035
  );
85989
86036
  }
85990
86037
  if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment == null ? void 0 : currentClassLexicalEnvironment.classConstructor)) {
85991
86038
  const invocation = factory2.createFunctionBindCall(
85992
- visitNode(node.tag, visitor, isExpression),
86039
+ Debug.checkDefined(visitNode(node.tag, visitor, isExpression)),
85993
86040
  currentClassLexicalEnvironment.classConstructor,
85994
86041
  []
85995
86042
  );
@@ -86000,7 +86047,7 @@ function transformClassFields(context) {
86000
86047
  invocation,
86001
86048
  /*typeArguments*/
86002
86049
  void 0,
86003
- visitNode(node.template, visitor, isTemplateLiteral)
86050
+ Debug.checkDefined(visitNode(node.template, visitor, isTemplateLiteral))
86004
86051
  );
86005
86052
  }
86006
86053
  return visitEachChild(node, visitor, context);
@@ -86030,9 +86077,9 @@ function transformClassFields(context) {
86030
86077
  pendingExpressions = void 0;
86031
86078
  node = factory2.updateBinaryExpression(
86032
86079
  node,
86033
- visitNode(node.left, assignmentTargetVisitor),
86080
+ Debug.checkDefined(visitNode(node.left, assignmentTargetVisitor, isExpression)),
86034
86081
  node.operatorToken,
86035
- visitNode(node.right, visitor)
86082
+ Debug.checkDefined(visitNode(node.right, visitor, isExpression))
86036
86083
  );
86037
86084
  const expr = some(pendingExpressions) ? factory2.inlineExpressions(compact([...pendingExpressions, node])) : node;
86038
86085
  pendingExpressions = savedPendingExpressions;
@@ -86057,7 +86104,7 @@ function transformClassFields(context) {
86057
86104
  node,
86058
86105
  visitInvalidSuperProperty(node.left),
86059
86106
  node.operatorToken,
86060
- visitNode(node.right, visitor, isExpression)
86107
+ Debug.checkDefined(visitNode(node.right, visitor, isExpression))
86061
86108
  );
86062
86109
  }
86063
86110
  if (classConstructor && superClassReference) {
@@ -86077,6 +86124,7 @@ function transformClassFields(context) {
86077
86124
  );
86078
86125
  setOriginalNode(superPropertyGet, node.left);
86079
86126
  setTextRange(superPropertyGet, node.left);
86127
+ Debug.assert(expression);
86080
86128
  expression = factory2.createBinaryExpression(
86081
86129
  superPropertyGet,
86082
86130
  getNonAssignmentOperatorForCompoundAssignment(node.operatorToken.kind),
@@ -86086,9 +86134,11 @@ function transformClassFields(context) {
86086
86134
  }
86087
86135
  const temp = valueIsDiscarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration);
86088
86136
  if (temp) {
86137
+ Debug.assert(expression);
86089
86138
  expression = factory2.createAssignment(temp, expression);
86090
86139
  setTextRange(temp, node);
86091
86140
  }
86141
+ Debug.assert(expression);
86092
86142
  expression = factory2.createReflectSetCall(
86093
86143
  superClassReference,
86094
86144
  setterName,
@@ -86112,8 +86162,8 @@ function transformClassFields(context) {
86112
86162
  return visitEachChild(node, visitor, context);
86113
86163
  }
86114
86164
  function createPrivateIdentifierAssignment(info, receiver, right, operator) {
86115
- receiver = visitNode(receiver, visitor, isExpression);
86116
- right = visitNode(right, visitor, isExpression);
86165
+ receiver = Debug.checkDefined(visitNode(receiver, visitor, isExpression));
86166
+ right = Debug.checkDefined(visitNode(right, visitor, isExpression));
86117
86167
  if (isCompoundAssignment(operator)) {
86118
86168
  const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver);
86119
86169
  receiver = initializeExpression || readExpression;
@@ -86216,7 +86266,7 @@ function transformClassFields(context) {
86216
86266
  node,
86217
86267
  factory2.createAssignment(
86218
86268
  temp,
86219
- visitNode(node.expression, visitor, isExpression)
86269
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression))
86220
86270
  ),
86221
86271
  /*typeArguments*/
86222
86272
  void 0
@@ -86778,7 +86828,7 @@ function transformClassFields(context) {
86778
86828
  ) : factory2.updateElementAccessExpression(
86779
86829
  node,
86780
86830
  factory2.createVoidZero(),
86781
- visitNode(node.argumentExpression, visitor, isExpression)
86831
+ Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression))
86782
86832
  );
86783
86833
  }
86784
86834
  function onEmitNode(hint, node, emitCallback) {
@@ -86895,6 +86945,7 @@ function transformClassFields(context) {
86895
86945
  function getPropertyNameExpressionIfNeeded(name, shouldHoist) {
86896
86946
  if (isComputedPropertyName(name)) {
86897
86947
  const expression = visitNode(name.expression, visitor, isExpression);
86948
+ Debug.assert(expression);
86898
86949
  const innerExpression = skipPartiallyEmittedExpressions(expression);
86899
86950
  const inlinable = isSimpleInlineableExpression(innerExpression);
86900
86951
  const alreadyTransformed = isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
@@ -87116,7 +87167,7 @@ function transformClassFields(context) {
87116
87167
  /*reservedInNestedScopes*/
87117
87168
  true
87118
87169
  );
87119
- getPendingExpressions().push(factory2.createBinaryExpression(receiver, 63 /* EqualsToken */, visitNode(node.expression, visitor, isExpression)));
87170
+ getPendingExpressions().push(factory2.createBinaryExpression(receiver, 63 /* EqualsToken */, Debug.checkDefined(visitNode(node.expression, visitor, isExpression))));
87120
87171
  }
87121
87172
  return factory2.createAssignmentTargetWrapper(
87122
87173
  parameter,
@@ -87129,6 +87180,7 @@ function transformClassFields(context) {
87129
87180
  );
87130
87181
  }
87131
87182
  function visitArrayAssignmentTarget(node) {
87183
+ Debug.assertNode(node, isBindingOrAssignmentElement);
87132
87184
  const target = getTargetOfBindingOrAssignmentElement(node);
87133
87185
  if (target) {
87134
87186
  let wrapped;
@@ -87163,7 +87215,7 @@ function transformClassFields(context) {
87163
87215
  node,
87164
87216
  wrapped,
87165
87217
  node.operatorToken,
87166
- visitNode(node.right, visitor, isExpression)
87218
+ Debug.checkDefined(visitNode(node.right, visitor, isExpression))
87167
87219
  );
87168
87220
  } else if (isSpreadElement(node)) {
87169
87221
  return factory2.updateSpreadElement(node, wrapped);
@@ -87209,14 +87261,14 @@ function transformClassFields(context) {
87209
87261
  const initializer = getInitializerOfBindingOrAssignmentElement(node);
87210
87262
  return factory2.updatePropertyAssignment(
87211
87263
  node,
87212
- visitNode(node.name, visitor, isPropertyName),
87213
- wrapped ? initializer ? factory2.createAssignment(wrapped, visitNode(initializer, visitor)) : wrapped : visitNode(node.initializer, assignmentTargetVisitor, isExpression)
87264
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
87265
+ wrapped ? initializer ? factory2.createAssignment(wrapped, Debug.checkDefined(visitNode(initializer, visitor, isExpression))) : wrapped : Debug.checkDefined(visitNode(node.initializer, assignmentTargetVisitor, isExpression))
87214
87266
  );
87215
87267
  }
87216
87268
  if (isSpreadAssignment(node)) {
87217
87269
  return factory2.updateSpreadAssignment(
87218
87270
  node,
87219
- wrapped || visitNode(node.expression, assignmentTargetVisitor, isExpression)
87271
+ wrapped || Debug.checkDefined(visitNode(node.expression, assignmentTargetVisitor, isExpression))
87220
87272
  );
87221
87273
  }
87222
87274
  Debug.assert(wrapped === void 0, "Should not have generated a wrapped target");
@@ -87830,7 +87882,7 @@ function transformLegacyDecorators(context) {
87830
87882
  return factory2.updateConstructorDeclaration(
87831
87883
  node,
87832
87884
  visitNodes2(node.modifiers, modifierVisitor, isModifier),
87833
- visitNodes2(node.parameters, visitor, isParameterDeclaration),
87885
+ visitNodes2(node.parameters, visitor, isParameter),
87834
87886
  visitNode(node.body, visitor, isBlock)
87835
87887
  );
87836
87888
  }
@@ -87846,12 +87898,12 @@ function transformLegacyDecorators(context) {
87846
87898
  node,
87847
87899
  visitNodes2(node.modifiers, modifierVisitor, isModifier),
87848
87900
  node.asteriskToken,
87849
- visitNode(node.name, visitor, isPropertyName),
87901
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
87850
87902
  /*questionToken*/
87851
87903
  void 0,
87852
87904
  /*typeParameters*/
87853
87905
  void 0,
87854
- visitNodes2(node.parameters, visitor, isParameterDeclaration),
87906
+ visitNodes2(node.parameters, visitor, isParameter),
87855
87907
  /*type*/
87856
87908
  void 0,
87857
87909
  visitNode(node.body, visitor, isBlock)
@@ -87861,8 +87913,8 @@ function transformLegacyDecorators(context) {
87861
87913
  return finishClassElement(factory2.updateGetAccessorDeclaration(
87862
87914
  node,
87863
87915
  visitNodes2(node.modifiers, modifierVisitor, isModifier),
87864
- visitNode(node.name, visitor, isPropertyName),
87865
- visitNodes2(node.parameters, visitor, isParameterDeclaration),
87916
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
87917
+ visitNodes2(node.parameters, visitor, isParameter),
87866
87918
  /*type*/
87867
87919
  void 0,
87868
87920
  visitNode(node.body, visitor, isBlock)
@@ -87872,8 +87924,8 @@ function transformLegacyDecorators(context) {
87872
87924
  return finishClassElement(factory2.updateSetAccessorDeclaration(
87873
87925
  node,
87874
87926
  visitNodes2(node.modifiers, modifierVisitor, isModifier),
87875
- visitNode(node.name, visitor, isPropertyName),
87876
- visitNodes2(node.parameters, visitor, isParameterDeclaration),
87927
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
87928
+ visitNodes2(node.parameters, visitor, isParameter),
87877
87929
  visitNode(node.body, visitor, isBlock)
87878
87930
  ), node);
87879
87931
  }
@@ -87884,7 +87936,7 @@ function transformLegacyDecorators(context) {
87884
87936
  return finishClassElement(factory2.updatePropertyDeclaration(
87885
87937
  node,
87886
87938
  visitNodes2(node.modifiers, modifierVisitor, isModifier),
87887
- visitNode(node.name, visitor, isPropertyName),
87939
+ Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
87888
87940
  /*questionOrExclamationToken*/
87889
87941
  void 0,
87890
87942
  /*type*/
@@ -87897,7 +87949,7 @@ function transformLegacyDecorators(context) {
87897
87949
  node,
87898
87950
  elideNodes(factory2, node.modifiers),
87899
87951
  node.dotDotDotToken,
87900
- visitNode(node.name, visitor, isBindingName),
87952
+ Debug.checkDefined(visitNode(node.name, visitor, isBindingName)),
87901
87953
  /*questionToken*/
87902
87954
  void 0,
87903
87955
  /*type*/
@@ -87994,7 +88046,7 @@ function transformLegacyDecorators(context) {
87994
88046
  return expression;
87995
88047
  }
87996
88048
  function transformDecorator(decorator) {
87997
- return visitNode(decorator.expression, visitor, isExpression);
88049
+ return Debug.checkDefined(visitNode(decorator.expression, visitor, isExpression));
87998
88050
  }
87999
88051
  function transformDecoratorsOfParameter(decorators, parameterOffset) {
88000
88052
  let expressions;
@@ -88260,21 +88312,21 @@ function transformES2017(context) {
88260
88312
  node.initializer,
88261
88313
  /*hasReceiver*/
88262
88314
  true
88263
- ) : visitNode(node.initializer, visitor, isForInitializer),
88264
- visitNode(node.expression, visitor, isExpression),
88315
+ ) : Debug.checkDefined(visitNode(node.initializer, visitor, isForInitializer)),
88316
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
88265
88317
  visitIterationBody(node.statement, asyncBodyVisitor, context)
88266
88318
  );
88267
88319
  }
88268
88320
  function visitForOfStatementInAsyncBody(node) {
88269
88321
  return factory2.updateForOfStatement(
88270
88322
  node,
88271
- visitNode(node.awaitModifier, visitor, isToken),
88323
+ visitNode(node.awaitModifier, visitor, isAwaitKeyword),
88272
88324
  isVariableDeclarationListWithCollidingName(node.initializer) ? visitVariableDeclarationListWithCollidingNames(
88273
88325
  node.initializer,
88274
88326
  /*hasReceiver*/
88275
88327
  true
88276
- ) : visitNode(node.initializer, visitor, isForInitializer),
88277
- visitNode(node.expression, visitor, isExpression),
88328
+ ) : Debug.checkDefined(visitNode(node.initializer, visitor, isForInitializer)),
88329
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
88278
88330
  visitIterationBody(node.statement, asyncBodyVisitor, context)
88279
88331
  );
88280
88332
  }
@@ -88311,7 +88363,7 @@ function transformES2017(context) {
88311
88363
  function visitConstructorDeclaration(node) {
88312
88364
  return factory2.updateConstructorDeclaration(
88313
88365
  node,
88314
- visitNodes2(node.modifiers, visitor, isModifierLike),
88366
+ visitNodes2(node.modifiers, visitor, isModifier),
88315
88367
  visitParameterList(node.parameters, visitor, context),
88316
88368
  transformMethodBody(node)
88317
88369
  );
@@ -88369,7 +88421,7 @@ function transformES2017(context) {
88369
88421
  function visitFunctionExpression(node) {
88370
88422
  return factory2.updateFunctionExpression(
88371
88423
  node,
88372
- visitNodes2(node.modifiers, visitor, isModifierLike),
88424
+ visitNodes2(node.modifiers, visitor, isModifier),
88373
88425
  node.asteriskToken,
88374
88426
  node.name,
88375
88427
  /*typeParameters*/
@@ -88383,7 +88435,7 @@ function transformES2017(context) {
88383
88435
  function visitArrowFunction(node) {
88384
88436
  return factory2.updateArrowFunction(
88385
88437
  node,
88386
- visitNodes2(node.modifiers, visitor, isModifierLike),
88438
+ visitNodes2(node.modifiers, visitor, isModifier),
88387
88439
  /*typeParameters*/
88388
88440
  void 0,
88389
88441
  visitParameterList(node.parameters, visitor, context),
@@ -88440,7 +88492,7 @@ function transformES2017(context) {
88440
88492
  ),
88441
88493
  node
88442
88494
  );
88443
- return visitNode(converted, visitor, isExpression);
88495
+ return Debug.checkDefined(visitNode(converted, visitor, isExpression));
88444
88496
  }
88445
88497
  function collidesWithParameterName({ name }) {
88446
88498
  if (isIdentifier(name)) {
@@ -88572,7 +88624,7 @@ function transformES2017(context) {
88572
88624
  if (isBlock(body)) {
88573
88625
  return factory2.updateBlock(body, visitNodes2(body.statements, asyncBodyVisitor, isStatement, start));
88574
88626
  } else {
88575
- return factory2.converters.convertToFunctionBlock(visitNode(body, asyncBodyVisitor, isConciseBody));
88627
+ return factory2.converters.convertToFunctionBlock(Debug.checkDefined(visitNode(body, asyncBodyVisitor, isConciseBody)));
88576
88628
  }
88577
88629
  }
88578
88630
  function getPromiseConstructor(type) {
@@ -89685,7 +89737,7 @@ function transformES2018(context) {
89685
89737
  /*questionToken*/
89686
89738
  void 0,
89687
89739
  visitor,
89688
- isToken
89740
+ isQuestionToken
89689
89741
  ),
89690
89742
  /*typeParameters*/
89691
89743
  void 0,
@@ -90808,7 +90860,7 @@ function transformJsx(context) {
90808
90860
  return element;
90809
90861
  }
90810
90862
  function transformJsxSpreadAttributeToSpreadAssignment(node) {
90811
- return factory2.createSpreadAssignment(visitNode(node.expression, visitor, isExpression));
90863
+ return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
90812
90864
  }
90813
90865
  function transformJsxAttributesToObjectProps(attrs, children) {
90814
90866
  const target = getEmitScriptTarget(compilerOptions);
@@ -90838,7 +90890,7 @@ function transformJsx(context) {
90838
90890
  return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
90839
90891
  }
90840
90892
  function transformJsxSpreadAttributeToExpression(node) {
90841
- return visitNode(node.expression, visitor, isExpression);
90893
+ return Debug.checkDefined(visitNode(node.expression, visitor, isExpression));
90842
90894
  }
90843
90895
  function transformJsxAttributeToObjectLiteralElement(node) {
90844
90896
  const name = getAttributeName(node);
@@ -90858,7 +90910,7 @@ function transformJsx(context) {
90858
90910
  if (node.expression === void 0) {
90859
90911
  return factory2.createTrue();
90860
90912
  }
90861
- return visitNode(node.expression, visitor, isExpression);
90913
+ return Debug.checkDefined(visitNode(node.expression, visitor, isExpression));
90862
90914
  }
90863
90915
  if (isJsxElement(node)) {
90864
90916
  return visitJsxElement(
@@ -91603,7 +91655,7 @@ function transformES2015(context) {
91603
91655
  [
91604
91656
  factory2.createPropertyAssignment(
91605
91657
  factory2.createIdentifier("value"),
91606
- node.expression ? visitNode(node.expression, visitor, isExpression) : factory2.createVoidZero()
91658
+ node.expression ? Debug.checkDefined(visitNode(node.expression, visitor, isExpression)) : factory2.createVoidZero()
91607
91659
  )
91608
91660
  ]
91609
91661
  )
@@ -91774,7 +91826,7 @@ function transformES2015(context) {
91774
91826
  outer,
91775
91827
  /*typeArguments*/
91776
91828
  void 0,
91777
- extendsClauseElement ? [visitNode(extendsClauseElement.expression, visitor, isExpression)] : []
91829
+ extendsClauseElement ? [Debug.checkDefined(visitNode(extendsClauseElement.expression, visitor, isExpression))] : []
91778
91830
  )
91779
91831
  );
91780
91832
  addSyntheticLeadingComment(result, 3 /* MultiLineCommentTrivia */, "* @class ");
@@ -92116,7 +92168,7 @@ function transformES2015(context) {
92116
92168
  factory2.createExpressionStatement(
92117
92169
  factory2.createAssignment(
92118
92170
  factory2.getGeneratedNameForNode(parameter),
92119
- visitNode(initializer, visitor, isExpression)
92171
+ Debug.checkDefined(visitNode(initializer, visitor, isExpression))
92120
92172
  )
92121
92173
  ),
92122
92174
  2097152 /* CustomPrologue */
@@ -92127,7 +92179,7 @@ function transformES2015(context) {
92127
92179
  return false;
92128
92180
  }
92129
92181
  function insertDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
92130
- initializer = visitNode(initializer, visitor, isExpression);
92182
+ initializer = Debug.checkDefined(visitNode(initializer, visitor, isExpression));
92131
92183
  const statement = factory2.createIfStatement(
92132
92184
  factory2.createTypeCheck(factory2.cloneNode(name), "undefined"),
92133
92185
  setEmitFlags(
@@ -92403,6 +92455,7 @@ function transformES2015(context) {
92403
92455
  container
92404
92456
  );
92405
92457
  const propertyName = visitNode(member.name, visitor, isPropertyName);
92458
+ Debug.assert(propertyName);
92406
92459
  let e;
92407
92460
  if (!isPrivateIdentifier(propertyName) && getUseDefineForClassFields(context.getCompilerOptions())) {
92408
92461
  const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier(propertyName) ? factory2.createStringLiteral(unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName;
@@ -92446,6 +92499,7 @@ function transformES2015(context) {
92446
92499
  setEmitFlags(target, 3072 /* NoComments */ | 64 /* NoTrailingSourceMap */);
92447
92500
  setSourceMapRange(target, firstAccessor.name);
92448
92501
  const visitedAccessorName = visitNode(firstAccessor.name, visitor, isPropertyName);
92502
+ Debug.assert(visitedAccessorName);
92449
92503
  if (isPrivateIdentifier(visitedAccessorName)) {
92450
92504
  return Debug.failBadSyntaxKind(visitedAccessorName, "Encountered unhandled private identifier while transforming ES2015.");
92451
92505
  }
@@ -92718,9 +92772,9 @@ function transformES2015(context) {
92718
92772
  if (node.operatorToken.kind === 27 /* CommaToken */) {
92719
92773
  return factory2.updateBinaryExpression(
92720
92774
  node,
92721
- visitNode(node.left, visitorWithUnusedExpressionResult, isExpression),
92775
+ Debug.checkDefined(visitNode(node.left, visitorWithUnusedExpressionResult, isExpression)),
92722
92776
  node.operatorToken,
92723
- visitNode(node.right, expressionResultIsUnused2 ? visitorWithUnusedExpressionResult : visitor, isExpression)
92777
+ Debug.checkDefined(visitNode(node.right, expressionResultIsUnused2 ? visitorWithUnusedExpressionResult : visitor, isExpression))
92724
92778
  );
92725
92779
  }
92726
92780
  return visitEachChild(node, visitor, context);
@@ -92735,6 +92789,7 @@ function transformES2015(context) {
92735
92789
  const visited = visitNode(element, i < node.elements.length - 1 ? visitorWithUnusedExpressionResult : visitor, isExpression);
92736
92790
  if (result || visited !== element) {
92737
92791
  result || (result = node.elements.slice(0, i));
92792
+ Debug.assert(visited);
92738
92793
  result.push(visited);
92739
92794
  }
92740
92795
  }
@@ -92761,7 +92816,7 @@ function transformES2015(context) {
92761
92816
  0 /* All */
92762
92817
  );
92763
92818
  } else {
92764
- assignment = factory2.createBinaryExpression(decl.name, 63 /* EqualsToken */, visitNode(decl.initializer, visitor, isExpression));
92819
+ assignment = factory2.createBinaryExpression(decl.name, 63 /* EqualsToken */, Debug.checkDefined(visitNode(decl.initializer, visitor, isExpression)));
92765
92820
  setTextRange(assignment, decl);
92766
92821
  }
92767
92822
  assignments = append(assignments, assignment);
@@ -92783,7 +92838,7 @@ function transformES2015(context) {
92783
92838
  if (node.flags & 3 /* BlockScoped */) {
92784
92839
  enableSubstitutionsForBlockScopedBindings();
92785
92840
  }
92786
- const declarations = flatMap(node.declarations, node.flags & 1 /* Let */ ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration);
92841
+ const declarations = visitNodes2(node.declarations, node.flags & 1 /* Let */ ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration, isVariableDeclaration);
92787
92842
  const declarationList = factory2.createVariableDeclarationList(declarations);
92788
92843
  setOriginalNode(declarationList, node);
92789
92844
  setTextRange(declarationList, node);
@@ -92867,7 +92922,7 @@ function transformES2015(context) {
92867
92922
  statement,
92868
92923
  /*outermostLabeledStatement*/
92869
92924
  node
92870
- ) : factory2.restoreEnclosingLabel(visitNode(statement, visitor, isStatement, factory2.liftToBlock), node, convertedLoopState && resetLabel);
92925
+ ) : factory2.restoreEnclosingLabel(Debug.checkDefined(visitNode(statement, visitor, isStatement, factory2.liftToBlock)), node, convertedLoopState && resetLabel);
92871
92926
  }
92872
92927
  function visitIterationStatement(node, outermostLabeledStatement) {
92873
92928
  switch (node.kind) {
@@ -92910,7 +92965,7 @@ function transformES2015(context) {
92910
92965
  visitNode(node.initializer, visitorWithUnusedExpressionResult, isForInitializer),
92911
92966
  visitNode(node.condition, visitor, isExpression),
92912
92967
  visitNode(node.incrementor, visitorWithUnusedExpressionResult, isExpression),
92913
- visitNode(node.statement, visitor, isStatement, factory2.liftToBlock)
92968
+ Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock))
92914
92969
  );
92915
92970
  }
92916
92971
  function visitForInStatement(node, outermostLabeledStatement) {
@@ -92996,13 +93051,14 @@ function transformES2015(context) {
92996
93051
  )));
92997
93052
  } else {
92998
93053
  setTextRangeEnd(assignment, initializer.end);
92999
- statements.push(setTextRange(factory2.createExpressionStatement(visitNode(assignment, visitor, isExpression)), moveRangeEnd(initializer, -1)));
93054
+ statements.push(setTextRange(factory2.createExpressionStatement(Debug.checkDefined(visitNode(assignment, visitor, isExpression))), moveRangeEnd(initializer, -1)));
93000
93055
  }
93001
93056
  }
93002
93057
  if (convertedLoopBodyStatements) {
93003
93058
  return createSyntheticBlockForConvertedStatements(addRange(statements, convertedLoopBodyStatements));
93004
93059
  } else {
93005
93060
  const statement = visitNode(node.statement, visitor, isStatement, factory2.liftToBlock);
93061
+ Debug.assert(statement);
93006
93062
  if (isBlock(statement)) {
93007
93063
  return factory2.updateBlock(statement, setTextRange(factory2.createNodeArray(concatenate(statements, statement.statements)), statement.statements));
93008
93064
  } else {
@@ -93023,6 +93079,7 @@ function transformES2015(context) {
93023
93079
  }
93024
93080
  function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) {
93025
93081
  const expression = visitNode(node.expression, visitor, isExpression);
93082
+ Debug.assert(expression);
93026
93083
  const counter = factory2.createLoopVariable();
93027
93084
  const rhsReference = isIdentifier(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable(
93028
93085
  /*recordTempVariable*/
@@ -93082,6 +93139,7 @@ function transformES2015(context) {
93082
93139
  }
93083
93140
  function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
93084
93141
  const expression = visitNode(node.expression, visitor, isExpression);
93142
+ Debug.assert(expression);
93085
93143
  const iterator = isIdentifier(expression) ? factory2.getGeneratedNameForNode(expression) : factory2.createTempVariable(
93086
93144
  /*recordTempVariable*/
93087
93145
  void 0
@@ -93339,7 +93397,7 @@ function transformES2015(context) {
93339
93397
  loop = factory2.restoreEnclosingLabel(clone2, outermostLabeledStatement, convertedLoopState && resetLabel);
93340
93398
  }
93341
93399
  } else {
93342
- const clone2 = convertIterationStatementCore(node, initializerFunction, visitNode(node.statement, visitor, isStatement, factory2.liftToBlock));
93400
+ const clone2 = convertIterationStatementCore(node, initializerFunction, Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock)));
93343
93401
  loop = factory2.restoreEnclosingLabel(clone2, outermostLabeledStatement, convertedLoopState && resetLabel);
93344
93402
  }
93345
93403
  statements.push(loop);
@@ -93377,16 +93435,16 @@ function transformES2015(context) {
93377
93435
  node,
93378
93436
  /*awaitModifier*/
93379
93437
  void 0,
93380
- visitNode(node.initializer, visitor, isForInitializer),
93381
- visitNode(node.expression, visitor, isExpression),
93438
+ Debug.checkDefined(visitNode(node.initializer, visitor, isForInitializer)),
93439
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
93382
93440
  convertedLoopBody
93383
93441
  );
93384
93442
  }
93385
93443
  function convertForInStatement(node, convertedLoopBody) {
93386
93444
  return factory2.updateForInStatement(
93387
93445
  node,
93388
- visitNode(node.initializer, visitor, isForInitializer),
93389
- visitNode(node.expression, visitor, isExpression),
93446
+ Debug.checkDefined(visitNode(node.initializer, visitor, isForInitializer)),
93447
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
93390
93448
  convertedLoopBody
93391
93449
  );
93392
93450
  }
@@ -93394,13 +93452,13 @@ function transformES2015(context) {
93394
93452
  return factory2.updateDoStatement(
93395
93453
  node,
93396
93454
  convertedLoopBody,
93397
- visitNode(node.expression, visitor, isExpression)
93455
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression))
93398
93456
  );
93399
93457
  }
93400
93458
  function convertWhileStatement(node, convertedLoopBody) {
93401
93459
  return factory2.updateWhileStatement(
93402
93460
  node,
93403
- visitNode(node.expression, visitor, isExpression),
93461
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
93404
93462
  convertedLoopBody
93405
93463
  );
93406
93464
  }
@@ -93562,7 +93620,7 @@ function transformES2015(context) {
93562
93620
  void 0,
93563
93621
  /*type*/
93564
93622
  void 0,
93565
- visitNode(
93623
+ Debug.checkDefined(visitNode(
93566
93624
  factory2.createBlock(
93567
93625
  statements,
93568
93626
  /*multiLine*/
@@ -93570,7 +93628,7 @@ function transformES2015(context) {
93570
93628
  ),
93571
93629
  visitor,
93572
93630
  isBlock
93573
- )
93631
+ ))
93574
93632
  ),
93575
93633
  emitFlags
93576
93634
  )
@@ -93593,7 +93651,7 @@ function transformES2015(context) {
93593
93651
  if (node.incrementor) {
93594
93652
  statements.push(factory2.createIfStatement(
93595
93653
  currentState.conditionVariable,
93596
- factory2.createExpressionStatement(visitNode(node.incrementor, visitor, isExpression)),
93654
+ factory2.createExpressionStatement(Debug.checkDefined(visitNode(node.incrementor, visitor, isExpression))),
93597
93655
  factory2.createExpressionStatement(factory2.createAssignment(currentState.conditionVariable, factory2.createTrue()))
93598
93656
  ));
93599
93657
  } else {
@@ -93604,11 +93662,12 @@ function transformES2015(context) {
93604
93662
  }
93605
93663
  if (shouldConvertConditionOfForStatement(node)) {
93606
93664
  statements.push(factory2.createIfStatement(
93607
- factory2.createPrefixUnaryExpression(53 /* ExclamationToken */, visitNode(node.condition, visitor, isExpression)),
93608
- visitNode(factory2.createBreakStatement(), visitor, isStatement)
93665
+ factory2.createPrefixUnaryExpression(53 /* ExclamationToken */, Debug.checkDefined(visitNode(node.condition, visitor, isExpression))),
93666
+ Debug.checkDefined(visitNode(factory2.createBreakStatement(), visitor, isStatement))
93609
93667
  ));
93610
93668
  }
93611
93669
  }
93670
+ Debug.assert(statement);
93612
93671
  if (isBlock(statement)) {
93613
93672
  addRange(statements, statement.statements);
93614
93673
  } else {
@@ -93876,9 +93935,9 @@ function transformES2015(context) {
93876
93935
  createMemberAccessForPropertyName(
93877
93936
  factory2,
93878
93937
  receiver,
93879
- visitNode(property.name, visitor, isPropertyName)
93938
+ Debug.checkDefined(visitNode(property.name, visitor, isPropertyName))
93880
93939
  ),
93881
- visitNode(property.initializer, visitor, isExpression)
93940
+ Debug.checkDefined(visitNode(property.initializer, visitor, isExpression))
93882
93941
  );
93883
93942
  setTextRange(expression, property);
93884
93943
  if (startsOnNewLine) {
@@ -93891,7 +93950,7 @@ function transformES2015(context) {
93891
93950
  createMemberAccessForPropertyName(
93892
93951
  factory2,
93893
93952
  receiver,
93894
- visitNode(property.name, visitor, isPropertyName)
93953
+ Debug.checkDefined(visitNode(property.name, visitor, isPropertyName))
93895
93954
  ),
93896
93955
  factory2.cloneNode(property.name)
93897
93956
  );
@@ -93906,7 +93965,7 @@ function transformES2015(context) {
93906
93965
  createMemberAccessForPropertyName(
93907
93966
  factory2,
93908
93967
  receiver,
93909
- visitNode(method.name, visitor, isPropertyName)
93968
+ Debug.checkDefined(visitNode(method.name, visitor, isPropertyName))
93910
93969
  ),
93911
93970
  transformFunctionLikeToExpression(
93912
93971
  method,
@@ -94040,7 +94099,7 @@ function transformES2015(context) {
94040
94099
  }
94041
94100
  return factory2.updateCallExpression(
94042
94101
  node,
94043
- visitNode(node.expression, callExpressionVisitor, isExpression),
94102
+ Debug.checkDefined(visitNode(node.expression, callExpressionVisitor, isExpression)),
94044
94103
  /*typeArguments*/
94045
94104
  void 0,
94046
94105
  visitNodes2(node.arguments, visitor, isExpression)
@@ -94152,8 +94211,8 @@ function transformES2015(context) {
94152
94211
  let resultingCall;
94153
94212
  if (node.transformFlags & 32768 /* ContainsRestOrSpread */) {
94154
94213
  resultingCall = factory2.createFunctionApplyCall(
94155
- visitNode(target, callExpressionVisitor, isExpression),
94156
- node.expression.kind === 106 /* SuperKeyword */ ? thisArg : visitNode(thisArg, visitor, isExpression),
94214
+ Debug.checkDefined(visitNode(target, callExpressionVisitor, isExpression)),
94215
+ node.expression.kind === 106 /* SuperKeyword */ ? thisArg : Debug.checkDefined(visitNode(thisArg, visitor, isExpression)),
94157
94216
  transformAndSpreadElements(
94158
94217
  node.arguments,
94159
94218
  /*isArgumentList*/
@@ -94167,8 +94226,8 @@ function transformES2015(context) {
94167
94226
  } else {
94168
94227
  resultingCall = setTextRange(
94169
94228
  factory2.createFunctionCallCall(
94170
- visitNode(target, callExpressionVisitor, isExpression),
94171
- node.expression.kind === 106 /* SuperKeyword */ ? thisArg : visitNode(thisArg, visitor, isExpression),
94229
+ Debug.checkDefined(visitNode(target, callExpressionVisitor, isExpression)),
94230
+ node.expression.kind === 106 /* SuperKeyword */ ? thisArg : Debug.checkDefined(visitNode(thisArg, visitor, isExpression)),
94172
94231
  visitNodes2(node.arguments, visitor, isExpression)
94173
94232
  ),
94174
94233
  node
@@ -94190,7 +94249,7 @@ function transformES2015(context) {
94190
94249
  const { target, thisArg } = factory2.createCallBinding(factory2.createPropertyAccessExpression(node.expression, "bind"), hoistVariableDeclaration);
94191
94250
  return factory2.createNewExpression(
94192
94251
  factory2.createFunctionApplyCall(
94193
- visitNode(target, visitor, isExpression),
94252
+ Debug.checkDefined(visitNode(target, visitor, isExpression)),
94194
94253
  thisArg,
94195
94254
  transformAndSpreadElements(
94196
94255
  factory2.createNodeArray([factory2.createVoidZero(), ...node.arguments]),
@@ -94247,7 +94306,9 @@ function transformES2015(context) {
94247
94306
  return map(chunk, visitExpressionOfSpread);
94248
94307
  }
94249
94308
  function visitExpressionOfSpread(node) {
94309
+ Debug.assertNode(node, isSpreadElement);
94250
94310
  let expression = visitNode(node.expression, visitor, isExpression);
94311
+ Debug.assert(expression);
94251
94312
  const isCallToReadHelper = isCallToHelper(expression, "___read");
94252
94313
  let kind = isCallToReadHelper || isPackedArrayLiteral(expression) ? 2 /* PackedSpread */ : 1 /* UnpackedSpread */;
94253
94314
  if (compilerOptions.downlevelIteration && kind === 1 /* UnpackedSpread */ && !isArrayLiteralExpression(expression) && !isCallToReadHelper) {
@@ -94298,7 +94359,7 @@ function transformES2015(context) {
94298
94359
  function visitTemplateExpression(node) {
94299
94360
  let expression = factory2.createStringLiteral(node.head.text);
94300
94361
  for (const span of node.templateSpans) {
94301
- const args = [visitNode(span.expression, visitor, isExpression)];
94362
+ const args = [Debug.checkDefined(visitNode(span.expression, visitor, isExpression))];
94302
94363
  if (span.literal.text.length > 0) {
94303
94364
  args.push(factory2.createStringLiteral(span.literal.text));
94304
94365
  }
@@ -94864,19 +94925,19 @@ function transformGenerators(context) {
94864
94925
  case 208 /* PropertyAccessExpression */:
94865
94926
  target = factory2.updatePropertyAccessExpression(
94866
94927
  left,
94867
- cacheExpression(visitNode(left.expression, visitor, isLeftHandSideExpression)),
94928
+ cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))),
94868
94929
  left.name
94869
94930
  );
94870
94931
  break;
94871
94932
  case 209 /* ElementAccessExpression */:
94872
94933
  target = factory2.updateElementAccessExpression(
94873
94934
  left,
94874
- cacheExpression(visitNode(left.expression, visitor, isLeftHandSideExpression)),
94875
- cacheExpression(visitNode(left.argumentExpression, visitor, isExpression))
94935
+ cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))),
94936
+ cacheExpression(Debug.checkDefined(visitNode(left.argumentExpression, visitor, isExpression)))
94876
94937
  );
94877
94938
  break;
94878
94939
  default:
94879
- target = visitNode(left, visitor, isExpression);
94940
+ target = Debug.checkDefined(visitNode(left, visitor, isExpression));
94880
94941
  break;
94881
94942
  }
94882
94943
  const operator = node.operatorToken.kind;
@@ -94888,7 +94949,7 @@ function transformGenerators(context) {
94888
94949
  factory2.createBinaryExpression(
94889
94950
  cacheExpression(target),
94890
94951
  getNonAssignmentOperatorForCompoundAssignment(operator),
94891
- visitNode(right, visitor, isExpression)
94952
+ Debug.checkDefined(visitNode(right, visitor, isExpression))
94892
94953
  ),
94893
94954
  node
94894
94955
  )
@@ -94896,7 +94957,7 @@ function transformGenerators(context) {
94896
94957
  node
94897
94958
  );
94898
94959
  } else {
94899
- return factory2.updateBinaryExpression(node, target, node.operatorToken, visitNode(right, visitor, isExpression));
94960
+ return factory2.updateBinaryExpression(node, target, node.operatorToken, Debug.checkDefined(visitNode(right, visitor, isExpression)));
94900
94961
  }
94901
94962
  }
94902
94963
  return visitEachChild(node, visitor, context);
@@ -94910,9 +94971,9 @@ function transformGenerators(context) {
94910
94971
  }
94911
94972
  return factory2.updateBinaryExpression(
94912
94973
  node,
94913
- cacheExpression(visitNode(node.left, visitor, isExpression)),
94974
+ cacheExpression(Debug.checkDefined(visitNode(node.left, visitor, isExpression))),
94914
94975
  node.operatorToken,
94915
- visitNode(node.right, visitor, isExpression)
94976
+ Debug.checkDefined(visitNode(node.right, visitor, isExpression))
94916
94977
  );
94917
94978
  }
94918
94979
  return visitEachChild(node, visitor, context);
@@ -94931,7 +94992,7 @@ function transformGenerators(context) {
94931
94992
  emitWorker(1 /* Statement */, [factory2.createExpressionStatement(factory2.inlineExpressions(pendingExpressions))]);
94932
94993
  pendingExpressions = [];
94933
94994
  }
94934
- pendingExpressions.push(visitNode(node2, visitor, isExpression));
94995
+ pendingExpressions.push(Debug.checkDefined(visitNode(node2, visitor, isExpression)));
94935
94996
  }
94936
94997
  }
94937
94998
  }
@@ -94945,7 +95006,7 @@ function transformGenerators(context) {
94945
95006
  emitWorker(1 /* Statement */, [factory2.createExpressionStatement(factory2.inlineExpressions(pendingExpressions))]);
94946
95007
  pendingExpressions = [];
94947
95008
  }
94948
- pendingExpressions.push(visitNode(elem, visitor, isExpression));
95009
+ pendingExpressions.push(Debug.checkDefined(visitNode(elem, visitor, isExpression)));
94949
95010
  }
94950
95011
  }
94951
95012
  return factory2.inlineExpressions(pendingExpressions);
@@ -94955,7 +95016,7 @@ function transformGenerators(context) {
94955
95016
  const resultLocal = declareLocal();
94956
95017
  emitAssignment(
94957
95018
  resultLocal,
94958
- visitNode(node.left, visitor, isExpression),
95019
+ Debug.checkDefined(visitNode(node.left, visitor, isExpression)),
94959
95020
  /*location*/
94960
95021
  node.left
94961
95022
  );
@@ -94976,7 +95037,7 @@ function transformGenerators(context) {
94976
95037
  }
94977
95038
  emitAssignment(
94978
95039
  resultLocal,
94979
- visitNode(node.right, visitor, isExpression),
95040
+ Debug.checkDefined(visitNode(node.right, visitor, isExpression)),
94980
95041
  /*location*/
94981
95042
  node.right
94982
95043
  );
@@ -94990,13 +95051,13 @@ function transformGenerators(context) {
94990
95051
  const resultLocal = declareLocal();
94991
95052
  emitBreakWhenFalse(
94992
95053
  whenFalseLabel,
94993
- visitNode(node.condition, visitor, isExpression),
95054
+ Debug.checkDefined(visitNode(node.condition, visitor, isExpression)),
94994
95055
  /*location*/
94995
95056
  node.condition
94996
95057
  );
94997
95058
  emitAssignment(
94998
95059
  resultLocal,
94999
- visitNode(node.whenTrue, visitor, isExpression),
95060
+ Debug.checkDefined(visitNode(node.whenTrue, visitor, isExpression)),
95000
95061
  /*location*/
95001
95062
  node.whenTrue
95002
95063
  );
@@ -95004,7 +95065,7 @@ function transformGenerators(context) {
95004
95065
  markLabel(whenFalseLabel);
95005
95066
  emitAssignment(
95006
95067
  resultLocal,
95007
- visitNode(node.whenFalse, visitor, isExpression),
95068
+ Debug.checkDefined(visitNode(node.whenFalse, visitor, isExpression)),
95008
95069
  /*location*/
95009
95070
  node.whenFalse
95010
95071
  );
@@ -95084,7 +95145,7 @@ function transformGenerators(context) {
95084
95145
  leadingElement = void 0;
95085
95146
  expressions2 = [];
95086
95147
  }
95087
- expressions2.push(visitNode(element, visitor, isExpression));
95148
+ expressions2.push(Debug.checkDefined(visitNode(element, visitor, isExpression)));
95088
95149
  return expressions2;
95089
95150
  }
95090
95151
  }
@@ -95123,8 +95184,8 @@ function transformGenerators(context) {
95123
95184
  if (containsYield(node.argumentExpression)) {
95124
95185
  return factory2.updateElementAccessExpression(
95125
95186
  node,
95126
- cacheExpression(visitNode(node.expression, visitor, isLeftHandSideExpression)),
95127
- visitNode(node.argumentExpression, visitor, isExpression)
95187
+ cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression))),
95188
+ Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression))
95128
95189
  );
95129
95190
  }
95130
95191
  return visitEachChild(node, visitor, context);
@@ -95141,7 +95202,7 @@ function transformGenerators(context) {
95141
95202
  return setOriginalNode(
95142
95203
  setTextRange(
95143
95204
  factory2.createFunctionApplyCall(
95144
- cacheExpression(visitNode(target, visitor, isLeftHandSideExpression)),
95205
+ cacheExpression(Debug.checkDefined(visitNode(target, visitor, isLeftHandSideExpression))),
95145
95206
  thisArg,
95146
95207
  visitElements(node.arguments)
95147
95208
  ),
@@ -95159,7 +95220,7 @@ function transformGenerators(context) {
95159
95220
  setTextRange(
95160
95221
  factory2.createNewExpression(
95161
95222
  factory2.createFunctionApplyCall(
95162
- cacheExpression(visitNode(target, visitor, isExpression)),
95223
+ cacheExpression(Debug.checkDefined(visitNode(target, visitor, isExpression))),
95163
95224
  thisArg,
95164
95225
  visitElements(
95165
95226
  node.arguments,
@@ -95275,7 +95336,7 @@ function transformGenerators(context) {
95275
95336
  return setSourceMapRange(
95276
95337
  factory2.createAssignment(
95277
95338
  setSourceMapRange(factory2.cloneNode(node.name), node.name),
95278
- visitNode(node.initializer, visitor, isExpression)
95339
+ Debug.checkDefined(visitNode(node.initializer, visitor, isExpression))
95279
95340
  ),
95280
95341
  node
95281
95342
  );
@@ -95287,7 +95348,7 @@ function transformGenerators(context) {
95287
95348
  const elseLabel = node.elseStatement ? defineLabel() : void 0;
95288
95349
  emitBreakWhenFalse(
95289
95350
  node.elseStatement ? elseLabel : endLabel,
95290
- visitNode(node.expression, visitor, isExpression),
95351
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
95291
95352
  /*location*/
95292
95353
  node.expression
95293
95354
  );
@@ -95316,7 +95377,7 @@ function transformGenerators(context) {
95316
95377
  markLabel(loopLabel);
95317
95378
  transformAndEmitEmbeddedStatement(node.statement);
95318
95379
  markLabel(conditionLabel);
95319
- emitBreakWhenTrue(loopLabel, visitNode(node.expression, visitor, isExpression));
95380
+ emitBreakWhenTrue(loopLabel, Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
95320
95381
  endLoopBlock();
95321
95382
  } else {
95322
95383
  emitStatement(visitNode(node, visitor, isStatement));
@@ -95337,7 +95398,7 @@ function transformGenerators(context) {
95337
95398
  const loopLabel = defineLabel();
95338
95399
  const endLabel = beginLoopBlock(loopLabel);
95339
95400
  markLabel(loopLabel);
95340
- emitBreakWhenFalse(endLabel, visitNode(node.expression, visitor, isExpression));
95401
+ emitBreakWhenFalse(endLabel, Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
95341
95402
  transformAndEmitEmbeddedStatement(node.statement);
95342
95403
  emitBreak(loopLabel);
95343
95404
  endLoopBlock();
@@ -95368,7 +95429,7 @@ function transformGenerators(context) {
95368
95429
  emitStatement(
95369
95430
  setTextRange(
95370
95431
  factory2.createExpressionStatement(
95371
- visitNode(initializer, visitor, isExpression)
95432
+ Debug.checkDefined(visitNode(initializer, visitor, isExpression))
95372
95433
  ),
95373
95434
  initializer
95374
95435
  )
@@ -95377,7 +95438,7 @@ function transformGenerators(context) {
95377
95438
  }
95378
95439
  markLabel(conditionLabel);
95379
95440
  if (node.condition) {
95380
- emitBreakWhenFalse(endLabel, visitNode(node.condition, visitor, isExpression));
95441
+ emitBreakWhenFalse(endLabel, Debug.checkDefined(visitNode(node.condition, visitor, isExpression)));
95381
95442
  }
95382
95443
  transformAndEmitEmbeddedStatement(node.statement);
95383
95444
  markLabel(incrementLabel);
@@ -95385,7 +95446,7 @@ function transformGenerators(context) {
95385
95446
  emitStatement(
95386
95447
  setTextRange(
95387
95448
  factory2.createExpressionStatement(
95388
- visitNode(node.incrementor, visitor, isExpression)
95449
+ Debug.checkDefined(visitNode(node.incrementor, visitor, isExpression))
95389
95450
  ),
95390
95451
  node.incrementor
95391
95452
  )
@@ -95430,7 +95491,7 @@ function transformGenerators(context) {
95430
95491
  const keysIndex = factory2.createLoopVariable();
95431
95492
  const initializer = node.initializer;
95432
95493
  hoistVariableDeclaration(keysIndex);
95433
- emitAssignment(obj, visitNode(node.expression, visitor, isExpression));
95494
+ emitAssignment(obj, Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
95434
95495
  emitAssignment(keysArray, factory2.createArrayLiteralExpression());
95435
95496
  emitStatement(
95436
95497
  factory2.createForInStatement(
@@ -95461,7 +95522,7 @@ function transformGenerators(context) {
95461
95522
  }
95462
95523
  variable = factory2.cloneNode(initializer.declarations[0].name);
95463
95524
  } else {
95464
- variable = visitNode(initializer, visitor, isExpression);
95525
+ variable = Debug.checkDefined(visitNode(initializer, visitor, isExpression));
95465
95526
  Debug.assert(isLeftHandSideExpression(variable));
95466
95527
  }
95467
95528
  emitAssignment(variable, key);
@@ -95486,8 +95547,8 @@ function transformGenerators(context) {
95486
95547
  node = factory2.updateForInStatement(
95487
95548
  node,
95488
95549
  initializer.declarations[0].name,
95489
- visitNode(node.expression, visitor, isExpression),
95490
- visitNode(node.statement, visitor, isStatement, factory2.liftToBlock)
95550
+ Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
95551
+ Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock))
95491
95552
  );
95492
95553
  } else {
95493
95554
  node = visitEachChild(node, visitor, context);
@@ -95563,7 +95624,7 @@ function transformGenerators(context) {
95563
95624
  }
95564
95625
  function transformAndEmitWithStatement(node) {
95565
95626
  if (containsYield(node)) {
95566
- beginWithBlock(cacheExpression(visitNode(node.expression, visitor, isExpression)));
95627
+ beginWithBlock(cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isExpression))));
95567
95628
  transformAndEmitEmbeddedStatement(node.statement);
95568
95629
  endWithBlock();
95569
95630
  } else {
@@ -95575,7 +95636,7 @@ function transformGenerators(context) {
95575
95636
  const caseBlock = node.caseBlock;
95576
95637
  const numClauses = caseBlock.clauses.length;
95577
95638
  const endLabel = beginSwitchBlock();
95578
- const expression = cacheExpression(visitNode(node.expression, visitor, isExpression));
95639
+ const expression = cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isExpression)));
95579
95640
  const clauseLabels = [];
95580
95641
  let defaultClauseIndex = -1;
95581
95642
  for (let i = 0; i < numClauses; i++) {
@@ -95597,7 +95658,7 @@ function transformGenerators(context) {
95597
95658
  }
95598
95659
  pendingClauses.push(
95599
95660
  factory2.createCaseClause(
95600
- visitNode(clause.expression, visitor, isExpression),
95661
+ Debug.checkDefined(visitNode(clause.expression, visitor, isExpression)),
95601
95662
  [
95602
95663
  createInlineBreak(
95603
95664
  clauseLabels[i],
@@ -95667,7 +95728,7 @@ function transformGenerators(context) {
95667
95728
  function transformAndEmitThrowStatement(node) {
95668
95729
  var _a2;
95669
95730
  emitThrow(
95670
- visitNode((_a2 = node.expression) != null ? _a2 : factory2.createVoidZero(), visitor, isExpression),
95731
+ Debug.checkDefined(visitNode((_a2 = node.expression) != null ? _a2 : factory2.createVoidZero(), visitor, isExpression)),
95671
95732
  /*location*/
95672
95733
  node
95673
95734
  );
@@ -96951,7 +97012,7 @@ function transformModule(context) {
96951
97012
  }
96952
97013
  function addExportEqualsIfNeeded(statements, emitAsReturn) {
96953
97014
  if (currentModuleInfo.exportEquals) {
96954
- const expressionResult = visitNode(currentModuleInfo.exportEquals.expression, visitor);
97015
+ const expressionResult = visitNode(currentModuleInfo.exportEquals.expression, visitor, isExpression);
96955
97016
  if (expressionResult) {
96956
97017
  if (emitAsReturn) {
96957
97018
  const statement = factory2.createReturnStatement(expressionResult);
@@ -97146,7 +97207,7 @@ function transformModule(context) {
97146
97207
  }
97147
97208
  function visitImportCallExpression(node) {
97148
97209
  const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
97149
- const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor);
97210
+ const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
97150
97211
  const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
97151
97212
  const containsLexicalThis = !!(node.transformFlags & 16384 /* ContainsLexicalThis */);
97152
97213
  switch (compilerOptions.module) {
@@ -97675,7 +97736,7 @@ function transformModule(context) {
97675
97736
  deferredExports[id] = appendExportStatement(
97676
97737
  deferredExports[id],
97677
97738
  factory2.createIdentifier("default"),
97678
- visitNode(node.expression, visitor),
97739
+ visitNode(node.expression, visitor, isExpression),
97679
97740
  /*location*/
97680
97741
  node,
97681
97742
  /*allowComments*/
@@ -97685,7 +97746,7 @@ function transformModule(context) {
97685
97746
  statements = appendExportStatement(
97686
97747
  statements,
97687
97748
  factory2.createIdentifier("default"),
97688
- visitNode(node.expression, visitor),
97749
+ visitNode(node.expression, visitor, isExpression),
97689
97750
  /*location*/
97690
97751
  node,
97691
97752
  /*allowComments*/
@@ -97713,7 +97774,7 @@ function transformModule(context) {
97713
97774
  ),
97714
97775
  /*typeParameters*/
97715
97776
  void 0,
97716
- visitNodes2(node.parameters, visitor),
97777
+ visitNodes2(node.parameters, visitor, isParameter),
97717
97778
  /*type*/
97718
97779
  void 0,
97719
97780
  visitEachChild(node.body, visitor, context)
@@ -97754,8 +97815,8 @@ function transformModule(context) {
97754
97815
  ),
97755
97816
  /*typeParameters*/
97756
97817
  void 0,
97757
- visitNodes2(node.heritageClauses, visitor),
97758
- visitNodes2(node.members, visitor)
97818
+ visitNodes2(node.heritageClauses, visitor, isHeritageClause),
97819
+ visitNodes2(node.members, visitor, isClassElement)
97759
97820
  ),
97760
97821
  node
97761
97822
  ),
@@ -97803,7 +97864,7 @@ function transformModule(context) {
97803
97864
  variable.name,
97804
97865
  variable.exclamationToken,
97805
97866
  variable.type,
97806
- visitNode(variable.initializer, visitor)
97867
+ visitNode(variable.initializer, visitor, isExpression)
97807
97868
  );
97808
97869
  variables = append(variables, updatedVariable);
97809
97870
  expressions = append(expressions, expression);
@@ -97854,9 +97915,8 @@ function transformModule(context) {
97854
97915
  function transformInitializedVariable(node) {
97855
97916
  if (isBindingPattern(node.name)) {
97856
97917
  return flattenDestructuringAssignment(
97857
- visitNode(node, visitor),
97858
- /*visitor*/
97859
- void 0,
97918
+ visitNode(node, visitor, isInitializedVariable),
97919
+ visitor,
97860
97920
  context,
97861
97921
  0 /* All */,
97862
97922
  /*needsValue*/
@@ -97873,7 +97933,7 @@ function transformModule(context) {
97873
97933
  /*location*/
97874
97934
  node.name
97875
97935
  ),
97876
- node.initializer ? visitNode(node.initializer, visitor) : factory2.createVoidZero()
97936
+ node.initializer ? visitNode(node.initializer, visitor, isExpression) : factory2.createVoidZero()
97877
97937
  );
97878
97938
  }
97879
97939
  }
@@ -98816,7 +98876,7 @@ function transformSystemModule(context) {
98816
98876
  ),
98817
98877
  /*typeParameters*/
98818
98878
  void 0,
98819
- visitNodes2(node.parameters, visitor, isParameterDeclaration),
98879
+ visitNodes2(node.parameters, visitor, isParameter),
98820
98880
  /*type*/
98821
98881
  void 0,
98822
98882
  visitNode(node.body, visitor, isBlock)
@@ -99190,7 +99250,7 @@ function transformSystemModule(context) {
99190
99250
  }
99191
99251
  return expressions ? factory2.inlineExpressions(expressions) : factory2.createOmittedExpression();
99192
99252
  } else {
99193
- return visitNode(node, discardedValueVisitor, isExpression);
99253
+ return visitNode(node, discardedValueVisitor, isForInitializer);
99194
99254
  }
99195
99255
  }
99196
99256
  function visitDoStatement(node) {
@@ -99211,21 +99271,21 @@ function transformSystemModule(context) {
99211
99271
  return factory2.updateLabeledStatement(
99212
99272
  node,
99213
99273
  node.label,
99214
- visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
99274
+ Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
99215
99275
  );
99216
99276
  }
99217
99277
  function visitWithStatement(node) {
99218
99278
  return factory2.updateWithStatement(
99219
99279
  node,
99220
99280
  visitNode(node.expression, visitor, isExpression),
99221
- visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
99281
+ Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
99222
99282
  );
99223
99283
  }
99224
99284
  function visitSwitchStatement(node) {
99225
99285
  return factory2.updateSwitchStatement(
99226
99286
  node,
99227
99287
  visitNode(node.expression, visitor, isExpression),
99228
- visitNode(node.caseBlock, topLevelNestedVisitor, isCaseBlock)
99288
+ Debug.checkDefined(visitNode(node.caseBlock, topLevelNestedVisitor, isCaseBlock))
99229
99289
  );
99230
99290
  }
99231
99291
  function visitCaseBlock(node) {
@@ -99257,7 +99317,7 @@ function transformSystemModule(context) {
99257
99317
  node = factory2.updateCatchClause(
99258
99318
  node,
99259
99319
  node.variableDeclaration,
99260
- visitNode(node.block, topLevelNestedVisitor, isBlock)
99320
+ Debug.checkDefined(visitNode(node.block, topLevelNestedVisitor, isBlock))
99261
99321
  );
99262
99322
  enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
99263
99323
  return node;
@@ -99327,7 +99387,7 @@ function transformSystemModule(context) {
99327
99387
  }
99328
99388
  function visitImportCallExpression(node) {
99329
99389
  const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
99330
- const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor);
99390
+ const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
99331
99391
  const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
99332
99392
  return factory2.createCallExpression(
99333
99393
  factory2.createPropertyAccessExpression(
@@ -100448,7 +100508,7 @@ function transformDeclarations(context) {
100448
100508
  sourceFile,
100449
100509
  /*bundled*/
100450
100510
  true
100451
- )) : visitNodes2(sourceFile.statements, visitDeclarationStatements);
100511
+ )) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
100452
100512
  const newFile = factory2.updateSourceFile(
100453
100513
  sourceFile,
100454
100514
  [factory2.createModuleDeclaration(
@@ -100470,7 +100530,7 @@ function transformDeclarations(context) {
100470
100530
  return newFile;
100471
100531
  }
100472
100532
  needsDeclare = true;
100473
- const updated2 = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements);
100533
+ const updated2 = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
100474
100534
  return factory2.updateSourceFile(
100475
100535
  sourceFile,
100476
100536
  transformAndReplaceLatePaintedStatements(updated2),
@@ -100539,7 +100599,7 @@ function transformDeclarations(context) {
100539
100599
  refs.forEach(referenceVisitor);
100540
100600
  emittedImports = filter(combinedStatements, isAnyImportSyntax);
100541
100601
  } else {
100542
- const statements = visitNodes2(node.statements, visitDeclarationStatements);
100602
+ const statements = visitNodes2(node.statements, visitDeclarationStatements, isStatement);
100543
100603
  combinedStatements = setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
100544
100604
  refs.forEach(referenceVisitor);
100545
100605
  emittedImports = filter(combinedStatements, isAnyImportSyntax);
@@ -100656,9 +100716,9 @@ function transformDeclarations(context) {
100656
100716
  return name;
100657
100717
  } else {
100658
100718
  if (name.kind === 204 /* ArrayBindingPattern */) {
100659
- return factory2.updateArrayBindingPattern(name, visitNodes2(name.elements, visitBindingElement));
100719
+ return factory2.updateArrayBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isArrayBindingElement));
100660
100720
  } else {
100661
- return factory2.updateObjectBindingPattern(name, visitNodes2(name.elements, visitBindingElement));
100721
+ return factory2.updateObjectBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isBindingElement));
100662
100722
  }
100663
100723
  }
100664
100724
  function visitBindingElement(elem) {
@@ -100728,10 +100788,10 @@ function transformDeclarations(context) {
100728
100788
  }
100729
100789
  const shouldUseResolverType = node.kind === 166 /* Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node));
100730
100790
  if (type && !shouldUseResolverType) {
100731
- return visitNode(type, visitDeclarationSubtree);
100791
+ return visitNode(type, visitDeclarationSubtree, isTypeNode);
100732
100792
  }
100733
100793
  if (!getParseTreeNode(node)) {
100734
- return type ? visitNode(type, visitDeclarationSubtree) : factory2.createKeywordTypeNode(131 /* AnyKeyword */);
100794
+ return type ? visitNode(type, visitDeclarationSubtree, isTypeNode) : factory2.createKeywordTypeNode(131 /* AnyKeyword */);
100735
100795
  }
100736
100796
  if (node.kind === 175 /* SetAccessor */) {
100737
100797
  return factory2.createKeywordTypeNode(131 /* AnyKeyword */);
@@ -100845,7 +100905,7 @@ function transformDeclarations(context) {
100845
100905
  return factory2.createNodeArray(newParams || emptyArray);
100846
100906
  }
100847
100907
  function ensureTypeParams(node, params) {
100848
- return hasEffectiveModifier(node, 8 /* Private */) ? void 0 : visitNodes2(params, visitDeclarationSubtree);
100908
+ return hasEffectiveModifier(node, 8 /* Private */) ? void 0 : visitNodes2(params, visitDeclarationSubtree, isTypeParameterDeclaration);
100849
100909
  }
100850
100910
  function isEnclosingDeclaration(node) {
100851
100911
  return isSourceFile(node) || isTypeAliasDeclaration(node) || isModuleDeclaration(node) || isClassDeclaration(node) || isInterfaceDeclaration(node) || isFunctionLike(node) || isIndexSignatureDeclaration(node) || isMappedTypeNode(node);
@@ -100980,7 +101040,7 @@ function transformDeclarations(context) {
100980
101040
  needsDeclare = priorNeedsDeclare;
100981
101041
  lateStatementReplacementMap.set(getOriginalNodeId(i), result);
100982
101042
  }
100983
- return visitNodes2(statements, visitLateVisibilityMarkedStatements);
101043
+ return visitNodes2(statements, visitLateVisibilityMarkedStatements, isStatement);
100984
101044
  function visitLateVisibilityMarkedStatements(statement) {
100985
101045
  if (isLateVisibilityPaintedStatement(statement)) {
100986
101046
  const key = getOriginalNodeId(statement);
@@ -101194,7 +101254,7 @@ function transformDeclarations(context) {
101194
101254
  input,
101195
101255
  ensureModifiers(input),
101196
101256
  updateParamsList(input, input.parameters),
101197
- visitNode(input.type, visitDeclarationSubtree) || factory2.createKeywordTypeNode(131 /* AnyKeyword */)
101257
+ visitNode(input.type, visitDeclarationSubtree, isTypeNode) || factory2.createKeywordTypeNode(131 /* AnyKeyword */)
101198
101258
  ));
101199
101259
  }
101200
101260
  case 257 /* VariableDeclaration */: {
@@ -101227,20 +101287,24 @@ function transformDeclarations(context) {
101227
101287
  return cleanup(visitEachChild(input, visitDeclarationSubtree, context));
101228
101288
  }
101229
101289
  case 191 /* ConditionalType */: {
101230
- const checkType = visitNode(input.checkType, visitDeclarationSubtree);
101231
- const extendsType = visitNode(input.extendsType, visitDeclarationSubtree);
101290
+ const checkType = visitNode(input.checkType, visitDeclarationSubtree, isTypeNode);
101291
+ const extendsType = visitNode(input.extendsType, visitDeclarationSubtree, isTypeNode);
101232
101292
  const oldEnclosingDecl = enclosingDeclaration;
101233
101293
  enclosingDeclaration = input.trueType;
101234
- const trueType = visitNode(input.trueType, visitDeclarationSubtree);
101294
+ const trueType = visitNode(input.trueType, visitDeclarationSubtree, isTypeNode);
101235
101295
  enclosingDeclaration = oldEnclosingDecl;
101236
- const falseType = visitNode(input.falseType, visitDeclarationSubtree);
101296
+ const falseType = visitNode(input.falseType, visitDeclarationSubtree, isTypeNode);
101297
+ Debug.assert(checkType);
101298
+ Debug.assert(extendsType);
101299
+ Debug.assert(trueType);
101300
+ Debug.assert(falseType);
101237
101301
  return cleanup(factory2.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
101238
101302
  }
101239
101303
  case 181 /* FunctionType */: {
101240
- return cleanup(factory2.updateFunctionTypeNode(input, visitNodes2(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), visitNode(input.type, visitDeclarationSubtree)));
101304
+ return cleanup(factory2.updateFunctionTypeNode(input, visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))));
101241
101305
  }
101242
101306
  case 182 /* ConstructorType */: {
101243
- return cleanup(factory2.updateConstructorTypeNode(input, ensureModifiers(input), visitNodes2(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), visitNode(input.type, visitDeclarationSubtree)));
101307
+ return cleanup(factory2.updateConstructorTypeNode(input, ensureModifiers(input), visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))));
101244
101308
  }
101245
101309
  case 202 /* ImportType */: {
101246
101310
  if (!isLiteralImportTypeNode(input))
@@ -101384,7 +101448,7 @@ function transformDeclarations(context) {
101384
101448
  ensureModifiers(input),
101385
101449
  input.name,
101386
101450
  visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
101387
- visitNode(input.type, visitDeclarationSubtree, isTypeNode)
101451
+ Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode))
101388
101452
  ));
101389
101453
  needsDeclare = previousNeedsDeclare;
101390
101454
  return clean2;
@@ -101396,7 +101460,7 @@ function transformDeclarations(context) {
101396
101460
  input.name,
101397
101461
  ensureTypeParams(input, input.typeParameters),
101398
101462
  transformHeritageClauses(input.heritageClauses),
101399
- visitNodes2(input.members, visitDeclarationSubtree)
101463
+ visitNodes2(input.members, visitDeclarationSubtree, isTypeElement)
101400
101464
  ));
101401
101465
  }
101402
101466
  case 259 /* FunctionDeclaration */: {
@@ -101513,7 +101577,7 @@ function transformDeclarations(context) {
101513
101577
  const oldHasScopeFix = resultHasScopeMarker;
101514
101578
  resultHasScopeMarker = false;
101515
101579
  needsScopeFixMarker = false;
101516
- const statements = visitNodes2(inner.statements, visitDeclarationStatements);
101580
+ const statements = visitNodes2(inner.statements, visitDeclarationStatements, isStatement);
101517
101581
  let lateStatements = transformAndReplaceLatePaintedStatements(statements);
101518
101582
  if (input.flags & 16777216 /* Ambient */) {
101519
101583
  needsScopeFixMarker = false;
@@ -101522,7 +101586,7 @@ function transformDeclarations(context) {
101522
101586
  if (needsScopeFixMarker) {
101523
101587
  lateStatements = factory2.createNodeArray([...lateStatements, createEmptyExports(factory2)]);
101524
101588
  } else {
101525
- lateStatements = visitNodes2(lateStatements, stripExportModifiers);
101589
+ lateStatements = visitNodes2(lateStatements, stripExportModifiers, isStatement);
101526
101590
  }
101527
101591
  }
101528
101592
  const body = factory2.updateModuleBlock(inner, lateStatements);
@@ -101618,7 +101682,7 @@ function transformDeclarations(context) {
101618
101682
  void 0
101619
101683
  )
101620
101684
  ] : void 0;
101621
- const memberNodes = concatenate(concatenate(privateIdentifier, parameterProperties), visitNodes2(input.members, visitDeclarationSubtree));
101685
+ const memberNodes = concatenate(concatenate(privateIdentifier, parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement));
101622
101686
  const members = factory2.createNodeArray(memberNodes);
101623
101687
  const extendsClause = getEffectiveBaseTypeNode(input);
101624
101688
  if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 104 /* NullKeyword */) {
@@ -101642,11 +101706,11 @@ function transformDeclarations(context) {
101642
101706
  if (clause.token === 94 /* ExtendsKeyword */) {
101643
101707
  const oldDiag2 = getSymbolAccessibilityDiagnostic;
101644
101708
  getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
101645
- const newClause = factory2.updateHeritageClause(clause, map(clause.types, (t) => factory2.updateExpressionWithTypeArguments(t, newId, visitNodes2(t.typeArguments, visitDeclarationSubtree))));
101709
+ const newClause = factory2.updateHeritageClause(clause, map(clause.types, (t) => factory2.updateExpressionWithTypeArguments(t, newId, visitNodes2(t.typeArguments, visitDeclarationSubtree, isTypeNode))));
101646
101710
  getSymbolAccessibilityDiagnostic = oldDiag2;
101647
101711
  return newClause;
101648
101712
  }
101649
- return factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => isEntityNameExpression(t.expression) || t.expression.kind === 104 /* NullKeyword */)), visitDeclarationSubtree));
101713
+ return factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => isEntityNameExpression(t.expression) || t.expression.kind === 104 /* NullKeyword */)), visitDeclarationSubtree, isExpressionWithTypeArguments));
101650
101714
  }));
101651
101715
  return [statement, cleanup(factory2.updateClassDeclaration(
101652
101716
  input,
@@ -101702,7 +101766,7 @@ function transformDeclarations(context) {
101702
101766
  function transformVariableStatement(input) {
101703
101767
  if (!forEach(input.declarationList.declarations, getBindingNameVisible))
101704
101768
  return;
101705
- const nodes = visitNodes2(input.declarationList.declarations, visitDeclarationSubtree);
101769
+ const nodes = visitNodes2(input.declarationList.declarations, visitDeclarationSubtree, isVariableDeclaration);
101706
101770
  if (!length(nodes))
101707
101771
  return;
101708
101772
  return factory2.updateVariableStatement(input, factory2.createNodeArray(ensureModifiers(input)), factory2.updateVariableDeclarationList(input.declarationList, nodes));
@@ -101793,7 +101857,7 @@ function transformDeclarations(context) {
101793
101857
  function transformHeritageClauses(nodes) {
101794
101858
  return factory2.createNodeArray(filter(map(nodes, (clause) => factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => {
101795
101859
  return isEntityNameExpression(t.expression) || clause.token === 94 /* ExtendsKeyword */ && t.expression.kind === 104 /* NullKeyword */;
101796
- })), visitDeclarationSubtree))), (clause) => clause.types && !!clause.types.length));
101860
+ })), visitDeclarationSubtree, isExpressionWithTypeArguments))), (clause) => clause.types && !!clause.types.length));
101797
101861
  }
101798
101862
  }
101799
101863
  function isAlwaysType(node) {
@@ -111211,7 +111275,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
111211
111275
  createOptionValueDiagnostic("importsNotUsedAsValues", Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later);
111212
111276
  }
111213
111277
  if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
111214
- createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_bundler_and_either_noEmit_or_emitDeclarationOnly_is_set);
111278
+ createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set);
111215
111279
  }
111216
111280
  const moduleResolution = getEmitModuleResolutionKind(options);
111217
111281
  if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
@@ -114440,6 +114504,9 @@ function getFilesInErrorForSummary(diagnostics) {
114440
114504
  }
114441
114505
  );
114442
114506
  return filesInError.map((fileName) => {
114507
+ if (fileName === void 0) {
114508
+ return void 0;
114509
+ }
114443
114510
  const diagnosticForFileName = find(
114444
114511
  diagnostics,
114445
114512
  (diagnostic) => diagnostic.file !== void 0 && diagnostic.file.fileName === fileName
@@ -115088,6 +115155,8 @@ function createWatchProgram(host) {
115088
115155
  parseConfigFile2();
115089
115156
  newLine = updateNewLine();
115090
115157
  }
115158
+ Debug.assert(compilerOptions);
115159
+ Debug.assert(rootFileNames);
115091
115160
  const { watchFile: watchFile2, watchDirectory, writeLog } = createWatchFactory(host, compilerOptions);
115092
115161
  const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
115093
115162
  writeLog(`Current directory: ${currentDirectory} CaseSensitiveFileNames: ${useCaseSensitiveFileNames}`);
@@ -115190,6 +115259,8 @@ function createWatchProgram(host) {
115190
115259
  }
115191
115260
  function synchronizeProgram() {
115192
115261
  writeLog(`Synchronizing program`);
115262
+ Debug.assert(compilerOptions);
115263
+ Debug.assert(rootFileNames);
115193
115264
  clearInvalidateResolutionsOfFailedLookupLocations();
115194
115265
  const program = getCurrentBuilderProgram();
115195
115266
  if (hasChangedCompilerOptions) {
@@ -115429,6 +115500,8 @@ function createWatchProgram(host) {
115429
115500
  }
115430
115501
  function reloadFileNamesFromConfigFile() {
115431
115502
  writeLog("Reloading new file names and options");
115503
+ Debug.assert(compilerOptions);
115504
+ Debug.assert(configFileName);
115432
115505
  reloadLevel = 0 /* None */;
115433
115506
  rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
115434
115507
  if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
@@ -115437,6 +115510,7 @@ function createWatchProgram(host) {
115437
115510
  synchronizeProgram();
115438
115511
  }
115439
115512
  function reloadConfigFile() {
115513
+ Debug.assert(configFileName);
115440
115514
  writeLog(`Reloading config file: ${configFileName}`);
115441
115515
  reloadLevel = 0 /* None */;
115442
115516
  if (cachedDirectoryStructureHost) {
@@ -115449,6 +115523,7 @@ function createWatchProgram(host) {
115449
115523
  updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
115450
115524
  }
115451
115525
  function parseConfigFile2() {
115526
+ Debug.assert(configFileName);
115452
115527
  setConfigFileParsingResult(getParsedCommandLineOfConfigFile(
115453
115528
  configFileName,
115454
115529
  optionsToExtendForConfigFile,
@@ -115476,6 +115551,7 @@ function createWatchProgram(host) {
115476
115551
  return config.parsedCommandLine;
115477
115552
  if (config.parsedCommandLine && config.reloadLevel === 1 /* Partial */ && !host.getParsedCommandLine) {
115478
115553
  writeLog("Reloading new file names and options");
115554
+ Debug.assert(compilerOptions);
115479
115555
  const fileNames = getFileNamesFromConfigSpecs(
115480
115556
  config.parsedCommandLine.options.configFile.configFileSpecs,
115481
115557
  getNormalizedAbsolutePath(getDirectoryPath(configFileName2), currentDirectory),
@@ -115567,7 +115643,8 @@ function createWatchProgram(host) {
115567
115643
  return watchDirectory(
115568
115644
  directory,
115569
115645
  (fileOrDirectory) => {
115570
- Debug.assert(!!configFileName);
115646
+ Debug.assert(configFileName);
115647
+ Debug.assert(compilerOptions);
115571
115648
  const fileOrDirectoryPath = toPath3(fileOrDirectory);
115572
115649
  if (cachedDirectoryStructureHost) {
115573
115650
  cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
@@ -115598,6 +115675,7 @@ function createWatchProgram(host) {
115598
115675
  );
115599
115676
  }
115600
115677
  function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions2, watchType) {
115678
+ Debug.assert(configFileName);
115601
115679
  updateSharedExtendedConfigFileWatcher(
115602
115680
  forProjectPath,
115603
115681
  options,