tsc-ts 0.0.10 → 0.1.0

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.
Files changed (367) hide show
  1. package/README.md +1 -1
  2. package/bin/tsc-ts.js +70 -1
  3. package/dist/api/compiler/ast-utilities.d.ts +19 -1
  4. package/dist/api/compiler/ast-utilities.js +180 -95
  5. package/dist/api/compiler/ast.d.ts +20 -15
  6. package/dist/api/compiler/ast.js +1023 -995
  7. package/dist/api/compiler/astnav.js +15 -15
  8. package/dist/api/compiler/binder-utilities.js +186 -186
  9. package/dist/api/compiler/binder.js +290 -263
  10. package/dist/api/compiler/character-codes.js +2 -2
  11. package/dist/api/compiler/checker-calls.js +173 -123
  12. package/dist/api/compiler/checker-classes.d.ts +14 -3
  13. package/dist/api/compiler/checker-classes.js +134 -90
  14. package/dist/api/compiler/checker-contextual.js +64 -61
  15. package/dist/api/compiler/checker-declaration-order.js +79 -79
  16. package/dist/api/compiler/checker-declarations.d.ts +1 -0
  17. package/dist/api/compiler/checker-declarations.js +160 -136
  18. package/dist/api/compiler/checker-declared-types.js +67 -65
  19. package/dist/api/compiler/checker-decorators.js +77 -77
  20. package/dist/api/compiler/checker-deprecation.d.ts +8 -3
  21. package/dist/api/compiler/checker-deprecation.js +76 -55
  22. package/dist/api/compiler/checker-destructuring.js +47 -45
  23. package/dist/api/compiler/checker-elaboration.js +24 -24
  24. package/dist/api/compiler/checker-emit-helpers.js +4 -4
  25. package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
  26. package/dist/api/compiler/checker-emit-resolver.js +25 -13
  27. package/dist/api/compiler/checker-evaluator.js +9 -9
  28. package/dist/api/compiler/checker-expressions.js +244 -211
  29. package/dist/api/compiler/checker-functions.js +113 -107
  30. package/dist/api/compiler/checker-generated-code.d.ts +0 -11
  31. package/dist/api/compiler/checker-generated-code.js +28 -52
  32. package/dist/api/compiler/checker-grammar.d.ts +1 -0
  33. package/dist/api/compiler/checker-grammar.js +469 -438
  34. package/dist/api/compiler/checker-heritage.js +91 -93
  35. package/dist/api/compiler/checker-inference.d.ts +77 -5
  36. package/dist/api/compiler/checker-inference.js +487 -113
  37. package/dist/api/compiler/checker-iteration.d.ts +0 -10
  38. package/dist/api/compiler/checker-iteration.js +35 -52
  39. package/dist/api/compiler/checker-javascript.js +14 -14
  40. package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
  41. package/dist/api/compiler/checker-jsdoc.js +67 -58
  42. package/dist/api/compiler/checker-jsx.js +105 -88
  43. package/dist/api/compiler/checker-members.d.ts +9 -2
  44. package/dist/api/compiler/checker-members.js +210 -74
  45. package/dist/api/compiler/checker-modules.d.ts +15 -6
  46. package/dist/api/compiler/checker-modules.js +469 -309
  47. package/dist/api/compiler/checker-narrowing.js +273 -189
  48. package/dist/api/compiler/checker-object-literals.js +25 -22
  49. package/dist/api/compiler/checker-operators.js +126 -118
  50. package/dist/api/compiler/checker-overloads.js +27 -27
  51. package/dist/api/compiler/checker-property-access.js +59 -55
  52. package/dist/api/compiler/checker-services.d.ts +1 -0
  53. package/dist/api/compiler/checker-services.js +222 -210
  54. package/dist/api/compiler/checker-signatures.js +65 -49
  55. package/dist/api/compiler/checker-source-file.d.ts +5 -0
  56. package/dist/api/compiler/checker-source-file.js +154 -130
  57. package/dist/api/compiler/checker-statements.js +33 -32
  58. package/dist/api/compiler/checker-super.js +50 -50
  59. package/dist/api/compiler/checker-symbol-types.js +109 -93
  60. package/dist/api/compiler/checker-symbols.d.ts +13 -1
  61. package/dist/api/compiler/checker-symbols.js +264 -149
  62. package/dist/api/compiler/checker-type-factory.d.ts +5 -0
  63. package/dist/api/compiler/checker-type-factory.js +137 -34
  64. package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
  65. package/dist/api/compiler/checker-type-nodes.js +179 -141
  66. package/dist/api/compiler/checker-type-operators.d.ts +2 -0
  67. package/dist/api/compiler/checker-type-operators.js +110 -63
  68. package/dist/api/compiler/checker-types.d.ts +80 -3
  69. package/dist/api/compiler/checker-types.js +121 -2
  70. package/dist/api/compiler/checker-unused.js +114 -118
  71. package/dist/api/compiler/checker-utilities.js +11 -11
  72. package/dist/api/compiler/checker.d.ts +93 -31
  73. package/dist/api/compiler/checker.js +143 -35
  74. package/dist/api/compiler/command-line.d.ts +1 -3
  75. package/dist/api/compiler/command-line.js +47 -44
  76. package/dist/api/compiler/compile-program.d.ts +19 -4
  77. package/dist/api/compiler/compile-program.js +45 -26
  78. package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
  79. package/dist/api/compiler/diagnostic-messages.js +128 -122
  80. package/dist/api/compiler/diagnostics.js +7 -7
  81. package/dist/api/compiler/emitter.d.ts +7 -1
  82. package/dist/api/compiler/emitter.js +53 -11
  83. package/dist/api/compiler/file-include.d.ts +2 -1
  84. package/dist/api/compiler/file-include.js +11 -7
  85. package/dist/api/compiler/file-loader.d.ts +10 -0
  86. package/dist/api/compiler/file-loader.js +138 -41
  87. package/dist/api/compiler/instantiation.d.ts +7 -0
  88. package/dist/api/compiler/instantiation.js +101 -49
  89. package/dist/api/compiler/jsdoc.js +23 -23
  90. package/dist/api/compiler/link-tables.d.ts +48 -18
  91. package/dist/api/compiler/link-tables.js +80 -37
  92. package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
  93. package/dist/api/compiler/locales/cs-CZ.js +1 -1
  94. package/dist/api/compiler/locales/de-DE.d.ts +1 -1
  95. package/dist/api/compiler/locales/de-DE.js +1 -1
  96. package/dist/api/compiler/locales/es-ES.d.ts +1 -1
  97. package/dist/api/compiler/locales/es-ES.js +1 -1
  98. package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
  99. package/dist/api/compiler/locales/fr-FR.js +1 -1
  100. package/dist/api/compiler/locales/it-IT.d.ts +1 -1
  101. package/dist/api/compiler/locales/it-IT.js +1 -1
  102. package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
  103. package/dist/api/compiler/locales/ja-JP.js +1 -1
  104. package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
  105. package/dist/api/compiler/locales/ko-KR.js +1 -1
  106. package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
  107. package/dist/api/compiler/locales/pl-PL.js +1 -1
  108. package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
  109. package/dist/api/compiler/locales/pt-BR.js +1 -1
  110. package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
  111. package/dist/api/compiler/locales/ru-RU.js +1 -1
  112. package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
  113. package/dist/api/compiler/locales/tr-TR.js +1 -1
  114. package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
  115. package/dist/api/compiler/locales/zh-CN.js +1 -1
  116. package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
  117. package/dist/api/compiler/locales/zh-TW.js +1 -1
  118. package/dist/api/compiler/module-resolution-types.js +6 -6
  119. package/dist/api/compiler/module-resolution.d.ts +10 -1
  120. package/dist/api/compiler/module-resolution.js +115 -84
  121. package/dist/api/compiler/module-specifiers.d.ts +15 -0
  122. package/dist/api/compiler/module-specifiers.js +24 -18
  123. package/dist/api/compiler/name-resolver.js +74 -65
  124. package/dist/api/compiler/node-builder-names.d.ts +11 -3
  125. package/dist/api/compiler/node-builder-names.js +210 -90
  126. package/dist/api/compiler/node-builder-pseudo.js +29 -31
  127. package/dist/api/compiler/node-builder-reuse.js +23 -22
  128. package/dist/api/compiler/node-builder.d.ts +18 -1
  129. package/dist/api/compiler/node-builder.js +191 -102
  130. package/dist/api/compiler/option-declarations.d.ts +2 -6
  131. package/dist/api/compiler/option-declarations.js +315 -375
  132. package/dist/api/compiler/options.d.ts +15 -33
  133. package/dist/api/compiler/options.js +21 -54
  134. package/dist/api/compiler/output-paths.d.ts +4 -1
  135. package/dist/api/compiler/output-paths.js +6 -11
  136. package/dist/api/compiler/package-json.d.ts +3 -3
  137. package/dist/api/compiler/package-json.js +11 -10
  138. package/dist/api/compiler/parser.d.ts +40 -19
  139. package/dist/api/compiler/parser.js +308 -216
  140. package/dist/api/compiler/path.d.ts +9 -0
  141. package/dist/api/compiler/path.js +20 -3
  142. package/dist/api/compiler/printer/emit-context.d.ts +3 -1
  143. package/dist/api/compiler/printer/emit-context.js +16 -1
  144. package/dist/api/compiler/printer/factory-base.d.ts +2 -2
  145. package/dist/api/compiler/printer/factory-base.js +7 -3
  146. package/dist/api/compiler/printer/factory.js +3 -1
  147. package/dist/api/compiler/printer/helpers.js +10 -1
  148. package/dist/api/compiler/printer/name-generator.d.ts +1 -1
  149. package/dist/api/compiler/printer/name-generator.js +35 -16
  150. package/dist/api/compiler/printer/printer.d.ts +1 -0
  151. package/dist/api/compiler/printer/printer.js +303 -281
  152. package/dist/api/compiler/printer/utilities.js +149 -147
  153. package/dist/api/compiler/program-checker.d.ts +8 -2
  154. package/dist/api/compiler/program-checker.js +84 -34
  155. package/dist/api/compiler/program-utilities.d.ts +3 -1
  156. package/dist/api/compiler/program-utilities.js +28 -15
  157. package/dist/api/compiler/program.d.ts +2 -0
  158. package/dist/api/compiler/program.js +69 -57
  159. package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
  160. package/dist/api/compiler/pseudo-bigint.js +18 -0
  161. package/dist/api/compiler/regexp-checker.d.ts +1 -1
  162. package/dist/api/compiler/regexp-checker.js +93 -76
  163. package/dist/api/compiler/relations.d.ts +27 -4
  164. package/dist/api/compiler/relations.js +337 -180
  165. package/dist/api/compiler/reparser.js +60 -56
  166. package/dist/api/compiler/scanner.d.ts +19 -2
  167. package/dist/api/compiler/scanner.js +123 -108
  168. package/dist/api/compiler/shared-results.d.ts +463 -0
  169. package/dist/api/compiler/shared-results.js +2128 -0
  170. package/dist/api/compiler/sourcemap.js +2 -2
  171. package/dist/api/compiler/symbol-accessibility.js +87 -74
  172. package/dist/api/compiler/symbol.d.ts +22 -13
  173. package/dist/api/compiler/symbol.js +15 -1
  174. package/dist/api/compiler/syntax-kind.d.ts +198 -197
  175. package/dist/api/compiler/transformers/alias-references.js +247 -139
  176. package/dist/api/compiler/transformers/async-utilities.js +25 -25
  177. package/dist/api/compiler/transformers/async.d.ts +0 -1
  178. package/dist/api/compiler/transformers/async.js +64 -77
  179. package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
  180. package/dist/api/compiler/transformers/class-fields.js +81 -78
  181. package/dist/api/compiler/transformers/commonjs-module.js +18 -15
  182. package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
  183. package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
  184. package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
  185. package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
  186. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
  187. package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
  188. package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
  189. package/dist/api/compiler/transformers/declarations.d.ts +4 -1
  190. package/dist/api/compiler/transformers/declarations.js +305 -238
  191. package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
  192. package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
  193. package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
  194. package/dist/api/compiler/transformers/destructuring.js +19 -18
  195. package/dist/api/compiler/transformers/emit-resolver.js +1 -1
  196. package/dist/api/compiler/transformers/es-decorators.js +55 -55
  197. package/dist/api/compiler/transformers/external-module-info.js +3 -3
  198. package/dist/api/compiler/transformers/for-await.js +25 -25
  199. package/dist/api/compiler/transformers/import-elision.js +14 -14
  200. package/dist/api/compiler/transformers/jsx.js +12 -12
  201. package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
  202. package/dist/api/compiler/transformers/module.js +8 -8
  203. package/dist/api/compiler/transformers/named-evaluation.js +4 -4
  204. package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
  205. package/dist/api/compiler/transformers/optional-chain.js +10 -10
  206. package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
  207. package/dist/api/compiler/transformers/reference-resolver.js +131 -69
  208. package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
  209. package/dist/api/compiler/transformers/subtree-facts.js +47 -47
  210. package/dist/api/compiler/transformers/syntax-facts.js +56 -58
  211. package/dist/api/compiler/transformers/type-eraser.js +73 -66
  212. package/dist/api/compiler/transformers/type-serialization.js +24 -24
  213. package/dist/api/compiler/transformers/using.js +12 -12
  214. package/dist/api/compiler/transformers/utilities.js +77 -77
  215. package/dist/api/compiler/transformers/visitor-base.js +172 -172
  216. package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
  217. package/dist/api/compiler/tsconfig.d.ts +10 -2
  218. package/dist/api/compiler/tsconfig.js +136 -48
  219. package/dist/api/compiler/type-printer.js +40 -3
  220. package/dist/api/compiler/types.d.ts +2 -1
  221. package/dist/api/library/ast.generated.d.ts +42 -39
  222. package/dist/api/library/ast.generated.js +1 -1
  223. package/dist/api/library/compiler-options.generated.d.ts +111 -100
  224. package/dist/api/library/compiler-options.generated.js +1 -1
  225. package/dist/api/library/disk.js +12 -1
  226. package/dist/api/library/enums.generated.d.ts +206 -206
  227. package/dist/api/library/enums.generated.js +206 -206
  228. package/dist/api/library/nodes.js +26 -26
  229. package/package.json +9 -9
  230. package/src/compiler/ast-utilities.ts +99 -7
  231. package/src/compiler/ast.ts +55 -26
  232. package/src/compiler/binder.ts +39 -4
  233. package/src/compiler/character-codes.ts +2 -2
  234. package/src/compiler/checker-calls.ts +76 -8
  235. package/src/compiler/checker-classes.ts +78 -24
  236. package/src/compiler/checker-contextual.ts +6 -1
  237. package/src/compiler/checker-declarations.ts +31 -4
  238. package/src/compiler/checker-declared-types.ts +8 -5
  239. package/src/compiler/checker-decorators.ts +1 -1
  240. package/src/compiler/checker-deprecation.ts +29 -8
  241. package/src/compiler/checker-destructuring.ts +10 -3
  242. package/src/compiler/checker-emit-helpers.ts +1 -0
  243. package/src/compiler/checker-emit-resolver.ts +16 -6
  244. package/src/compiler/checker-expressions.ts +79 -46
  245. package/src/compiler/checker-functions.ts +21 -6
  246. package/src/compiler/checker-generated-code.ts +2 -22
  247. package/src/compiler/checker-grammar.ts +133 -60
  248. package/src/compiler/checker-heritage.ts +22 -21
  249. package/src/compiler/checker-inference.ts +514 -87
  250. package/src/compiler/checker-iteration.ts +18 -31
  251. package/src/compiler/checker-javascript.ts +1 -1
  252. package/src/compiler/checker-jsdoc.ts +50 -27
  253. package/src/compiler/checker-jsx.ts +26 -4
  254. package/src/compiler/checker-members.ts +197 -55
  255. package/src/compiler/checker-modules.ts +332 -65
  256. package/src/compiler/checker-narrowing.ts +98 -19
  257. package/src/compiler/checker-object-literals.ts +3 -0
  258. package/src/compiler/checker-operators.ts +11 -4
  259. package/src/compiler/checker-property-access.ts +7 -2
  260. package/src/compiler/checker-services.ts +39 -12
  261. package/src/compiler/checker-signatures.ts +15 -1
  262. package/src/compiler/checker-source-file.ts +39 -13
  263. package/src/compiler/checker-statements.ts +3 -2
  264. package/src/compiler/checker-symbol-types.ts +29 -6
  265. package/src/compiler/checker-symbols.ts +158 -15
  266. package/src/compiler/checker-type-factory.ts +120 -21
  267. package/src/compiler/checker-type-nodes.ts +46 -3
  268. package/src/compiler/checker-type-operators.ts +83 -26
  269. package/src/compiler/checker-types.ts +147 -4
  270. package/src/compiler/checker-unused.ts +9 -14
  271. package/src/compiler/checker.ts +168 -41
  272. package/src/compiler/command-line.ts +28 -28
  273. package/src/compiler/compile-program.ts +51 -25
  274. package/src/compiler/decoder.ts +13 -4
  275. package/src/compiler/diagnostic-messages.ts +1973 -1892
  276. package/src/compiler/emitter.ts +57 -8
  277. package/src/compiler/encoder.ts +23 -8
  278. package/src/compiler/file-include.ts +9 -3
  279. package/src/compiler/file-loader.ts +139 -32
  280. package/src/compiler/help.ts +10 -14
  281. package/src/compiler/incremental.ts +86 -18
  282. package/src/compiler/init.ts +2 -7
  283. package/src/compiler/instantiation.ts +77 -22
  284. package/src/compiler/jsdoc.ts +3 -1
  285. package/src/compiler/link-tables.ts +82 -37
  286. package/src/compiler/locales/cs-CZ.ts +1 -1
  287. package/src/compiler/locales/de-DE.ts +1 -1
  288. package/src/compiler/locales/es-ES.ts +1 -1
  289. package/src/compiler/locales/fr-FR.ts +1 -1
  290. package/src/compiler/locales/it-IT.ts +1 -1
  291. package/src/compiler/locales/ja-JP.ts +1 -1
  292. package/src/compiler/locales/ko-KR.ts +1 -1
  293. package/src/compiler/locales/pl-PL.ts +1 -1
  294. package/src/compiler/locales/pt-BR.ts +1 -1
  295. package/src/compiler/locales/ru-RU.ts +1 -1
  296. package/src/compiler/locales/tr-TR.ts +1 -1
  297. package/src/compiler/locales/zh-CN.ts +1 -1
  298. package/src/compiler/locales/zh-TW.ts +1 -1
  299. package/src/compiler/module-resolution.ts +44 -8
  300. package/src/compiler/module-specifiers.ts +62 -20
  301. package/src/compiler/name-resolver.ts +9 -1
  302. package/src/compiler/node-builder-names.ts +236 -54
  303. package/src/compiler/node-builder-pseudo.ts +4 -7
  304. package/src/compiler/node-builder-reuse.ts +5 -4
  305. package/src/compiler/node-builder.ts +130 -31
  306. package/src/compiler/option-declarations.ts +33 -103
  307. package/src/compiler/options.ts +23 -62
  308. package/src/compiler/output-paths.ts +5 -18
  309. package/src/compiler/package-entrypoints.ts +345 -0
  310. package/src/compiler/package-json.ts +4 -4
  311. package/src/compiler/parallel-check.ts +197 -8
  312. package/src/compiler/parallel-emit.ts +1 -1
  313. package/src/compiler/parser.ts +156 -39
  314. package/src/compiler/path.ts +22 -2
  315. package/src/compiler/printer/emit-context.ts +16 -0
  316. package/src/compiler/printer/factory-base.ts +10 -3
  317. package/src/compiler/printer/factory.ts +4 -1
  318. package/src/compiler/printer/helpers.ts +10 -1
  319. package/src/compiler/printer/name-generator.ts +24 -2
  320. package/src/compiler/printer/printer.ts +35 -14
  321. package/src/compiler/printer/utilities.ts +8 -2
  322. package/src/compiler/program-checker.ts +53 -5
  323. package/src/compiler/program-utilities.ts +23 -10
  324. package/src/compiler/program.ts +13 -1
  325. package/src/compiler/pseudo-bigint.ts +17 -0
  326. package/src/compiler/regexp-checker.ts +63 -30
  327. package/src/compiler/relations.ts +233 -77
  328. package/src/compiler/reparser.ts +7 -2
  329. package/src/compiler/scanner.ts +109 -79
  330. package/src/compiler/shared-results.ts +2414 -0
  331. package/src/compiler/show-config.ts +18 -1
  332. package/src/compiler/sourcemap.ts +2 -2
  333. package/src/compiler/symbol-accessibility.ts +26 -3
  334. package/src/compiler/symbol.ts +31 -14
  335. package/src/compiler/syntax-kind.ts +188 -187
  336. package/src/compiler/thread-entry.ts +19 -2
  337. package/src/compiler/transformers/alias-references.ts +123 -4
  338. package/src/compiler/transformers/async.ts +2 -17
  339. package/src/compiler/transformers/class-fields.ts +13 -12
  340. package/src/compiler/transformers/commonjs-module.ts +11 -7
  341. package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
  342. package/src/compiler/transformers/declarations-pseudo.ts +2 -4
  343. package/src/compiler/transformers/declarations-resolver.ts +0 -3
  344. package/src/compiler/transformers/declarations-syntactic.ts +1 -21
  345. package/src/compiler/transformers/declarations.ts +134 -48
  346. package/src/compiler/transformers/decorator-metadata.ts +9 -1
  347. package/src/compiler/transformers/destructuring.ts +4 -3
  348. package/src/compiler/transformers/external-module-info.ts +1 -1
  349. package/src/compiler/transformers/jsx.ts +2 -1
  350. package/src/compiler/transformers/reference-resolver.ts +83 -19
  351. package/src/compiler/transformers/runtime-syntax.ts +6 -1
  352. package/src/compiler/transformers/syntax-facts.ts +2 -7
  353. package/src/compiler/transformers/type-eraser.ts +10 -1
  354. package/src/compiler/transformers/type-serialization.ts +3 -2
  355. package/src/compiler/transformers/visitor-base.ts +2 -1
  356. package/src/compiler/transformers/visitor-hooks.ts +9 -4
  357. package/src/compiler/tsc-build.ts +3 -0
  358. package/src/compiler/tsc-cli.ts +2 -0
  359. package/src/compiler/tsc-compile.ts +7 -2
  360. package/src/compiler/tsc-watch.ts +74 -45
  361. package/src/compiler/tsconfig.ts +176 -19
  362. package/src/compiler/type-printer.ts +36 -2
  363. package/src/compiler/types.ts +2 -1
  364. package/src/library/ast.generated.ts +57 -41
  365. package/src/library/compiler-options.generated.ts +117 -103
  366. package/src/library/disk.ts +10 -1
  367. package/src/library/enums.generated.ts +196 -196
@@ -3,7 +3,7 @@
3
3
  //
4
4
  // Fields of `instanceof`-narrowed nodes are read through `as` casts: scriptc reads them
5
5
  // statically, but reads fields of a narrowed value dynamically.
6
- import { appendToList, BinaryExpression, CallExpression, ConditionalTypeNode, ElementAccessExpression, ExportAssignment, FunctionExpression, KeywordExpression, ModuleDeclaration, NodeVisitor, PatternAmbientModule, PrefixUnaryExpression, PropertyAccessExpression, ReferenceIdentifier, TypeAliasDeclaration, VariableDeclaration, getArguments, getBody, getElements, getExpression, getInitializer, getLabel, getLocals, getModifiers, getName, getParameters, getPostfixToken, getProperties, getStatements, getSymbol, getText, isDeclarationNode, isLocalsContainer, setEndFlowNode, setFlowNode, setLocalSymbol, setLocals, setNextContainer, setReturnFlowNode, setSymbol, callQuestionDotToken, callTypeArguments, } from './ast.js';
6
+ import { appendToList, BinaryExpression, CallExpression, ConditionalTypeNode, ElementAccessExpression, ExportAssignment, FunctionExpression, KeywordExpression, ModuleDeclaration, getNodeId, NodeVisitor, PatternAmbientModule, PrefixUnaryExpression, PropertyAccessExpression, ReferenceIdentifier, TypeAliasDeclaration, VariableDeclaration, getArguments, getBody, getElements, getExpression, getInitializer, getLabel, getLocals, getModifiers, getName, getParameters, getPostfixToken, getProperties, getStatements, getSymbol, getText, isDeclarationNode, isLocalsContainer, setEndFlowNode, setFlowNode, setLocalSymbol, setLocals, setNextContainer, setReturnFlowNode, setSymbol, callQuestionDotToken, callTypeArguments, } from './ast.js';
7
7
  import { isAmbientModule, isAssignmentOperator, isFunctionLike, isGlobalScopeAugmentation, isInJSFile, isLeftHandSideExpression, isRequireCall, isStringLiteralLike, nodeIsMissing, nodeIsPresent, } from './ast-utilities.js';
8
8
  import { declarationNameToString, expressionIsAlias, getAssignmentDeclarationKind, getCombinedModifierFlags, getContainingClass, getElementOrPropertyAccessName, getErrorRangeForNode, getImmediatelyInvokedFunctionExpression, getModuleInstanceState, StatementsByName, getNameOfDeclaration, getRangeOfTokenAtPosition, getSourceTextOfNode, hasDynamicName, hasSyntacticModifier, isAssignmentTarget, isAsyncFunction, isAutoAccessorPropertyDeclaration, isBlockOrCatchScoped, isBooleanLiteral, isDeclarationStatementKind, isDestructuringAssignment, isDottedName, isEntityNameExpression, isEnumConst, isExpandoInitializer, isExpressionOfOptionalChainRoot, isExternalModule, isExternalOrCommonJSModule, isIdentifierName, isImplicitlyExportedJSDocDeclaration, isInTopLevelContext, isJsonSourceFile, isLogicalExpression, isLogicalOrCoalescingAssignmentExpression, isLogicalOrCoalescingAssignmentOperator, isLogicalOrCoalescingBinaryOperator, isModuleAugmentationExternal, isNullishCoalesce, isObjectLiteralMethod, isObjectLiteralOrClassExpressionMethodOrAccessor, isOptionalChain, isOptionalChainRoot, isOutermostOptionalChain, isParameterPropertyDeclaration, isPartOfParameterDeclaration, isPartOfTypeQuery, isPotentiallyExecutableNode, isPrologueDirective, isPropertyNameLiteral, isPushOrUnshiftIdentifier, isSignedNumericLiteral, isStatic, isStringOrNumericLiteralLike, isVariableDeclarationInitializedToRequire, moduleExportNameIsDefault, nodeText, skipParentheses, } from './binder-utilities.js';
9
9
  import { Diagnostic } from './diagnostics.js';
@@ -13,26 +13,26 @@ import { getIdentifierToken, tokenToString } from './scanner.js';
13
13
  import { addDeclaration, copyDeclarations, declarationCount, getDeclarations, getExports, getMembers, getSymbolId, internalSymbolNamePrefix, Symbol, } from './symbol.js';
14
14
  export function getContainerFlags(node) {
15
15
  switch (node.kind) {
16
- case 232 /* SyntaxKind.ClassExpression */:
17
- case 264 /* SyntaxKind.ClassDeclaration */:
18
- case 267 /* SyntaxKind.EnumDeclaration */:
19
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
20
- case 188 /* SyntaxKind.TypeLiteral */:
21
- case 293 /* SyntaxKind.JsxAttributes */:
16
+ case 233 /* SyntaxKind.ClassExpression */:
17
+ case 265 /* SyntaxKind.ClassDeclaration */:
18
+ case 268 /* SyntaxKind.EnumDeclaration */:
19
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
20
+ case 189 /* SyntaxKind.TypeLiteral */:
21
+ case 294 /* SyntaxKind.JsxAttributes */:
22
22
  return 1 /* ContainerFlags.IsContainer */;
23
- case 265 /* SyntaxKind.InterfaceDeclaration */:
23
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
24
24
  return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */;
25
- case 268 /* SyntaxKind.ModuleDeclaration */:
26
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
27
- case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
28
- case 201 /* SyntaxKind.MappedType */:
29
- case 182 /* SyntaxKind.IndexSignature */:
25
+ case 269 /* SyntaxKind.ModuleDeclaration */:
26
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
27
+ case 346 /* SyntaxKind.JSTypeAliasDeclaration */:
28
+ case 202 /* SyntaxKind.MappedType */:
29
+ case 183 /* SyntaxKind.IndexSignature */:
30
30
  return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */;
31
- case 307 /* SyntaxKind.SourceFile */:
31
+ case 308 /* SyntaxKind.SourceFile */:
32
32
  return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */;
33
- case 178 /* SyntaxKind.GetAccessor */:
34
- case 179 /* SyntaxKind.SetAccessor */:
35
- case 175 /* SyntaxKind.MethodDeclaration */:
33
+ case 179 /* SyntaxKind.GetAccessor */:
34
+ case 180 /* SyntaxKind.SetAccessor */:
35
+ case 176 /* SyntaxKind.MethodDeclaration */:
36
36
  if (isObjectLiteralOrClassExpressionMethodOrAccessor(node))
37
37
  return (1 /* ContainerFlags.IsContainer */ |
38
38
  4 /* ContainerFlags.IsControlFlowContainer */ |
@@ -41,49 +41,49 @@ export function getContainerFlags(node) {
41
41
  128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */ |
42
42
  256 /* ContainerFlags.IsThisContainer */);
43
43
  return functionContainerFlags;
44
- case 177 /* SyntaxKind.Constructor */:
45
- case 263 /* SyntaxKind.FunctionDeclaration */:
46
- case 176 /* SyntaxKind.ClassStaticBlockDeclaration */:
44
+ case 178 /* SyntaxKind.Constructor */:
45
+ case 264 /* SyntaxKind.FunctionDeclaration */:
46
+ case 177 /* SyntaxKind.ClassStaticBlockDeclaration */:
47
47
  return functionContainerFlags;
48
- case 174 /* SyntaxKind.MethodSignature */:
49
- case 180 /* SyntaxKind.CallSignature */:
50
- case 185 /* SyntaxKind.FunctionType */:
51
- case 181 /* SyntaxKind.ConstructSignature */:
52
- case 186 /* SyntaxKind.ConstructorType */:
48
+ case 175 /* SyntaxKind.MethodSignature */:
49
+ case 181 /* SyntaxKind.CallSignature */:
50
+ case 186 /* SyntaxKind.FunctionType */:
51
+ case 182 /* SyntaxKind.ConstructSignature */:
52
+ case 187 /* SyntaxKind.ConstructorType */:
53
53
  return (1 /* ContainerFlags.IsContainer */ |
54
54
  4 /* ContainerFlags.IsControlFlowContainer */ |
55
55
  32 /* ContainerFlags.HasLocals */ |
56
56
  8 /* ContainerFlags.IsFunctionLike */ |
57
57
  512 /* ContainerFlags.PropagatesThisKeyword */);
58
- case 219 /* SyntaxKind.FunctionExpression */:
58
+ case 220 /* SyntaxKind.FunctionExpression */:
59
59
  return (1 /* ContainerFlags.IsContainer */ |
60
60
  4 /* ContainerFlags.IsControlFlowContainer */ |
61
61
  32 /* ContainerFlags.HasLocals */ |
62
62
  8 /* ContainerFlags.IsFunctionLike */ |
63
63
  16 /* ContainerFlags.IsFunctionExpression */ |
64
64
  256 /* ContainerFlags.IsThisContainer */);
65
- case 220 /* SyntaxKind.ArrowFunction */:
65
+ case 221 /* SyntaxKind.ArrowFunction */:
66
66
  return (1 /* ContainerFlags.IsContainer */ |
67
67
  4 /* ContainerFlags.IsControlFlowContainer */ |
68
68
  32 /* ContainerFlags.HasLocals */ |
69
69
  8 /* ContainerFlags.IsFunctionLike */ |
70
70
  16 /* ContainerFlags.IsFunctionExpression */ |
71
71
  512 /* ContainerFlags.PropagatesThisKeyword */);
72
- case 269 /* SyntaxKind.ModuleBlock */:
72
+ case 270 /* SyntaxKind.ModuleBlock */:
73
73
  return 4 /* ContainerFlags.IsControlFlowContainer */;
74
- case 173 /* SyntaxKind.PropertyDeclaration */:
74
+ case 174 /* SyntaxKind.PropertyDeclaration */:
75
75
  return getInitializer(node) !== undefined
76
76
  ? 4 /* ContainerFlags.IsControlFlowContainer */ | 256 /* ContainerFlags.IsThisContainer */
77
77
  : 0 /* ContainerFlags.None */;
78
- case 300 /* SyntaxKind.CatchClause */:
79
- case 249 /* SyntaxKind.ForStatement */:
80
- case 250 /* SyntaxKind.ForInStatement */:
81
- case 251 /* SyntaxKind.ForOfStatement */:
82
- case 270 /* SyntaxKind.CaseBlock */:
78
+ case 301 /* SyntaxKind.CatchClause */:
79
+ case 250 /* SyntaxKind.ForStatement */:
80
+ case 251 /* SyntaxKind.ForInStatement */:
81
+ case 252 /* SyntaxKind.ForOfStatement */:
82
+ case 271 /* SyntaxKind.CaseBlock */:
83
83
  return 2 /* ContainerFlags.IsBlockScopedContainer */ | 32 /* ContainerFlags.HasLocals */;
84
- case 242 /* SyntaxKind.Block */: {
84
+ case 243 /* SyntaxKind.Block */: {
85
85
  const parent = node.parent;
86
- return isFunctionLike(parent) || parent.kind === 176 /* SyntaxKind.ClassStaticBlockDeclaration */
86
+ return isFunctionLike(parent) || parent.kind === 177 /* SyntaxKind.ClassStaticBlockDeclaration */
87
87
  ? 0 /* ContainerFlags.None */
88
88
  : 2 /* ContainerFlags.IsBlockScopedContainer */ | 32 /* ContainerFlags.HasLocals */;
89
89
  }
@@ -148,17 +148,17 @@ export function setValueDeclaration(symbol, node) {
148
148
  }
149
149
  function isAssignmentDeclaration(declaration) {
150
150
  switch (declaration.kind) {
151
- case 227 /* SyntaxKind.BinaryExpression */:
152
- case 212 /* SyntaxKind.PropertyAccessExpression */:
153
- case 213 /* SyntaxKind.ElementAccessExpression */:
151
+ case 228 /* SyntaxKind.BinaryExpression */:
152
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
153
+ case 214 /* SyntaxKind.ElementAccessExpression */:
154
154
  case 79 /* SyntaxKind.Identifier */:
155
- case 214 /* SyntaxKind.CallExpression */:
155
+ case 215 /* SyntaxKind.CallExpression */:
156
156
  return true;
157
157
  }
158
158
  return false;
159
159
  }
160
160
  function isEffectiveModuleDeclaration(node) {
161
- return node.kind === 268 /* SyntaxKind.ModuleDeclaration */ || node.kind === 79 /* SyntaxKind.Identifier */;
161
+ return node.kind === 269 /* SyntaxKind.ModuleDeclaration */ || node.kind === 79 /* SyntaxKind.Identifier */;
162
162
  }
163
163
  class Binder extends NodeVisitor {
164
164
  file;
@@ -251,7 +251,7 @@ class Binder extends NodeVisitor {
251
251
  }
252
252
  declareSymbolEx(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) {
253
253
  const isDefaultExport = hasSyntacticModifier(node, 2048 /* ModifierFlags.Default */) ||
254
- (node.kind === 282 /* SyntaxKind.ExportSpecifier */ && moduleExportNameIsDefault(getName(node)));
254
+ (node.kind === 283 /* SyntaxKind.ExportSpecifier */ && moduleExportNameIsDefault(getName(node)));
255
255
  // The exported symbol of `export default function/class` is always named "default".
256
256
  const name = isComputedName
257
257
  ? "\uFFFEcomputed" /* InternalSymbolName.Computed */
@@ -298,18 +298,18 @@ class Binder extends NodeVisitor {
298
298
  }
299
299
  reportDuplicate(symbol, node, includes, isDefaultExport) {
300
300
  let message = (symbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) !== 0
301
- ? 619 /* Diagnostics.Cannot_redeclare_block_scoped_variable_0 */
302
- : 478 /* Diagnostics.Duplicate_identifier_0 */;
301
+ ? 626 /* Diagnostics.Cannot_redeclare_block_scoped_variable_0 */
302
+ : 485 /* Diagnostics.Duplicate_identifier_0 */;
303
303
  let messageNeedsName = true;
304
304
  if ((symbol.flags & 384 /* SymbolFlags.Enum */) !== 0 || (includes & 384 /* SymbolFlags.Enum */) !== 0) {
305
- message = 721 /* Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations */;
305
+ message = 728 /* Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations */;
306
306
  messageNeedsName = false;
307
307
  }
308
308
  let multipleDefaultExports = false;
309
309
  if (declarationCount(symbol) !== 0) {
310
310
  // A default export (by modifier, or `export default` assignment) after another one.
311
311
  if (isDefaultExport || (node instanceof ExportAssignment && !node.isExportEquals)) {
312
- message = 686 /* Diagnostics.A_module_cannot_have_multiple_default_exports */;
312
+ message = 693 /* Diagnostics.A_module_cannot_have_multiple_default_exports */;
313
313
  messageNeedsName = false;
314
314
  multipleDefaultExports = true;
315
315
  }
@@ -331,10 +331,10 @@ class Binder extends NodeVisitor {
331
331
  const decl = getNameOfDeclaration(declaration) ?? declaration;
332
332
  const d = this.createDiagnosticForNode(decl, message, messageNeedsName ? [this.getDisplayName(declaration)] : noArgs);
333
333
  if (multipleDefaultExports)
334
- d.addRelatedInfo(this.createDiagnosticForNode(declarationName, index === 0 ? 885 /* Diagnostics.Another_export_default_is_here */ : 1357 /* Diagnostics.X_and_here */, noArgs));
334
+ d.addRelatedInfo(this.createDiagnosticForNode(declarationName, index === 0 ? 892 /* Diagnostics.Another_export_default_is_here */ : 1368 /* Diagnostics.X_and_here */, noArgs));
335
335
  this.addDiagnostic(d);
336
336
  if (multipleDefaultExports)
337
- diagnostic.addRelatedInfo(this.createDiagnosticForNode(decl, 884 /* Diagnostics.The_first_export_default_is_here */, noArgs));
337
+ diagnostic.addRelatedInfo(this.createDiagnosticForNode(decl, 891 /* Diagnostics.The_first_export_default_is_here */, noArgs));
338
338
  }
339
339
  this.addDiagnostic(diagnostic);
340
340
  // An accessor conflicting with a non-accessor or the other accessor kind makes the symbol a
@@ -352,7 +352,14 @@ class Binder extends NodeVisitor {
352
352
  if (isAmbientModule(node)) {
353
353
  if (isGlobalScopeAugmentation(node))
354
354
  return "\uFFFEglobal" /* InternalSymbolName.Global */;
355
- return '"' + nodeText(name) + '"';
355
+ const moduleName = nodeText(name);
356
+ // A pattern module with import attributes has its own symbol, named after the attributes node's id: it merges
357
+ // only with pattern modules of the same pattern and identical attributes, which the checker decides. The id
358
+ // is written at a fixed width so that names sort in declaration order.
359
+ const attributes = node.attributes;
360
+ if (attributes !== undefined && hasSingleStar(moduleName))
361
+ return (internalSymbolNamePrefix + '"' + moduleName + '"pattern@' + String(getNodeId(attributes)).padStart(10, '0'));
362
+ return '"' + moduleName + '"';
356
363
  }
357
364
  if (name.kind === 80 /* SyntaxKind.PrivateIdentifier */) {
358
365
  // Private names are only allowed in classes; elsewhere there is already a parse error.
@@ -361,9 +368,9 @@ class Binder extends NodeVisitor {
361
368
  return "\uFFFEmissing" /* InternalSymbolName.Missing */;
362
369
  return getSymbolNameForPrivateIdentifier(getSymbol(containingClass), getText(name));
363
370
  }
364
- if (isPropertyNameLiteral(name) || name.kind === 296 /* SyntaxKind.JsxNamespacedName */)
371
+ if (isPropertyNameLiteral(name) || name.kind === 297 /* SyntaxKind.JsxNamespacedName */)
365
372
  return nodeText(name);
366
- if (name.kind === 168 /* SyntaxKind.ComputedPropertyName */) {
373
+ if (name.kind === 169 /* SyntaxKind.ComputedPropertyName */) {
367
374
  const expression = getExpression(name);
368
375
  // A literal computed name is just the literal.
369
376
  if (isStringOrNumericLiteralLike(expression))
@@ -377,20 +384,20 @@ class Binder extends NodeVisitor {
377
384
  return "\uFFFEmissing" /* InternalSymbolName.Missing */;
378
385
  }
379
386
  switch (node.kind) {
380
- case 177 /* SyntaxKind.Constructor */:
387
+ case 178 /* SyntaxKind.Constructor */:
381
388
  return "\uFFFEconstructor" /* InternalSymbolName.Constructor */;
382
- case 185 /* SyntaxKind.FunctionType */:
383
- case 180 /* SyntaxKind.CallSignature */:
389
+ case 186 /* SyntaxKind.FunctionType */:
390
+ case 181 /* SyntaxKind.CallSignature */:
384
391
  return "\uFFFEcall" /* InternalSymbolName.Call */;
385
- case 186 /* SyntaxKind.ConstructorType */:
386
- case 181 /* SyntaxKind.ConstructSignature */:
392
+ case 187 /* SyntaxKind.ConstructorType */:
393
+ case 182 /* SyntaxKind.ConstructSignature */:
387
394
  return "\uFFFEnew" /* InternalSymbolName.New */;
388
- case 182 /* SyntaxKind.IndexSignature */:
395
+ case 183 /* SyntaxKind.IndexSignature */:
389
396
  return "\uFFFEindex" /* InternalSymbolName.Index */;
390
- case 279 /* SyntaxKind.ExportDeclaration */:
397
+ case 280 /* SyntaxKind.ExportDeclaration */:
391
398
  return "\uFFFEexport" /* InternalSymbolName.ExportStar */;
392
- case 307 /* SyntaxKind.SourceFile */:
393
- case 227 /* SyntaxKind.BinaryExpression */:
399
+ case 308 /* SyntaxKind.SourceFile */:
400
+ case 228 /* SyntaxKind.BinaryExpression */:
394
401
  return "export=" /* InternalSymbolName.ExportEquals */;
395
402
  }
396
403
  return "\uFFFEmissing" /* InternalSymbolName.Missing */;
@@ -411,8 +418,8 @@ class Binder extends NodeVisitor {
411
418
  const container = this.container;
412
419
  const hasExportModifier = (getCombinedModifierFlags(node) & 32 /* ModifierFlags.Export */) !== 0 || isImplicitlyExportedJSDocDeclaration(node);
413
420
  if ((symbolFlags & 2097152 /* SymbolFlags.Alias */) !== 0) {
414
- if (node.kind === 282 /* SyntaxKind.ExportSpecifier */ ||
415
- (node.kind === 272 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) {
421
+ if (node.kind === 283 /* SyntaxKind.ExportSpecifier */ ||
422
+ (node.kind === 273 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) {
416
423
  const containerSymbol = getSymbol(container);
417
424
  return this.declareSymbol(getExports(containerSymbol), containerSymbol, node, symbolFlags, symbolExcludes);
418
425
  }
@@ -447,41 +454,41 @@ class Binder extends NodeVisitor {
447
454
  declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
448
455
  const container = this.container;
449
456
  switch (container.kind) {
450
- case 268 /* SyntaxKind.ModuleDeclaration */:
457
+ case 269 /* SyntaxKind.ModuleDeclaration */:
451
458
  return this.declareModuleMember(node, symbolFlags, symbolExcludes);
452
- case 307 /* SyntaxKind.SourceFile */:
459
+ case 308 /* SyntaxKind.SourceFile */:
453
460
  return this.declareSourceFileMember(node, symbolFlags, symbolExcludes);
454
- case 232 /* SyntaxKind.ClassExpression */:
455
- case 264 /* SyntaxKind.ClassDeclaration */:
461
+ case 233 /* SyntaxKind.ClassExpression */:
462
+ case 265 /* SyntaxKind.ClassDeclaration */:
456
463
  return this.declareClassMember(node, symbolFlags, symbolExcludes);
457
- case 267 /* SyntaxKind.EnumDeclaration */: {
464
+ case 268 /* SyntaxKind.EnumDeclaration */: {
458
465
  const enumSymbol = getSymbol(container);
459
466
  return this.declareSymbol(getExports(enumSymbol), enumSymbol, node, symbolFlags, symbolExcludes);
460
467
  }
461
- case 188 /* SyntaxKind.TypeLiteral */:
462
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
463
- case 265 /* SyntaxKind.InterfaceDeclaration */:
464
- case 293 /* SyntaxKind.JsxAttributes */: {
468
+ case 189 /* SyntaxKind.TypeLiteral */:
469
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
470
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
471
+ case 294 /* SyntaxKind.JsxAttributes */: {
465
472
  const containerSymbol = getSymbol(container);
466
473
  return this.declareSymbol(getMembers(containerSymbol), containerSymbol, node, symbolFlags, symbolExcludes);
467
474
  }
468
- case 185 /* SyntaxKind.FunctionType */:
469
- case 186 /* SyntaxKind.ConstructorType */:
470
- case 180 /* SyntaxKind.CallSignature */:
471
- case 181 /* SyntaxKind.ConstructSignature */:
472
- case 182 /* SyntaxKind.IndexSignature */:
473
- case 175 /* SyntaxKind.MethodDeclaration */:
474
- case 174 /* SyntaxKind.MethodSignature */:
475
- case 177 /* SyntaxKind.Constructor */:
476
- case 178 /* SyntaxKind.GetAccessor */:
477
- case 179 /* SyntaxKind.SetAccessor */:
478
- case 263 /* SyntaxKind.FunctionDeclaration */:
479
- case 219 /* SyntaxKind.FunctionExpression */:
480
- case 220 /* SyntaxKind.ArrowFunction */:
481
- case 176 /* SyntaxKind.ClassStaticBlockDeclaration */:
482
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
483
- case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
484
- case 201 /* SyntaxKind.MappedType */:
475
+ case 186 /* SyntaxKind.FunctionType */:
476
+ case 187 /* SyntaxKind.ConstructorType */:
477
+ case 181 /* SyntaxKind.CallSignature */:
478
+ case 182 /* SyntaxKind.ConstructSignature */:
479
+ case 183 /* SyntaxKind.IndexSignature */:
480
+ case 176 /* SyntaxKind.MethodDeclaration */:
481
+ case 175 /* SyntaxKind.MethodSignature */:
482
+ case 178 /* SyntaxKind.Constructor */:
483
+ case 179 /* SyntaxKind.GetAccessor */:
484
+ case 180 /* SyntaxKind.SetAccessor */:
485
+ case 264 /* SyntaxKind.FunctionDeclaration */:
486
+ case 220 /* SyntaxKind.FunctionExpression */:
487
+ case 221 /* SyntaxKind.ArrowFunction */:
488
+ case 177 /* SyntaxKind.ClassStaticBlockDeclaration */:
489
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
490
+ case 346 /* SyntaxKind.JSTypeAliasDeclaration */:
491
+ case 202 /* SyntaxKind.MappedType */:
485
492
  return this.declareSymbol(this.localsOf(container), undefined, node, symbolFlags, symbolExcludes);
486
493
  }
487
494
  throw new Error('Unhandled case in declareSymbolAndAddToSymbolTable');
@@ -519,9 +526,9 @@ class Binder extends NodeVisitor {
519
526
  bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
520
527
  const blockScopeContainer = this.blockScopeContainer;
521
528
  switch (blockScopeContainer.kind) {
522
- case 268 /* SyntaxKind.ModuleDeclaration */:
529
+ case 269 /* SyntaxKind.ModuleDeclaration */:
523
530
  return this.declareModuleMember(node, symbolFlags, symbolExcludes);
524
- case 307 /* SyntaxKind.SourceFile */:
531
+ case 308 /* SyntaxKind.SourceFile */:
525
532
  if (isExternalOrCommonJSModule(this.file))
526
533
  return this.declareModuleMember(node, symbolFlags, symbolExcludes);
527
534
  break;
@@ -564,22 +571,22 @@ class Binder extends NodeVisitor {
564
571
  if (node instanceof KeywordExpression)
565
572
  node.flowNode = this.currentFlowValue();
566
573
  break;
567
- case 167 /* SyntaxKind.QualifiedName */:
574
+ case 168 /* SyntaxKind.QualifiedName */:
568
575
  if (isPartOfTypeQuery(node))
569
576
  node.flowNode = this.currentFlowValue();
570
577
  break;
571
- case 237 /* SyntaxKind.MetaProperty */:
578
+ case 238 /* SyntaxKind.MetaProperty */:
572
579
  node.flowNode = this.currentFlowValue();
573
580
  break;
574
581
  case 80 /* SyntaxKind.PrivateIdentifier */:
575
582
  this.checkPrivateIdentifier(node);
576
583
  break;
577
- case 212 /* SyntaxKind.PropertyAccessExpression */:
578
- case 213 /* SyntaxKind.ElementAccessExpression */:
584
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
585
+ case 214 /* SyntaxKind.ElementAccessExpression */:
579
586
  if (isNarrowableReference(node))
580
587
  setFlowNode(node, this.currentFlowValue());
581
588
  break;
582
- case 227 /* SyntaxKind.BinaryExpression */:
589
+ case 228 /* SyntaxKind.BinaryExpression */:
583
590
  switch (getAssignmentDeclarationKind(node)) {
584
591
  case 1 /* JSDeclarationKind.ModuleExports */:
585
592
  this.bindModuleExportsAssignment(node);
@@ -596,103 +603,103 @@ class Binder extends NodeVisitor {
596
603
  }
597
604
  this.checkStrictModeBinaryExpression(node);
598
605
  break;
599
- case 300 /* SyntaxKind.CatchClause */:
606
+ case 301 /* SyntaxKind.CatchClause */:
600
607
  this.checkStrictModeCatchClause(node);
601
608
  break;
602
- case 221 /* SyntaxKind.DeleteExpression */:
609
+ case 222 /* SyntaxKind.DeleteExpression */:
603
610
  this.checkStrictModeDeleteExpression(node);
604
611
  break;
605
- case 226 /* SyntaxKind.PostfixUnaryExpression */:
612
+ case 227 /* SyntaxKind.PostfixUnaryExpression */:
606
613
  this.checkStrictModeEvalOrArguments(node, node.operand);
607
614
  break;
608
- case 225 /* SyntaxKind.PrefixUnaryExpression */: {
615
+ case 226 /* SyntaxKind.PrefixUnaryExpression */: {
609
616
  const operator = node.operator;
610
617
  if (operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */)
611
618
  this.checkStrictModeEvalOrArguments(node, node.operand);
612
619
  break;
613
620
  }
614
- case 255 /* SyntaxKind.WithStatement */:
621
+ case 256 /* SyntaxKind.WithStatement */:
615
622
  this.errorOnFirstToken(node, 70 /* Diagnostics.X_with_statements_are_not_allowed_in_strict_mode */, noArgs);
616
623
  break;
617
- case 257 /* SyntaxKind.LabeledStatement */: {
624
+ case 258 /* SyntaxKind.LabeledStatement */: {
618
625
  const statement = node.statement;
619
- if (isDeclarationStatementKind(statement.kind) || statement.kind === 244 /* SyntaxKind.VariableStatement */)
626
+ if (isDeclarationStatementKind(statement.kind) || statement.kind === 245 /* SyntaxKind.VariableStatement */)
620
627
  this.errorOnFirstToken(node.label, 278 /* Diagnostics.A_label_is_not_allowed_here */, noArgs);
621
628
  break;
622
629
  }
623
- case 198 /* SyntaxKind.ThisType */:
630
+ case 199 /* SyntaxKind.ThisType */:
624
631
  this.seenThisKeyword = true;
625
632
  break;
626
- case 169 /* SyntaxKind.TypeParameter */:
633
+ case 170 /* SyntaxKind.TypeParameter */:
627
634
  this.bindTypeParameter(node);
628
635
  break;
629
- case 170 /* SyntaxKind.Parameter */:
636
+ case 171 /* SyntaxKind.Parameter */:
630
637
  this.bindParameter(node);
631
638
  break;
632
- case 261 /* SyntaxKind.VariableDeclaration */:
639
+ case 262 /* SyntaxKind.VariableDeclaration */:
633
640
  this.bindVariableDeclarationOrBindingElement(node);
634
641
  break;
635
- case 209 /* SyntaxKind.BindingElement */:
642
+ case 210 /* SyntaxKind.BindingElement */:
636
643
  node.flowNode = this.currentFlowValue();
637
644
  this.bindVariableDeclarationOrBindingElement(node);
638
645
  break;
639
- case 173 /* SyntaxKind.PropertyDeclaration */:
640
- case 172 /* SyntaxKind.PropertySignature */: {
646
+ case 174 /* SyntaxKind.PropertyDeclaration */:
647
+ case 173 /* SyntaxKind.PropertySignature */: {
641
648
  const isAutoAccessor = isAutoAccessorPropertyDeclaration(node);
642
649
  this.bindPropertyOrMethodOrAccessor(node, (isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */) | optionalSymbolFlag(node), isAutoAccessor ? 111547 /* SymbolFlags.AccessorExcludes */ : 13243 /* SymbolFlags.PropertyExcludes */);
643
650
  break;
644
651
  }
645
- case 303 /* SyntaxKind.PropertyAssignment */:
646
- case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
652
+ case 304 /* SyntaxKind.PropertyAssignment */:
653
+ case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
647
654
  this.bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 13243 /* SymbolFlags.PropertyExcludes */);
648
655
  break;
649
- case 306 /* SyntaxKind.EnumMember */:
656
+ case 307 /* SyntaxKind.EnumMember */:
650
657
  this.bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */);
651
658
  break;
652
- case 180 /* SyntaxKind.CallSignature */:
653
- case 181 /* SyntaxKind.ConstructSignature */:
654
- case 182 /* SyntaxKind.IndexSignature */:
659
+ case 181 /* SyntaxKind.CallSignature */:
660
+ case 182 /* SyntaxKind.ConstructSignature */:
661
+ case 183 /* SyntaxKind.IndexSignature */:
655
662
  this.declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */);
656
663
  break;
657
- case 175 /* SyntaxKind.MethodDeclaration */:
658
- case 174 /* SyntaxKind.MethodSignature */:
664
+ case 176 /* SyntaxKind.MethodDeclaration */:
665
+ case 175 /* SyntaxKind.MethodSignature */:
659
666
  this.bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | optionalSymbolFlag(node), isObjectLiteralMethod(node) ? 111551 /* SymbolFlags.Value */ : 103359 /* SymbolFlags.MethodExcludes */);
660
667
  break;
661
- case 263 /* SyntaxKind.FunctionDeclaration */:
668
+ case 264 /* SyntaxKind.FunctionDeclaration */:
662
669
  this.bindFunctionDeclaration(node);
663
670
  break;
664
- case 177 /* SyntaxKind.Constructor */:
671
+ case 178 /* SyntaxKind.Constructor */:
665
672
  this.declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, 0 /* SymbolFlags.None */);
666
673
  break;
667
- case 178 /* SyntaxKind.GetAccessor */:
674
+ case 179 /* SyntaxKind.GetAccessor */:
668
675
  this.bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46011 /* SymbolFlags.GetAccessorExcludes */);
669
676
  break;
670
- case 179 /* SyntaxKind.SetAccessor */:
677
+ case 180 /* SyntaxKind.SetAccessor */:
671
678
  this.bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78779 /* SymbolFlags.SetAccessorExcludes */);
672
679
  break;
673
- case 185 /* SyntaxKind.FunctionType */:
674
- case 186 /* SyntaxKind.ConstructorType */:
680
+ case 186 /* SyntaxKind.FunctionType */:
681
+ case 187 /* SyntaxKind.ConstructorType */:
675
682
  this.bindFunctionOrConstructorType(node);
676
683
  break;
677
- case 188 /* SyntaxKind.TypeLiteral */:
678
- case 201 /* SyntaxKind.MappedType */:
684
+ case 189 /* SyntaxKind.TypeLiteral */:
685
+ case 202 /* SyntaxKind.MappedType */:
679
686
  this.bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "\uFFFEtype" /* InternalSymbolName.Type */);
680
687
  break;
681
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
688
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
682
689
  this.bindAnonymousDeclaration(node, 4096 /* SymbolFlags.ObjectLiteral */, "\uFFFEobject" /* InternalSymbolName.Object */);
683
690
  break;
684
- case 219 /* SyntaxKind.FunctionExpression */:
685
- case 220 /* SyntaxKind.ArrowFunction */:
691
+ case 220 /* SyntaxKind.FunctionExpression */:
692
+ case 221 /* SyntaxKind.ArrowFunction */:
686
693
  this.bindFunctionExpression(node);
687
694
  break;
688
- case 232 /* SyntaxKind.ClassExpression */:
689
- case 264 /* SyntaxKind.ClassDeclaration */:
695
+ case 233 /* SyntaxKind.ClassExpression */:
696
+ case 265 /* SyntaxKind.ClassDeclaration */:
690
697
  this.bindClassLikeDeclaration(node);
691
698
  break;
692
- case 265 /* SyntaxKind.InterfaceDeclaration */:
699
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
693
700
  this.bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */);
694
701
  break;
695
- case 214 /* SyntaxKind.CallExpression */:
702
+ case 215 /* SyntaxKind.CallExpression */:
696
703
  switch (getAssignmentDeclarationKind(node)) {
697
704
  case 5 /* JSDeclarationKind.ObjectDefinePropertyValue */:
698
705
  this.bindExpandoPropertyAssignment(node);
@@ -705,55 +712,55 @@ class Binder extends NodeVisitor {
705
712
  if (isInJSFile(node) && this.file.commonJSModuleIndicator === undefined && isRequireCall(node, false))
706
713
  this.setCommonJSModuleIndicator(node);
707
714
  break;
708
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
715
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
709
716
  this.bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */);
710
717
  break;
711
- case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
718
+ case 346 /* SyntaxKind.JSTypeAliasDeclaration */:
712
719
  // Top-level ones are bound by bindContainer, after CommonJS module indicators.
713
- if (this.blockScopeContainer.kind !== 307 /* SyntaxKind.SourceFile */)
720
+ if (this.blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */)
714
721
  this.bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */);
715
722
  break;
716
- case 267 /* SyntaxKind.EnumDeclaration */:
723
+ case 268 /* SyntaxKind.EnumDeclaration */:
717
724
  if (isEnumConst(node))
718
725
  this.bindBlockScopedDeclaration(node, 128 /* SymbolFlags.ConstEnum */, 899967 /* SymbolFlags.ConstEnumExcludes */);
719
726
  else
720
727
  this.bindBlockScopedDeclaration(node, 256 /* SymbolFlags.RegularEnum */, 899327 /* SymbolFlags.RegularEnumExcludes */);
721
728
  break;
722
- case 268 /* SyntaxKind.ModuleDeclaration */:
729
+ case 269 /* SyntaxKind.ModuleDeclaration */:
723
730
  this.bindModuleDeclaration(node);
724
731
  break;
725
- case 272 /* SyntaxKind.ImportEqualsDeclaration */:
726
- case 275 /* SyntaxKind.NamespaceImport */:
727
- case 277 /* SyntaxKind.ImportSpecifier */:
728
- case 282 /* SyntaxKind.ExportSpecifier */:
732
+ case 273 /* SyntaxKind.ImportEqualsDeclaration */:
733
+ case 276 /* SyntaxKind.NamespaceImport */:
734
+ case 278 /* SyntaxKind.ImportSpecifier */:
735
+ case 283 /* SyntaxKind.ExportSpecifier */:
729
736
  this.declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */);
730
737
  break;
731
- case 271 /* SyntaxKind.NamespaceExportDeclaration */:
738
+ case 272 /* SyntaxKind.NamespaceExportDeclaration */:
732
739
  this.bindNamespaceExportDeclaration(node);
733
740
  break;
734
- case 274 /* SyntaxKind.ImportClause */:
741
+ case 275 /* SyntaxKind.ImportClause */:
735
742
  if (node.name !== undefined)
736
743
  this.declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */);
737
744
  break;
738
- case 279 /* SyntaxKind.ExportDeclaration */:
745
+ case 280 /* SyntaxKind.ExportDeclaration */:
739
746
  this.bindExportDeclaration(node);
740
747
  break;
741
- case 278 /* SyntaxKind.ExportAssignment */:
748
+ case 279 /* SyntaxKind.ExportAssignment */:
742
749
  this.bindExportAssignment(node);
743
750
  break;
744
- case 307 /* SyntaxKind.SourceFile */:
751
+ case 308 /* SyntaxKind.SourceFile */:
745
752
  this.bindSourceFileIfExternalModule(node);
746
753
  break;
747
- case 293 /* SyntaxKind.JsxAttributes */:
754
+ case 294 /* SyntaxKind.JsxAttributes */:
748
755
  this.bindAnonymousDeclaration(node, 4096 /* SymbolFlags.ObjectLiteral */, "\uFFFEjsxAttributes" /* InternalSymbolName.JSXAttributes */);
749
756
  break;
750
- case 292 /* SyntaxKind.JsxAttribute */:
757
+ case 293 /* SyntaxKind.JsxAttribute */:
751
758
  this.declareSymbolAndAddToSymbolTable(node, 4 /* SymbolFlags.Property */, 13243 /* SymbolFlags.PropertyExcludes */);
752
759
  break;
753
760
  }
754
761
  // Then bind the children, tracking the current container. Tokens have no children.
755
762
  let thisNodeOrAnySubnodesHasError = (node.flags & 32768 /* NodeFlags.ThisNodeHasError */) !== 0;
756
- if (node.kind > 166 /* SyntaxKind.LastToken */) {
763
+ if (node.kind > 167 /* SyntaxKind.LastToken */) {
757
764
  const saveSeenParseError = this.seenParseError;
758
765
  this.seenParseError = false;
759
766
  const containerFlags = getContainerFlags(node);
@@ -806,7 +813,7 @@ class Binder extends NodeVisitor {
806
813
  }
807
814
  else
808
815
  this.bindChildren(node);
809
- if (node.kind === 307 /* SyntaxKind.SourceFile */)
816
+ if (node.kind === 308 /* SyntaxKind.SourceFile */)
810
817
  this.finishSourceFile(node);
811
818
  else if (isAmbientModule(node))
812
819
  this.bindCommonJSTypeExports(getSymbol(node));
@@ -829,7 +836,7 @@ class Binder extends NodeVisitor {
829
836
  !hasSyntacticModifier(node, 1024 /* ModifierFlags.Async */) &&
830
837
  !isGeneratorFunctionExpression(node) &&
831
838
  getImmediatelyInvokedFunctionExpression(node) !== undefined) ||
832
- node.kind === 176 /* SyntaxKind.ClassStaticBlockDeclaration */;
839
+ node.kind === 177 /* SyntaxKind.ClassStaticBlockDeclaration */;
833
840
  if (!isImmediatelyInvoked) {
834
841
  const flowStart = new FlowNode(2 /* FlowFlags.Start */, undefined, undefined);
835
842
  this.currentFlow = flowStart;
@@ -840,7 +847,7 @@ class Binder extends NodeVisitor {
840
847
  }
841
848
  // IIFEs and constructors get a return graph; constructors use it to check property initialization.
842
849
  this.currentReturnTarget =
843
- isImmediatelyInvoked || node.kind === 177 /* SyntaxKind.Constructor */ ? this.createBranchLabel() : undefined;
850
+ isImmediatelyInvoked || node.kind === 178 /* SyntaxKind.Constructor */ ? this.createBranchLabel() : undefined;
844
851
  this.currentExceptionTarget = undefined;
845
852
  this.currentBreakTarget = undefined;
846
853
  this.currentContinueTarget = undefined;
@@ -851,7 +858,7 @@ class Binder extends NodeVisitor {
851
858
  node.flags &= ~(262912 /* NodeFlags.ReachabilityAndEmitFlags */ | 128 /* NodeFlags.ContainsThis */);
852
859
  if ((this.currentFlow.flags & 1 /* FlowFlags.Unreachable */) === 0 &&
853
860
  (containerFlags & 8 /* ContainerFlags.IsFunctionLike */) !== 0 &&
854
- node.kind !== 176 /* SyntaxKind.ClassStaticBlockDeclaration */ &&
861
+ node.kind !== 177 /* SyntaxKind.ClassStaticBlockDeclaration */ &&
855
862
  nodeIsPresent(getBody(node))) {
856
863
  node.flags |= 256 /* NodeFlags.HasImplicitReturn */;
857
864
  if (this.hasExplicitReturn)
@@ -860,15 +867,14 @@ class Binder extends NodeVisitor {
860
867
  }
861
868
  if (this.seenThisKeyword)
862
869
  node.flags |= 128 /* NodeFlags.ContainsThis */;
863
- if (node.kind === 307 /* SyntaxKind.SourceFile */) {
870
+ if (node.kind === 308 /* SyntaxKind.SourceFile */) {
864
871
  node.flags |= this.emitFlags;
865
- node.endFlowNode = this.currentFlow;
866
872
  }
867
873
  const returnTarget = this.currentReturnTarget;
868
874
  if (returnTarget !== undefined) {
869
875
  this.addAntecedent(returnTarget, this.currentFlow);
870
876
  this.currentFlow = this.finishFlowLabel(returnTarget);
871
- if (node.kind === 177 /* SyntaxKind.Constructor */ || node.kind === 176 /* SyntaxKind.ClassStaticBlockDeclaration */)
877
+ if (node.kind === 178 /* SyntaxKind.Constructor */ || node.kind === 177 /* SyntaxKind.ClassStaticBlockDeclaration */)
872
878
  setReturnFlowNode(node, this.currentFlow);
873
879
  }
874
880
  if (!isImmediatelyInvoked)
@@ -888,7 +894,7 @@ class Binder extends NodeVisitor {
888
894
  if (isInJSFile(file)) {
889
895
  // Top-level @typedef aliases wait until CommonJS module indicators are known.
890
896
  for (const statement of file.statements.nodes)
891
- if (statement.kind === 345 /* SyntaxKind.JSTypeAliasDeclaration */)
897
+ if (statement.kind === 346 /* SyntaxKind.JSTypeAliasDeclaration */)
892
898
  this.bindBlockScopedDeclaration(statement, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */);
893
899
  if (file.commonJSModuleIndicator !== undefined) {
894
900
  this.declareCommonJSVariable('module');
@@ -932,26 +938,26 @@ class Binder extends NodeVisitor {
932
938
  this.inAssignmentPattern = saveInAssignmentPattern;
933
939
  return;
934
940
  }
935
- if (node.kind >= 244 /* SyntaxKind.FirstStatement */ && node.kind <= 260 /* SyntaxKind.LastStatement */)
941
+ if (node.kind >= 245 /* SyntaxKind.FirstStatement */ && node.kind <= 261 /* SyntaxKind.LastStatement */)
936
942
  setFlowNode(node, this.currentFlowValue());
937
943
  switch (node.kind) {
938
- case 248 /* SyntaxKind.WhileStatement */:
944
+ case 249 /* SyntaxKind.WhileStatement */:
939
945
  this.bindWhileStatement(node);
940
946
  break;
941
- case 247 /* SyntaxKind.DoStatement */:
947
+ case 248 /* SyntaxKind.DoStatement */:
942
948
  this.bindDoStatement(node);
943
949
  break;
944
- case 249 /* SyntaxKind.ForStatement */:
950
+ case 250 /* SyntaxKind.ForStatement */:
945
951
  this.bindForStatement(node);
946
952
  break;
947
- case 250 /* SyntaxKind.ForInStatement */:
948
- case 251 /* SyntaxKind.ForOfStatement */:
953
+ case 251 /* SyntaxKind.ForInStatement */:
954
+ case 252 /* SyntaxKind.ForOfStatement */:
949
955
  this.bindForInOrForOfStatement(node);
950
956
  break;
951
- case 246 /* SyntaxKind.IfStatement */:
957
+ case 247 /* SyntaxKind.IfStatement */:
952
958
  this.bindIfStatement(node);
953
959
  break;
954
- case 254 /* SyntaxKind.ReturnStatement */:
960
+ case 255 /* SyntaxKind.ReturnStatement */:
955
961
  this.bindOptional(getExpression(node));
956
962
  if (this.currentReturnTarget !== undefined)
957
963
  this.addAntecedent(this.currentReturnTarget, this.currentFlow);
@@ -959,50 +965,50 @@ class Binder extends NodeVisitor {
959
965
  this.hasExplicitReturn = true;
960
966
  this.hasFlowEffects = true;
961
967
  break;
962
- case 258 /* SyntaxKind.ThrowStatement */:
968
+ case 259 /* SyntaxKind.ThrowStatement */:
963
969
  this.bindOptional(getExpression(node));
964
970
  this.currentFlow = this.unreachableFlow;
965
971
  this.hasFlowEffects = true;
966
972
  break;
967
- case 253 /* SyntaxKind.BreakStatement */:
973
+ case 254 /* SyntaxKind.BreakStatement */:
968
974
  this.bindBreakOrContinueStatement(getLabel(node), true);
969
975
  break;
970
- case 252 /* SyntaxKind.ContinueStatement */:
976
+ case 253 /* SyntaxKind.ContinueStatement */:
971
977
  this.bindBreakOrContinueStatement(getLabel(node), false);
972
978
  break;
973
- case 259 /* SyntaxKind.TryStatement */:
979
+ case 260 /* SyntaxKind.TryStatement */:
974
980
  this.bindTryStatement(node);
975
981
  break;
976
- case 256 /* SyntaxKind.SwitchStatement */:
982
+ case 257 /* SyntaxKind.SwitchStatement */:
977
983
  this.bindSwitchStatement(node);
978
984
  break;
979
- case 270 /* SyntaxKind.CaseBlock */:
985
+ case 271 /* SyntaxKind.CaseBlock */:
980
986
  this.bindCaseBlock(node);
981
987
  break;
982
- case 297 /* SyntaxKind.CaseClause */:
983
- case 298 /* SyntaxKind.DefaultClause */:
988
+ case 298 /* SyntaxKind.CaseClause */:
989
+ case 299 /* SyntaxKind.DefaultClause */:
984
990
  this.bindCaseOrDefaultClause(node);
985
991
  break;
986
- case 245 /* SyntaxKind.ExpressionStatement */: {
992
+ case 246 /* SyntaxKind.ExpressionStatement */: {
987
993
  const expression = node.expression;
988
994
  this.bind(expression);
989
995
  this.maybeBindExpressionFlowIfCall(expression);
990
996
  break;
991
997
  }
992
- case 257 /* SyntaxKind.LabeledStatement */:
998
+ case 258 /* SyntaxKind.LabeledStatement */:
993
999
  this.bindLabeledStatement(node);
994
1000
  break;
995
- case 225 /* SyntaxKind.PrefixUnaryExpression */:
1001
+ case 226 /* SyntaxKind.PrefixUnaryExpression */:
996
1002
  this.bindPrefixUnaryExpressionFlow(node);
997
1003
  break;
998
- case 226 /* SyntaxKind.PostfixUnaryExpression */: {
1004
+ case 227 /* SyntaxKind.PostfixUnaryExpression */: {
999
1005
  node.forEachChild(this);
1000
1006
  const operator = node.operator;
1001
1007
  if (operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */)
1002
1008
  this.bindAssignmentTargetFlow(node.operand);
1003
1009
  break;
1004
1010
  }
1005
- case 227 /* SyntaxKind.BinaryExpression */:
1011
+ case 228 /* SyntaxKind.BinaryExpression */:
1006
1012
  if (isDestructuringAssignment(node)) {
1007
1013
  // Carry the assignment pattern state into initializers of the pattern.
1008
1014
  this.inAssignmentPattern = saveInAssignmentPattern;
@@ -1011,40 +1017,40 @@ class Binder extends NodeVisitor {
1011
1017
  }
1012
1018
  this.bindBinaryExpressionFlow(node);
1013
1019
  break;
1014
- case 221 /* SyntaxKind.DeleteExpression */:
1020
+ case 222 /* SyntaxKind.DeleteExpression */:
1015
1021
  node.forEachChild(this);
1016
- if (node.expression.kind === 212 /* SyntaxKind.PropertyAccessExpression */)
1022
+ if (node.expression.kind === 213 /* SyntaxKind.PropertyAccessExpression */)
1017
1023
  this.bindAssignmentTargetFlow(node.expression);
1018
1024
  break;
1019
- case 228 /* SyntaxKind.ConditionalExpression */:
1025
+ case 229 /* SyntaxKind.ConditionalExpression */:
1020
1026
  this.bindConditionalExpressionFlow(node);
1021
1027
  break;
1022
- case 261 /* SyntaxKind.VariableDeclaration */:
1028
+ case 262 /* SyntaxKind.VariableDeclaration */:
1023
1029
  node.forEachChild(this);
1024
1030
  if (node.initializer !== undefined ||
1025
1031
  isForInOrOfStatementKind(node.parent.parent.kind))
1026
1032
  this.bindInitializedVariableFlow(node);
1027
1033
  break;
1028
- case 212 /* SyntaxKind.PropertyAccessExpression */:
1029
- case 213 /* SyntaxKind.ElementAccessExpression */:
1030
- case 236 /* SyntaxKind.NonNullExpression */:
1034
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
1035
+ case 214 /* SyntaxKind.ElementAccessExpression */:
1036
+ case 237 /* SyntaxKind.NonNullExpression */:
1031
1037
  if (isOptionalChain(node))
1032
1038
  this.bindOptionalChainFlow(node);
1033
1039
  else
1034
1040
  node.forEachChild(this);
1035
1041
  break;
1036
- case 214 /* SyntaxKind.CallExpression */:
1042
+ case 215 /* SyntaxKind.CallExpression */:
1037
1043
  this.bindCallExpressionFlow(node);
1038
1044
  break;
1039
- case 307 /* SyntaxKind.SourceFile */:
1045
+ case 308 /* SyntaxKind.SourceFile */:
1040
1046
  this.bindEachStatementFunctionsFirst(node.statements);
1041
1047
  this.bind(node.endOfFileToken);
1042
1048
  break;
1043
- case 242 /* SyntaxKind.Block */:
1044
- case 269 /* SyntaxKind.ModuleBlock */:
1049
+ case 243 /* SyntaxKind.Block */:
1050
+ case 270 /* SyntaxKind.ModuleBlock */:
1045
1051
  this.bindEachStatementFunctionsFirst(getStatements(node));
1046
1052
  break;
1047
- case 209 /* SyntaxKind.BindingElement */: {
1053
+ case 210 /* SyntaxKind.BindingElement */: {
1048
1054
  // The initializer runs before the binding pattern.
1049
1055
  const element = node;
1050
1056
  this.bindOptional(element.dotDotDotToken);
@@ -1053,7 +1059,7 @@ class Binder extends NodeVisitor {
1053
1059
  this.bindOptional(element.name);
1054
1060
  break;
1055
1061
  }
1056
- case 170 /* SyntaxKind.Parameter */: {
1062
+ case 171 /* SyntaxKind.Parameter */: {
1057
1063
  const parameter = node;
1058
1064
  this.bindNodes(parameter.modifiers);
1059
1065
  this.bindOptional(parameter.dotDotDotToken);
@@ -1063,10 +1069,10 @@ class Binder extends NodeVisitor {
1063
1069
  this.bind(parameter.name);
1064
1070
  break;
1065
1071
  }
1066
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
1067
- case 210 /* SyntaxKind.ArrayLiteralExpression */:
1068
- case 303 /* SyntaxKind.PropertyAssignment */:
1069
- case 231 /* SyntaxKind.SpreadElement */:
1072
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
1073
+ case 211 /* SyntaxKind.ArrayLiteralExpression */:
1074
+ case 304 /* SyntaxKind.PropertyAssignment */:
1075
+ case 232 /* SyntaxKind.SpreadElement */:
1070
1076
  this.inAssignmentPattern = saveInAssignmentPattern;
1071
1077
  node.forEachChild(this);
1072
1078
  break;
@@ -1085,10 +1091,10 @@ class Binder extends NodeVisitor {
1085
1091
  bindEachStatementFunctionsFirst(statements) {
1086
1092
  const nodes = statements.nodes;
1087
1093
  for (let i = 0; i < nodes.length; i++)
1088
- if (nodes[i].kind === 263 /* SyntaxKind.FunctionDeclaration */)
1094
+ if (nodes[i].kind === 264 /* SyntaxKind.FunctionDeclaration */)
1089
1095
  this.bind(nodes[i]);
1090
1096
  for (let i = 0; i < nodes.length; i++)
1091
- if (nodes[i].kind !== 263 /* SyntaxKind.FunctionDeclaration */)
1097
+ if (nodes[i].kind !== 264 /* SyntaxKind.FunctionDeclaration */)
1092
1098
  this.bind(nodes[i]);
1093
1099
  }
1094
1100
  // Flow graph
@@ -1156,7 +1162,7 @@ class Binder extends NodeVisitor {
1156
1162
  setContinueTarget(node, target) {
1157
1163
  let label = this.activeLabelList;
1158
1164
  let current = node;
1159
- while (label !== undefined && current.parent.kind === 257 /* SyntaxKind.LabeledStatement */) {
1165
+ while (label !== undefined && current.parent.kind === 258 /* SyntaxKind.LabeledStatement */) {
1160
1166
  label.continueTarget = target;
1161
1167
  label = label.next;
1162
1168
  current = current.parent;
@@ -1194,24 +1200,24 @@ class Binder extends NodeVisitor {
1194
1200
  }
1195
1201
  bindAssignmentTargetFlow(node) {
1196
1202
  switch (node.kind) {
1197
- case 210 /* SyntaxKind.ArrayLiteralExpression */:
1203
+ case 211 /* SyntaxKind.ArrayLiteralExpression */:
1198
1204
  for (const element of getElements(node).nodes) {
1199
- if (element.kind === 231 /* SyntaxKind.SpreadElement */)
1205
+ if (element.kind === 232 /* SyntaxKind.SpreadElement */)
1200
1206
  this.bindAssignmentTargetFlow(getExpression(element));
1201
1207
  else
1202
1208
  this.bindDestructuringTargetFlow(element);
1203
1209
  }
1204
1210
  break;
1205
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
1211
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
1206
1212
  for (const property of getProperties(node).nodes) {
1207
1213
  switch (property.kind) {
1208
- case 303 /* SyntaxKind.PropertyAssignment */:
1214
+ case 304 /* SyntaxKind.PropertyAssignment */:
1209
1215
  this.bindDestructuringTargetFlow(getInitializer(property));
1210
1216
  break;
1211
- case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
1217
+ case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
1212
1218
  this.bindAssignmentTargetFlow(getName(property));
1213
1219
  break;
1214
- case 305 /* SyntaxKind.SpreadAssignment */:
1220
+ case 306 /* SyntaxKind.SpreadAssignment */:
1215
1221
  this.bindAssignmentTargetFlow(getExpression(property));
1216
1222
  break;
1217
1223
  }
@@ -1253,11 +1259,19 @@ class Binder extends NodeVisitor {
1253
1259
  this.currentFlow = this.finishFlowLabel(postDoLabel);
1254
1260
  }
1255
1261
  bindForStatement(node) {
1262
+ this.bindOptional(node.initializer);
1263
+ if (this.currentFlow === this.unreachableFlow) {
1264
+ // An initializer that ends the flow (a throwing IIFE) would leave the loop label only the
1265
+ // incrementor's back edge: a cycle with no entry. Bind the rest as unreachable.
1266
+ this.bindOptional(node.condition);
1267
+ this.bind(node.statement);
1268
+ this.bindOptional(node.incrementor);
1269
+ return;
1270
+ }
1256
1271
  const preLoopLabel = this.setContinueTarget(node, this.createLoopLabel());
1257
1272
  const preBodyLabel = this.createBranchLabel();
1258
1273
  const preIncrementorLabel = this.createBranchLabel();
1259
1274
  const postLoopLabel = this.createBranchLabel();
1260
- this.bindOptional(node.initializer);
1261
1275
  this.addAntecedent(preLoopLabel, this.currentFlow);
1262
1276
  this.currentFlow = preLoopLabel;
1263
1277
  this.bindCondition(node.condition, preBodyLabel, postLoopLabel);
@@ -1270,16 +1284,22 @@ class Binder extends NodeVisitor {
1270
1284
  this.currentFlow = this.finishFlowLabel(postLoopLabel);
1271
1285
  }
1272
1286
  bindForInOrForOfStatement(node) {
1287
+ this.bind(node.expression);
1288
+ if (this.currentFlow === this.unreachableFlow) {
1289
+ // As for a `for` initializer: an expression that ends the flow leaves the loop unreachable.
1290
+ this.bind(node.initializer);
1291
+ this.bind(node.statement);
1292
+ return;
1293
+ }
1273
1294
  const preLoopLabel = this.setContinueTarget(node, this.createLoopLabel());
1274
1295
  const postLoopLabel = this.createBranchLabel();
1275
- this.bind(node.expression);
1276
1296
  this.addAntecedent(preLoopLabel, this.currentFlow);
1277
1297
  this.currentFlow = preLoopLabel;
1278
- if (node.kind === 251 /* SyntaxKind.ForOfStatement */)
1298
+ if (node.kind === 252 /* SyntaxKind.ForOfStatement */)
1279
1299
  this.bindOptional(node.awaitModifier);
1280
1300
  this.addAntecedent(postLoopLabel, this.currentFlow);
1281
1301
  this.bind(node.initializer);
1282
- if (node.initializer.kind !== 262 /* SyntaxKind.VariableDeclarationList */)
1302
+ if (node.initializer.kind !== 263 /* SyntaxKind.VariableDeclarationList */)
1283
1303
  this.bindAssignmentTargetFlow(node.initializer);
1284
1304
  this.bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
1285
1305
  this.addAntecedent(preLoopLabel, this.currentFlow);
@@ -1388,7 +1408,7 @@ class Binder extends NodeVisitor {
1388
1408
  this.addAntecedent(postSwitchLabel, this.currentFlow);
1389
1409
  let hasDefault = false;
1390
1410
  for (const clause of node.caseBlock.clauses.nodes)
1391
- if (clause.kind === 298 /* SyntaxKind.DefaultClause */)
1411
+ if (clause.kind === 299 /* SyntaxKind.DefaultClause */)
1392
1412
  hasDefault = true;
1393
1413
  if (!hasDefault)
1394
1414
  this.addAntecedent(postSwitchLabel, this.createFlowSwitchClause(this.preSwitchCaseFlow, node, 0, 0));
@@ -1562,7 +1582,7 @@ class Binder extends NodeVisitor {
1562
1582
  bindInitializedVariableFlow(node) {
1563
1583
  const name = getName(node);
1564
1584
  if (name !== undefined &&
1565
- (name.kind === 207 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 208 /* SyntaxKind.ArrayBindingPattern */)) {
1585
+ (name.kind === 208 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 209 /* SyntaxKind.ArrayBindingPattern */)) {
1566
1586
  for (const element of getElements(name).nodes)
1567
1587
  this.bindInitializedVariableFlow(element);
1568
1588
  }
@@ -1630,7 +1650,7 @@ class Binder extends NodeVisitor {
1630
1650
  else {
1631
1651
  // An IIFE's flow node includes the evaluation of its arguments.
1632
1652
  const callee = skipParentheses(node.expression);
1633
- if (callee.kind === 219 /* SyntaxKind.FunctionExpression */ || callee.kind === 220 /* SyntaxKind.ArrowFunction */) {
1653
+ if (callee.kind === 220 /* SyntaxKind.FunctionExpression */ || callee.kind === 221 /* SyntaxKind.ArrowFunction */) {
1634
1654
  this.bindNodes(callTypeArguments(node));
1635
1655
  this.bindNodes(node.arguments);
1636
1656
  this.bind(node.expression);
@@ -1684,7 +1704,7 @@ class Binder extends NodeVisitor {
1684
1704
  this.setExportContextFlag(node);
1685
1705
  if (isAmbientModule(node)) {
1686
1706
  if (hasSyntacticModifier(node, 32 /* ModifierFlags.Export */))
1687
- this.errorOnFirstToken(node, 802 /* Diagnostics.X_export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible */, noArgs);
1707
+ this.errorOnFirstToken(node, 809 /* Diagnostics.X_export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible */, noArgs);
1688
1708
  if (isModuleAugmentationExternal(node)) {
1689
1709
  this.declareModuleSymbol(node);
1690
1710
  return;
@@ -1695,9 +1715,11 @@ class Binder extends NodeVisitor {
1695
1715
  const text = getText(name);
1696
1716
  const starIndex = text.indexOf('*');
1697
1717
  if (starIndex >= 0 && text.indexOf('*', starIndex + 1) >= 0)
1698
- this.errorOnFirstToken(name, 1136 /* Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character */, [text]);
1718
+ this.errorOnFirstToken(name, 1143 /* Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character */, [text]);
1699
1719
  else if (starIndex >= 0)
1700
1720
  this.file.patternAmbientModules = appendToList(this.file.patternAmbientModules, new PatternAmbientModule(text, starIndex, symbol));
1721
+ else if (node.attributes !== undefined)
1722
+ this.errorOnNode(name, 463 /* Diagnostics.An_ambient_module_declaration_with_import_attributes_must_use_a_pattern_name_with_an_Asterisk_character */, noArgs);
1701
1723
  }
1702
1724
  return;
1703
1725
  }
@@ -1726,7 +1748,7 @@ class Binder extends NodeVisitor {
1726
1748
  const parent = node.parent;
1727
1749
  if (getModifiers(node) !== undefined)
1728
1750
  this.errorOnNode(node, 140 /* Diagnostics.Modifiers_cannot_appear_here */, noArgs);
1729
- if (parent.kind !== 307 /* SyntaxKind.SourceFile */)
1751
+ if (parent.kind !== 308 /* SyntaxKind.SourceFile */)
1730
1752
  this.errorOnNode(node, 252 /* Diagnostics.Global_module_exports_may_only_appear_at_top_level */, noArgs);
1731
1753
  else if (!isExternalModule(parent))
1732
1754
  this.errorOnNode(node, 250 /* Diagnostics.Global_module_exports_may_only_appear_in_module_files */, noArgs);
@@ -1750,7 +1772,7 @@ class Binder extends NodeVisitor {
1750
1772
  else if (node.exportClause === undefined)
1751
1773
  // All `export *` declarations go in one symbol.
1752
1774
  this.declareSymbol(getExports(containerSymbol), containerSymbol, node, 8388608 /* SymbolFlags.ExportStar */, 0 /* SymbolFlags.None */);
1753
- else if (node.exportClause.kind === 281 /* SyntaxKind.NamespaceExport */)
1775
+ else if (node.exportClause.kind === 282 /* SyntaxKind.NamespaceExport */)
1754
1776
  this.declareSymbol(getExports(containerSymbol), containerSymbol, node.exportClause, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */);
1755
1777
  }
1756
1778
  bindExportAssignment(node) {
@@ -1794,7 +1816,7 @@ class Binder extends NodeVisitor {
1794
1816
  this.bindAnonymousDeclaration(node, 16 /* SymbolFlags.Function */, bindingName);
1795
1817
  }
1796
1818
  bindClassLikeDeclaration(node) {
1797
- if (node.kind === 264 /* SyntaxKind.ClassDeclaration */)
1819
+ if (node.kind === 265 /* SyntaxKind.ClassDeclaration */)
1798
1820
  this.bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */);
1799
1821
  else {
1800
1822
  const name = getName(node);
@@ -1807,7 +1829,7 @@ class Binder extends NodeVisitor {
1807
1829
  const exports = getExports(symbol);
1808
1830
  const existing = exports.get('prototype');
1809
1831
  if (existing !== undefined)
1810
- this.errorOnNode(existing.declaration, 478 /* Diagnostics.Duplicate_identifier_0 */, ['prototype']);
1832
+ this.errorOnNode(existing.declaration, 485 /* Diagnostics.Duplicate_identifier_0 */, ['prototype']);
1811
1833
  exports.set('prototype', prototypeSymbol);
1812
1834
  prototypeSymbol.parent = symbol;
1813
1835
  }
@@ -1833,8 +1855,8 @@ class Binder extends NodeVisitor {
1833
1855
  const name = getName(node);
1834
1856
  this.checkStrictModeEvalOrArguments(node, name);
1835
1857
  if (name === undefined ||
1836
- name.kind === 207 /* SyntaxKind.ObjectBindingPattern */ ||
1837
- name.kind === 208 /* SyntaxKind.ArrayBindingPattern */)
1858
+ name.kind === 208 /* SyntaxKind.ObjectBindingPattern */ ||
1859
+ name.kind === 209 /* SyntaxKind.ArrayBindingPattern */)
1838
1860
  return;
1839
1861
  if (isVariableDeclarationInitializedToRequire(node))
1840
1862
  this.declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */);
@@ -1851,7 +1873,7 @@ class Binder extends NodeVisitor {
1851
1873
  if ((node.flags & 8388608 /* NodeFlags.Ambient */) === 0)
1852
1874
  this.checkStrictModeEvalOrArguments(node, node.name);
1853
1875
  const name = node.name;
1854
- if (name.kind === 207 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 208 /* SyntaxKind.ArrayBindingPattern */) {
1876
+ if (name.kind === 208 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 209 /* SyntaxKind.ArrayBindingPattern */) {
1855
1877
  const index = getParameters(node.parent).nodes.indexOf(node);
1856
1878
  this.bindAnonymousDeclaration(node, 1 /* SymbolFlags.FunctionScopedVariable */, '__' + index);
1857
1879
  }
@@ -1866,7 +1888,7 @@ class Binder extends NodeVisitor {
1866
1888
  }
1867
1889
  bindTypeParameter(node) {
1868
1890
  const parent = node.parent;
1869
- if (parent.kind !== 196 /* SyntaxKind.InferType */) {
1891
+ if (parent.kind !== 197 /* SyntaxKind.InferType */) {
1870
1892
  this.declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */);
1871
1893
  return;
1872
1894
  }
@@ -1874,7 +1896,7 @@ class Binder extends NodeVisitor {
1874
1896
  let container;
1875
1897
  for (let current = parent; current !== undefined; current = current.parent) {
1876
1898
  const p = current.parent;
1877
- if (p !== undefined && p.kind === 195 /* SyntaxKind.ConditionalType */ && getExtendsType(p) === current) {
1899
+ if (p !== undefined && p.kind === 196 /* SyntaxKind.ConditionalType */ && getExtendsType(p) === current) {
1878
1900
  container = p;
1879
1901
  break;
1880
1902
  }
@@ -1990,8 +2012,8 @@ class Binder extends NodeVisitor {
1990
2012
  else
1991
2013
  this.declareSymbolEx(symbolTable, classSymbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, true, false);
1992
2014
  }
1993
- else if (thisContainer.kind !== 263 /* SyntaxKind.FunctionDeclaration */ &&
1994
- thisContainer.kind !== 219 /* SyntaxKind.FunctionExpression */)
2015
+ else if (thisContainer.kind !== 264 /* SyntaxKind.FunctionDeclaration */ &&
2016
+ thisContainer.kind !== 220 /* SyntaxKind.FunctionExpression */)
1995
2017
  throw new Error('Unhandled case in bindThisPropertyAssignment');
1996
2018
  }
1997
2019
  /** For `this.x` in a class member, the class's members, or exports if the member is static. */
@@ -2000,12 +2022,12 @@ class Binder extends NodeVisitor {
2000
2022
  if (thisContainer === undefined)
2001
2023
  return undefined;
2002
2024
  switch (thisContainer.kind) {
2003
- case 177 /* SyntaxKind.Constructor */:
2004
- case 173 /* SyntaxKind.PropertyDeclaration */:
2005
- case 175 /* SyntaxKind.MethodDeclaration */:
2006
- case 178 /* SyntaxKind.GetAccessor */:
2007
- case 179 /* SyntaxKind.SetAccessor */:
2008
- case 176 /* SyntaxKind.ClassStaticBlockDeclaration */: {
2025
+ case 178 /* SyntaxKind.Constructor */:
2026
+ case 174 /* SyntaxKind.PropertyDeclaration */:
2027
+ case 176 /* SyntaxKind.MethodDeclaration */:
2028
+ case 179 /* SyntaxKind.GetAccessor */:
2029
+ case 180 /* SyntaxKind.SetAccessor */:
2030
+ case 177 /* SyntaxKind.ClassStaticBlockDeclaration */: {
2009
2031
  const classSymbol = getSymbol(thisContainer.parent);
2010
2032
  return isStatic(thisContainer) ? getExports(classSymbol) : getMembers(classSymbol);
2011
2033
  }
@@ -2066,7 +2088,7 @@ class Binder extends NodeVisitor {
2066
2088
  }
2067
2089
  checkPrivateIdentifier(node) {
2068
2090
  if (getText(node) === '#constructor' && this.file.diagnostics.length === 0)
2069
- this.errorOnNode(node, 1834 /* Diagnostics.X_constructor_is_a_reserved_word */, [declarationNameToString(this.file, node)]);
2091
+ this.errorOnNode(node, 1854 /* Diagnostics.X_constructor_is_a_reserved_word */, [declarationNameToString(this.file, node)]);
2070
2092
  }
2071
2093
  getStrictModeIdentifierMessage(node) {
2072
2094
  if (getContainingClass(node) !== undefined)
@@ -2125,21 +2147,21 @@ function isGeneratorFunctionExpression(node) {
2125
2147
  return node instanceof FunctionExpression && node.asteriskToken !== undefined;
2126
2148
  }
2127
2149
  function isForInOrOfStatementKind(kind) {
2128
- return kind === 250 /* SyntaxKind.ForInStatement */ || kind === 251 /* SyntaxKind.ForOfStatement */;
2150
+ return kind === 251 /* SyntaxKind.ForInStatement */ || kind === 252 /* SyntaxKind.ForOfStatement */;
2129
2151
  }
2130
2152
  function hasExportDeclarations(node) {
2131
2153
  let statements;
2132
- if (node.kind === 307 /* SyntaxKind.SourceFile */)
2154
+ if (node.kind === 308 /* SyntaxKind.SourceFile */)
2133
2155
  statements = node.statements;
2134
2156
  else if (node instanceof ModuleDeclaration) {
2135
2157
  const body = node.body;
2136
- if (body !== undefined && body.kind === 269 /* SyntaxKind.ModuleBlock */)
2158
+ if (body !== undefined && body.kind === 270 /* SyntaxKind.ModuleBlock */)
2137
2159
  statements = getStatements(body);
2138
2160
  }
2139
2161
  if (statements === undefined)
2140
2162
  return false;
2141
2163
  for (const statement of statements.nodes)
2142
- if (statement.kind === 279 /* SyntaxKind.ExportDeclaration */ || statement.kind === 278 /* SyntaxKind.ExportAssignment */)
2164
+ if (statement.kind === 280 /* SyntaxKind.ExportDeclaration */ || statement.kind === 279 /* SyntaxKind.ExportAssignment */)
2143
2165
  return true;
2144
2166
  return false;
2145
2167
  }
@@ -2168,8 +2190,8 @@ function getInitializerSymbol(symbol) {
2168
2190
  const declaration = symbol.valueDeclaration;
2169
2191
  if (declaration === undefined)
2170
2192
  return undefined;
2171
- if (declaration.kind === 263 /* SyntaxKind.FunctionDeclaration */ ||
2172
- (isInJSFile(declaration) && declaration.kind === 264 /* SyntaxKind.ClassDeclaration */))
2193
+ if (declaration.kind === 264 /* SyntaxKind.FunctionDeclaration */ ||
2194
+ (isInJSFile(declaration) && declaration.kind === 265 /* SyntaxKind.ClassDeclaration */))
2173
2195
  return symbol;
2174
2196
  if (declaration instanceof VariableDeclaration) {
2175
2197
  if ((declaration.parent.flags & 2 /* NodeFlags.Const */) !== 0 || isInJSFile(declaration)) {
@@ -2198,13 +2220,13 @@ function combineFlowLists(head, tail) {
2198
2220
  function isStatementCondition(node) {
2199
2221
  const parent = node.parent;
2200
2222
  switch (parent.kind) {
2201
- case 246 /* SyntaxKind.IfStatement */:
2202
- case 248 /* SyntaxKind.WhileStatement */:
2203
- case 247 /* SyntaxKind.DoStatement */:
2223
+ case 247 /* SyntaxKind.IfStatement */:
2224
+ case 249 /* SyntaxKind.WhileStatement */:
2225
+ case 248 /* SyntaxKind.DoStatement */:
2204
2226
  return getExpression(parent) === node;
2205
- case 249 /* SyntaxKind.ForStatement */:
2227
+ case 250 /* SyntaxKind.ForStatement */:
2206
2228
  return parent.condition === node;
2207
- case 228 /* SyntaxKind.ConditionalExpression */:
2229
+ case 229 /* SyntaxKind.ConditionalExpression */:
2208
2230
  return parent.condition === node;
2209
2231
  }
2210
2232
  return false;
@@ -2213,7 +2235,7 @@ function isTopLevelLogicalExpression(node) {
2213
2235
  let current = node;
2214
2236
  for (;;) {
2215
2237
  const parent = current.parent;
2216
- if (parent.kind === 218 /* SyntaxKind.ParenthesizedExpression */ ||
2238
+ if (parent.kind === 219 /* SyntaxKind.ParenthesizedExpression */ ||
2217
2239
  (parent instanceof PrefixUnaryExpression &&
2218
2240
  parent.operator === 53 /* SyntaxKind.ExclamationToken */))
2219
2241
  current = parent;
@@ -2231,18 +2253,18 @@ function isNarrowingExpression(expression) {
2231
2253
  case 79 /* SyntaxKind.Identifier */:
2232
2254
  case 109 /* SyntaxKind.ThisKeyword */:
2233
2255
  return true;
2234
- case 212 /* SyntaxKind.PropertyAccessExpression */:
2235
- case 213 /* SyntaxKind.ElementAccessExpression */:
2256
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
2257
+ case 214 /* SyntaxKind.ElementAccessExpression */:
2236
2258
  return containsNarrowableReference(expression);
2237
- case 214 /* SyntaxKind.CallExpression */:
2259
+ case 215 /* SyntaxKind.CallExpression */:
2238
2260
  return hasNarrowableArgument(expression);
2239
- case 218 /* SyntaxKind.ParenthesizedExpression */:
2240
- case 236 /* SyntaxKind.NonNullExpression */:
2241
- case 222 /* SyntaxKind.TypeOfExpression */:
2261
+ case 219 /* SyntaxKind.ParenthesizedExpression */:
2262
+ case 237 /* SyntaxKind.NonNullExpression */:
2263
+ case 223 /* SyntaxKind.TypeOfExpression */:
2242
2264
  return isNarrowingExpression(getExpression(expression));
2243
- case 227 /* SyntaxKind.BinaryExpression */:
2265
+ case 228 /* SyntaxKind.BinaryExpression */:
2244
2266
  return isNarrowingBinaryExpression(expression);
2245
- case 225 /* SyntaxKind.PrefixUnaryExpression */: {
2267
+ case 226 /* SyntaxKind.PrefixUnaryExpression */: {
2246
2268
  const unary = expression;
2247
2269
  return unary.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(unary.operand);
2248
2270
  }
@@ -2254,10 +2276,10 @@ function containsNarrowableReference(expression) {
2254
2276
  return true;
2255
2277
  if ((expression.flags & 32 /* NodeFlags.OptionalChain */) !== 0) {
2256
2278
  switch (expression.kind) {
2257
- case 212 /* SyntaxKind.PropertyAccessExpression */:
2258
- case 213 /* SyntaxKind.ElementAccessExpression */:
2259
- case 214 /* SyntaxKind.CallExpression */:
2260
- case 236 /* SyntaxKind.NonNullExpression */:
2279
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
2280
+ case 214 /* SyntaxKind.ElementAccessExpression */:
2281
+ case 215 /* SyntaxKind.CallExpression */:
2282
+ case 237 /* SyntaxKind.NonNullExpression */:
2261
2283
  return containsNarrowableReference(getExpression(expression));
2262
2284
  }
2263
2285
  }
@@ -2269,20 +2291,20 @@ export function isNarrowableReference(node) {
2269
2291
  case 79 /* SyntaxKind.Identifier */:
2270
2292
  case 109 /* SyntaxKind.ThisKeyword */:
2271
2293
  case 107 /* SyntaxKind.SuperKeyword */:
2272
- case 237 /* SyntaxKind.MetaProperty */:
2294
+ case 238 /* SyntaxKind.MetaProperty */:
2273
2295
  return true;
2274
- case 212 /* SyntaxKind.PropertyAccessExpression */:
2296
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
2275
2297
  return isNarrowableReference(node.expression);
2276
- case 218 /* SyntaxKind.ParenthesizedExpression */:
2298
+ case 219 /* SyntaxKind.ParenthesizedExpression */:
2277
2299
  return isNarrowableReference(node.expression);
2278
- case 236 /* SyntaxKind.NonNullExpression */:
2300
+ case 237 /* SyntaxKind.NonNullExpression */:
2279
2301
  return isNarrowableReference(node.expression);
2280
- case 213 /* SyntaxKind.ElementAccessExpression */: {
2302
+ case 214 /* SyntaxKind.ElementAccessExpression */: {
2281
2303
  const access = node;
2282
2304
  return (isStringOrNumericLiteralLike(access.argumentExpression) ||
2283
2305
  (isEntityNameExpression(access.argumentExpression, false) && isNarrowableReference(access.expression)));
2284
2306
  }
2285
- case 227 /* SyntaxKind.BinaryExpression */: {
2307
+ case 228 /* SyntaxKind.BinaryExpression */: {
2286
2308
  const binary = node;
2287
2309
  const operator = binary.operatorToken.kind;
2288
2310
  return ((operator === 27 /* SyntaxKind.CommaToken */ && isNarrowableReference(binary.right)) ||
@@ -2328,7 +2350,7 @@ function isNarrowingBinaryExpression(expression) {
2328
2350
  return false;
2329
2351
  }
2330
2352
  function isNarrowableOperand(expression) {
2331
- if (expression.kind === 218 /* SyntaxKind.ParenthesizedExpression */)
2353
+ if (expression.kind === 219 /* SyntaxKind.ParenthesizedExpression */)
2332
2354
  return isNarrowableOperand(getExpression(expression));
2333
2355
  if (expression instanceof BinaryExpression) {
2334
2356
  const binary = expression;
@@ -2341,7 +2363,7 @@ function isNarrowableOperand(expression) {
2341
2363
  return containsNarrowableReference(expression);
2342
2364
  }
2343
2365
  function isNarrowingTypeOfOperands(expression1, expression2) {
2344
- return (expression1.kind === 222 /* SyntaxKind.TypeOfExpression */ &&
2366
+ return (expression1.kind === 223 /* SyntaxKind.TypeOfExpression */ &&
2345
2367
  isNarrowableOperand(getExpression(expression1)) &&
2346
2368
  isStringLiteralLike(expression2));
2347
2369
  }
@@ -2357,3 +2379,8 @@ export function findUseStrictPrologue(file, statements) {
2357
2379
  }
2358
2380
  return undefined;
2359
2381
  }
2382
+ /** Whether a module name is a pattern with exactly one `*`. */
2383
+ function hasSingleStar(text) {
2384
+ const star = text.indexOf('*');
2385
+ return star >= 0 && text.indexOf('*', star + 1) < 0;
2386
+ }