ttsc 0.33.1 → 0.34.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 (397) hide show
  1. package/README.md +2 -0
  2. package/cmd/ttsc/api_compile.go +3 -2
  3. package/cmd/ttsc/api_transform.go +1 -1
  4. package/cmd/ttsc/build.go +5 -4
  5. package/cmd/ttsc-cache/account.go +16 -0
  6. package/cmd/ttsc-cache/account_test.go +91 -0
  7. package/cmd/ttsc-cache/main.go +1 -1
  8. package/cmd/ttsc-cache/protocol_test.go +2 -2
  9. package/cmd/ttsc-cache/publisher_seal_test.go +1 -1
  10. package/cmd/ttsc-cache/stock_go_failure_test.go +1 -1
  11. package/cmd/ttsc-cache/stock_go_test.go +2 -2
  12. package/cmd/ttsc-cache/store.go +5 -0
  13. package/cmd/ttsc-cache/tuple.go +6 -2
  14. package/cmd/ttsc-cache/tuple_test.go +1 -1
  15. package/cmd/ttscgraph/main.go +6 -1
  16. package/cmd/ttscgraph/run_help_version_and_bad_flags_exit_codes_test.go +6 -1
  17. package/cmd/ttscgraph/serve.go +22 -20
  18. package/cmd/ttscgraph/serve_shards.go +26 -15
  19. package/cmd/ttscgraph/serve_shards_abandoned_generation_converges_on_retry_test.go +2 -2
  20. package/cmd/ttscgraph/serve_shards_delete_removed_source_test.go +3 -3
  21. package/cmd/ttscgraph/serve_shards_prune_unreferenced_external_endpoints_test.go +1 -1
  22. package/cmd/ttscgraph/serve_shards_publish_created_source_test.go +3 -3
  23. package/cmd/ttscgraph/serve_shards_refresh_cross_file_implementation_test.go +2 -2
  24. package/cmd/ttscgraph/serve_shards_refresh_dependent_diagnostics_test.go +3 -3
  25. package/cmd/ttscgraph/serve_shards_rename_moves_source_identity_test.go +5 -5
  26. package/cmd/ttscgraph/serve_shards_reuse_unaffected_sources_test.go +8 -8
  27. package/cmd/ttscgraph/serve_source_encoding_test.go +2 -2
  28. package/driver/build_information_uses_selected_output_identity_test.go +5 -4
  29. package/driver/check_observations.go +1 -1
  30. package/driver/config_discovery.go +5 -1
  31. package/driver/declaration_shape.go +15 -21
  32. package/driver/diagnostics_preamble.go +2 -2
  33. package/driver/emit_containment.go +11 -14
  34. package/driver/emit_plugin.go +51 -43
  35. package/driver/emit_plugin_output.go +6 -5
  36. package/driver/emit_provenance.go +12 -15
  37. package/driver/graph.go +8 -8
  38. package/driver/host.go +15 -5
  39. package/driver/input_observation.go +22 -21
  40. package/driver/input_observation_test.go +11 -10
  41. package/driver/overlay.go +11 -11
  42. package/driver/program.go +102 -51
  43. package/driver/resolution_candidates.go +50 -32
  44. package/driver/resolution_candidates_test.go +18 -5
  45. package/driver/rewrite.go +11 -13
  46. package/driver/session.go +13 -7
  47. package/driver/target_ts70.go +85 -0
  48. package/driver/target_ts71.go +97 -0
  49. package/driver/transform_dependencies.go +1 -1
  50. package/driver/transform_source_map.go +21 -20
  51. package/go.mod +3 -3
  52. package/go.sum +4 -4
  53. package/internal/graph/alternative_member_declarations_resolve_uses_test.go +9 -9
  54. package/internal/graph/assigned_implementations_of_declaration_file_symbols_leave_no_edge_source_test.go +2 -2
  55. package/internal/graph/assigned_implementations_of_node_modules_symbols_leave_no_edge_source_test.go +2 -2
  56. package/internal/graph/build.go +17 -17
  57. package/internal/graph/build_files_reuses_committed_cross_file_endpoints_test.go +4 -4
  58. package/internal/graph/build_records_a_node_per_top_level_declaration_test.go +1 -1
  59. package/internal/graph/declaration_members.go +1 -1
  60. package/internal/graph/decorators_capture_name_and_literal_arguments_test.go +3 -3
  61. package/internal/graph/doc_tags.go +2 -2
  62. package/internal/graph/dump_paths.go +6 -5
  63. package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +1 -1
  64. package/internal/graph/edges.go +49 -38
  65. package/internal/graph/edges_cover_class_level_references_test.go +5 -5
  66. package/internal/graph/enum_initializer_calls_are_edges_test.go +2 -2
  67. package/internal/graph/enum_members_carry_their_names_on_the_enum_node_test.go +6 -6
  68. package/internal/graph/exports.go +6 -6
  69. package/internal/graph/file_diagnostics_match_tsgo_code_and_location_test.go +2 -2
  70. package/internal/graph/file_diagnostics_report_code_column_and_message_test.go +1 -1
  71. package/internal/graph/function_locals_do_not_collide_test.go +3 -3
  72. package/internal/graph/heritage_edges_cover_implements_and_interface_extends_test.go +5 -5
  73. package/internal/graph/heritage_edges_keep_extends_and_implements_to_same_base_test.go +2 -2
  74. package/internal/graph/heritage_edges_record_extends_versus_implements_origin_test.go +3 -3
  75. package/internal/graph/heritage_edges_traverse_barrels_and_stop_at_external_leaves_test.go +3 -3
  76. package/internal/graph/literals.go +3 -3
  77. package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go +2 -2
  78. package/internal/graph/literals_cover_enum_members_the_graph_has_no_nodes_for_test.go +4 -4
  79. package/internal/graph/literals_do_not_depend_on_declaration_line_wrapping_test.go +2 -2
  80. package/internal/graph/literals_render_every_value_in_typescript_source_form_test.go +1 -1
  81. package/internal/graph/literals_resolve_through_alias_indirection_test.go +3 -3
  82. package/internal/graph/member_relation_edges_follow_checker_validity_test.go +7 -7
  83. package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +19 -19
  84. package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +11 -11
  85. package/internal/graph/namespace_dotted_form_qualifies_deeply_test.go +2 -2
  86. package/internal/graph/namespace_members_become_qualified_nodes_and_edges_test.go +7 -7
  87. package/internal/graph/namespace_private_declarations_keep_lexical_identity_test.go +5 -5
  88. package/internal/graph/nodes_are_marked_exported_through_the_export_table_test.go +2 -2
  89. package/internal/graph/object_literal_declarations_resolve_calls_test.go +9 -9
  90. package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +1 -1
  91. package/internal/graph/overload_implementation_replaces_signature_test.go +2 -2
  92. package/internal/graph/property_member_edges_remain_owner_visible_test.go +6 -6
  93. package/internal/graph/resolve.go +7 -7
  94. package/internal/graph/resolve_unwraps_barrel_reexport_to_real_declaration_test.go +6 -6
  95. package/internal/graph/source.go +1 -1
  96. package/internal/graph/type_ref_edges_cover_typeof_as_satisfies_test.go +7 -7
  97. package/internal/graph/type_ref_edges_resolve_named_types_across_files_test.go +2 -2
  98. package/internal/graph/value_access_edges_cover_properties_test.go +5 -5
  99. package/internal/graph/value_call_edges_attribute_function_assignments_to_members_test.go +3 -3
  100. package/internal/graph/value_call_edges_cover_jsx_components_test.go +2 -2
  101. package/internal/graph/value_call_edges_cover_methods_and_constructors_test.go +3 -3
  102. package/internal/graph/value_call_edges_cover_variable_bound_callables_test.go +2 -2
  103. package/internal/graph/value_call_edges_do_not_double_record_invoked_member_access_test.go +4 -4
  104. package/internal/graph/value_call_edges_record_construct_versus_call_origin_test.go +3 -3
  105. package/internal/graph/value_call_edges_resolve_across_files_and_dedupe_test.go +2 -2
  106. package/internal/graph/value_call_edges_skip_self_and_unresolved_test.go +4 -4
  107. package/internal/graph/value_reads_cover_expression_positions_test.go +6 -6
  108. package/lib/compiler/internal/buildNativeCompiler.d.ts +5 -2
  109. package/lib/compiler/internal/buildNativeCompiler.js +12 -4
  110. package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
  111. package/lib/flags/COMPILER_ENUM_WHITESPACE.js +1 -1
  112. package/lib/flags/COMPILER_ENUM_WHITESPACE.js.map +1 -1
  113. package/lib/flags/COMPILER_OPTIONS.js +1079 -149
  114. package/lib/flags/COMPILER_OPTIONS.js.map +1 -1
  115. package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js +1 -1
  116. package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js.map +1 -1
  117. package/lib/flags/COMPILER_OPTION_KINDS.js +1 -1
  118. package/lib/flags/COMPILER_OPTION_KINDS.js.map +1 -1
  119. package/lib/flags/CompilerOptionSpec.d.ts +9 -2
  120. package/lib/internal/pluginSource.d.ts +1 -0
  121. package/lib/internal/pluginSource.js +1 -0
  122. package/lib/internal/pluginSource.js.map +1 -1
  123. package/lib/launcher/internal/TypeScriptSyncApi.d.ts +140 -0
  124. package/lib/launcher/internal/TypeScriptSyncApi.js +99 -0
  125. package/lib/launcher/internal/TypeScriptSyncApi.js.map +1 -0
  126. package/lib/launcher/internal/buildSingleRootInMemory.d.ts +80 -0
  127. package/lib/launcher/internal/buildSingleRootInMemory.js +253 -0
  128. package/lib/launcher/internal/buildSingleRootInMemory.js.map +1 -0
  129. package/lib/launcher/internal/buildSingleRootProject.d.ts +22 -18
  130. package/lib/launcher/internal/buildSingleRootProject.js +27 -18
  131. package/lib/launcher/internal/buildSingleRootProject.js.map +1 -1
  132. package/lib/launcher/internal/compilerArgsAsConfigOptions.d.ts +39 -0
  133. package/lib/launcher/internal/compilerArgsAsConfigOptions.js +115 -0
  134. package/lib/launcher/internal/compilerArgsAsConfigOptions.js.map +1 -0
  135. package/lib/plugin/CapabilityPluginResolver.js +3 -0
  136. package/lib/plugin/CapabilityPluginResolver.js.map +1 -1
  137. package/lib/plugin/internal/load/loadProjectPlugins.js +6 -2
  138. package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
  139. package/lib/plugin/internal/source/CompilerTarget.d.ts +127 -0
  140. package/lib/plugin/internal/source/CompilerTarget.js +231 -0
  141. package/lib/plugin/internal/source/CompilerTarget.js.map +1 -0
  142. package/lib/plugin/internal/source/NativeSourcePackages.js +6 -5
  143. package/lib/plugin/internal/source/NativeSourcePackages.js.map +1 -1
  144. package/lib/plugin/internal/source/SourcePluginAdmission.d.ts +18 -1
  145. package/lib/plugin/internal/source/SourcePluginAdmission.js +24 -2
  146. package/lib/plugin/internal/source/SourcePluginAdmission.js.map +1 -1
  147. package/lib/plugin/internal/source/SourcePluginWorkspace.d.ts +6 -3
  148. package/lib/plugin/internal/source/SourcePluginWorkspace.js +31 -13
  149. package/lib/plugin/internal/source/SourcePluginWorkspace.js.map +1 -1
  150. package/lib/plugin/internal/source/buildSourcePlugin.js +3 -1
  151. package/lib/plugin/internal/source/buildSourcePlugin.js.map +1 -1
  152. package/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts +1 -1
  153. package/lib/plugin/internal/source/hashPluginBuildEnvironment.js +9 -1
  154. package/lib/plugin/internal/source/hashPluginBuildEnvironment.js.map +1 -1
  155. package/package.json +14 -9
  156. package/shim/ast/enums_gen.go +1 -0
  157. package/shim/ast/go.mod +2 -2
  158. package/shim/ast/go.sum +4 -4
  159. package/shim/ast/neutral.go +141 -0
  160. package/shim/astnav/go.mod +2 -2
  161. package/shim/astnav/go.sum +4 -4
  162. package/shim/bundled/go.mod +2 -2
  163. package/shim/bundled/go.sum +4 -4
  164. package/shim/checker/go.mod +2 -2
  165. package/shim/checker/go.sum +4 -4
  166. package/shim/compiler/go.mod +2 -2
  167. package/shim/compiler/go.sum +4 -4
  168. package/shim/compiler/neutral.go +213 -0
  169. package/shim/core/go.mod +2 -2
  170. package/shim/core/go.sum +4 -4
  171. package/shim/diagnosticwriter/go.mod +2 -2
  172. package/shim/diagnosticwriter/go.sum +4 -4
  173. package/shim/lsp/go.mod +2 -2
  174. package/shim/lsp/go.sum +4 -4
  175. package/shim/parser/go.mod +2 -2
  176. package/shim/parser/go.sum +4 -4
  177. package/shim/printer/go.mod +2 -2
  178. package/shim/printer/go.sum +4 -4
  179. package/shim/scanner/go.mod +2 -2
  180. package/shim/scanner/go.sum +4 -4
  181. package/shim/stringutil/go.mod +1 -1
  182. package/shim/stringutil/go.sum +2 -2
  183. package/shim/stringutil/shim.go +15 -0
  184. package/shim/transformers/go.mod +2 -2
  185. package/shim/transformers/go.sum +4 -4
  186. package/shim/tsoptions/go.mod +2 -2
  187. package/shim/tsoptions/go.sum +4 -4
  188. package/shim/tsoptions/neutral.go +56 -0
  189. package/shim/tspath/go.mod +1 -1
  190. package/shim/tspath/go.sum +2 -2
  191. package/shim/tspath/neutral.go +150 -0
  192. package/shim/tspath/typed_paths.go +266 -0
  193. package/shim/vfs/cachedvfs/go.mod +2 -2
  194. package/shim/vfs/cachedvfs/go.sum +4 -4
  195. package/shim/vfs/go.mod +2 -2
  196. package/shim/vfs/go.sum +4 -4
  197. package/shim/vfs/neutral.go +20 -0
  198. package/shim/vfs/osvfs/go.mod +2 -2
  199. package/shim/vfs/osvfs/go.sum +4 -4
  200. package/src/compiler/internal/buildNativeCompiler.ts +13 -4
  201. package/src/flags/COMPILER_ENUM_WHITESPACE.ts +1 -1
  202. package/src/flags/COMPILER_OPTIONS.ts +1080 -150
  203. package/src/flags/COMPILER_OPTION_ASCII_FOLDS.ts +1 -1
  204. package/src/flags/COMPILER_OPTION_KINDS.ts +1 -1
  205. package/src/flags/CompilerOptionSpec.ts +11 -2
  206. package/src/internal/pluginSource.ts +1 -0
  207. package/src/launcher/internal/TypeScriptSyncApi.ts +186 -0
  208. package/src/launcher/internal/buildSingleRootInMemory.ts +319 -0
  209. package/src/launcher/internal/buildSingleRootProject.ts +26 -18
  210. package/src/launcher/internal/compilerArgsAsConfigOptions.ts +112 -0
  211. package/src/plugin/CapabilityPluginResolver.ts +4 -1
  212. package/src/plugin/internal/load/loadProjectPlugins.ts +12 -2
  213. package/src/plugin/internal/source/CompilerTarget.ts +249 -0
  214. package/src/plugin/internal/source/NativeSourcePackages.ts +10 -4
  215. package/src/plugin/internal/source/SourcePluginAdmission.ts +28 -2
  216. package/src/plugin/internal/source/SourcePluginWorkspace.ts +45 -19
  217. package/src/plugin/internal/source/buildSourcePlugin.ts +3 -1
  218. package/src/plugin/internal/source/hashPluginBuildEnvironment.ts +9 -1
  219. package/targets/7.1/bridge/ast/enums_gen.go +174 -0
  220. package/targets/7.1/bridge/ast/extra-shim.json +4 -0
  221. package/targets/7.1/bridge/ast/go.mod +14 -0
  222. package/targets/7.1/bridge/ast/go.sum +20 -0
  223. package/targets/7.1/bridge/ast/lint.go +1412 -0
  224. package/targets/7.1/bridge/ast/neutral.go +141 -0
  225. package/targets/7.1/bridge/ast/parent.go +60 -0
  226. package/targets/7.1/bridge/ast/safe_text.go +108 -0
  227. package/targets/7.1/bridge/ast/shim.go +1656 -0
  228. package/targets/7.1/bridge/ast/surface.go +686 -0
  229. package/targets/7.1/bridge/ast/test/next_jsdoc_comment_location_reaches_variable_statement_test.go +51 -0
  230. package/targets/7.1/bridge/ast/test/node_text_joins_multi_hop_qualified_name_test.go +47 -0
  231. package/targets/7.1/bridge/ast/test/node_text_joins_one_hop_qualified_name_test.go +35 -0
  232. package/targets/7.1/bridge/ast/test/node_text_returns_empty_for_nil_test.go +31 -0
  233. package/targets/7.1/bridge/ast/test/node_text_returns_identifier_text_test.go +34 -0
  234. package/targets/7.1/bridge/ast/test/node_text_skips_empty_qualified_left_test.go +60 -0
  235. package/targets/7.1/bridge/astnav/go.mod +14 -0
  236. package/targets/7.1/bridge/astnav/go.sum +22 -0
  237. package/targets/7.1/bridge/astnav/shim.go +24 -0
  238. package/targets/7.1/bridge/bundled/extra-shim.json +1 -0
  239. package/targets/7.1/bridge/bundled/go.mod +10 -0
  240. package/targets/7.1/bridge/bundled/go.sum +10 -0
  241. package/targets/7.1/bridge/bundled/shim.go +24 -0
  242. package/targets/7.1/bridge/checker/enums_gen.go +150 -0
  243. package/targets/7.1/bridge/checker/extra-shim.json +37 -0
  244. package/targets/7.1/bridge/checker/go.mod +15 -0
  245. package/targets/7.1/bridge/checker/go.sum +24 -0
  246. package/targets/7.1/bridge/checker/node_builder_fields_gen.go +19 -0
  247. package/targets/7.1/bridge/checker/shim.go +1390 -0
  248. package/targets/7.1/bridge/compiler/contentmapper_process.go +70 -0
  249. package/targets/7.1/bridge/compiler/emit_sourcemap.go +296 -0
  250. package/targets/7.1/bridge/compiler/emitassemble.go +81 -0
  251. package/targets/7.1/bridge/compiler/emithook.go +44 -0
  252. package/targets/7.1/bridge/compiler/extra-shim.json +4 -0
  253. package/targets/7.1/bridge/compiler/go.mod +15 -0
  254. package/targets/7.1/bridge/compiler/go.sum +24 -0
  255. package/targets/7.1/bridge/compiler/incremental.go +185 -0
  256. package/targets/7.1/bridge/compiler/neutral.go +256 -0
  257. package/targets/7.1/bridge/compiler/resolution.go +571 -0
  258. package/targets/7.1/bridge/compiler/shim.go +70 -0
  259. package/targets/7.1/bridge/core/enums_gen.go +15 -0
  260. package/targets/7.1/bridge/core/extra-shim.json +4 -0
  261. package/targets/7.1/bridge/core/go.mod +7 -0
  262. package/targets/7.1/bridge/core/go.sum +8 -0
  263. package/targets/7.1/bridge/core/modulekind.go +19 -0
  264. package/targets/7.1/bridge/core/shim.go +272 -0
  265. package/targets/7.1/bridge/diagnosticwriter/go.mod +14 -0
  266. package/targets/7.1/bridge/diagnosticwriter/go.sum +20 -0
  267. package/targets/7.1/bridge/diagnosticwriter/lint.go +411 -0
  268. package/targets/7.1/bridge/diagnosticwriter/shim.go +56 -0
  269. package/targets/7.1/bridge/lsp/extra-shim.json +4 -0
  270. package/targets/7.1/bridge/lsp/go.mod +16 -0
  271. package/targets/7.1/bridge/lsp/go.sum +26 -0
  272. package/targets/7.1/bridge/lsp/shim.go +112 -0
  273. package/targets/7.1/bridge/parser/extra-shim.json +4 -0
  274. package/targets/7.1/bridge/parser/go.mod +14 -0
  275. package/targets/7.1/bridge/parser/go.sum +24 -0
  276. package/targets/7.1/bridge/parser/shim.go +61 -0
  277. package/targets/7.1/bridge/printer/emithost.go +69 -0
  278. package/targets/7.1/bridge/printer/go.mod +15 -0
  279. package/targets/7.1/bridge/printer/go.sum +24 -0
  280. package/targets/7.1/bridge/printer/shim.go +168 -0
  281. package/targets/7.1/bridge/printer/sourcemap.go +49 -0
  282. package/targets/7.1/bridge/scanner/extra-shim.json +4 -0
  283. package/targets/7.1/bridge/scanner/go.mod +14 -0
  284. package/targets/7.1/bridge/scanner/go.sum +20 -0
  285. package/targets/7.1/bridge/scanner/regexp.go +42 -0
  286. package/targets/7.1/bridge/scanner/shim.go +137 -0
  287. package/targets/7.1/bridge/stringutil/extra-shim.json +1 -0
  288. package/targets/7.1/bridge/stringutil/go.mod +5 -0
  289. package/targets/7.1/bridge/stringutil/go.sum +2 -0
  290. package/targets/7.1/bridge/stringutil/shim.go +131 -0
  291. package/targets/7.1/bridge/transformers/go.mod +15 -0
  292. package/targets/7.1/bridge/transformers/go.sum +24 -0
  293. package/targets/7.1/bridge/transformers/shim.go +24 -0
  294. package/targets/7.1/bridge/tsoptions/command_line_raw.go +44 -0
  295. package/targets/7.1/bridge/tsoptions/extra-shim.json +4 -0
  296. package/targets/7.1/bridge/tsoptions/go.mod +15 -0
  297. package/targets/7.1/bridge/tsoptions/go.sum +24 -0
  298. package/targets/7.1/bridge/tsoptions/neutral.go +47 -0
  299. package/targets/7.1/bridge/tsoptions/shim.go +193 -0
  300. package/targets/7.1/bridge/tspath/extra-shim.json +4 -0
  301. package/targets/7.1/bridge/tspath/go.mod +5 -0
  302. package/targets/7.1/bridge/tspath/go.sum +6 -0
  303. package/targets/7.1/bridge/tspath/neutral.go +142 -0
  304. package/targets/7.1/bridge/tspath/shim.go +382 -0
  305. package/targets/7.1/bridge/vfs/cachedvfs/extra-shim.json +4 -0
  306. package/targets/7.1/bridge/vfs/cachedvfs/go.mod +5 -0
  307. package/targets/7.1/bridge/vfs/cachedvfs/go.sum +10 -0
  308. package/targets/7.1/bridge/vfs/cachedvfs/shim.go +12 -0
  309. package/targets/7.1/bridge/vfs/decode.go +26 -0
  310. package/targets/7.1/bridge/vfs/decode_test.go +42 -0
  311. package/targets/7.1/bridge/vfs/extra-shim.json +4 -0
  312. package/targets/7.1/bridge/vfs/go.mod +10 -0
  313. package/targets/7.1/bridge/vfs/go.sum +10 -0
  314. package/targets/7.1/bridge/vfs/neutral.go +23 -0
  315. package/targets/7.1/bridge/vfs/osvfs/extra-shim.json +4 -0
  316. package/targets/7.1/bridge/vfs/osvfs/go.mod +10 -0
  317. package/targets/7.1/bridge/vfs/osvfs/go.sum +10 -0
  318. package/targets/7.1/bridge/vfs/osvfs/shim.go +14 -0
  319. package/targets/7.1/bridge/vfs/shim.go +27 -0
  320. package/targets/7.1/facade/ast/facade_gen.go +2691 -0
  321. package/targets/7.1/facade/ast/go.mod +20 -0
  322. package/targets/7.1/facade/ast/go.sum +20 -0
  323. package/targets/7.1/facade/astnav/facade_gen.go +15 -0
  324. package/targets/7.1/facade/astnav/go.mod +22 -0
  325. package/targets/7.1/facade/astnav/go.sum +22 -0
  326. package/targets/7.1/facade/bundled/facade_gen.go +32 -0
  327. package/targets/7.1/facade/bundled/go.mod +21 -0
  328. package/targets/7.1/facade/bundled/go.sum +10 -0
  329. package/targets/7.1/facade/checker/facade_gen.go +563 -0
  330. package/targets/7.1/facade/checker/go.mod +26 -0
  331. package/targets/7.1/facade/checker/go.sum +24 -0
  332. package/targets/7.1/facade/compiler/facade_gen.go +198 -0
  333. package/targets/7.1/facade/compiler/go.mod +41 -0
  334. package/targets/7.1/facade/compiler/go.sum +24 -0
  335. package/targets/7.1/facade/core/facade_gen.go +130 -0
  336. package/targets/7.1/facade/core/go.mod +12 -0
  337. package/targets/7.1/facade/core/go.sum +8 -0
  338. package/targets/7.1/facade/diagnosticwriter/facade_gen.go +36 -0
  339. package/targets/7.1/facade/diagnosticwriter/go.mod +22 -0
  340. package/targets/7.1/facade/diagnosticwriter/go.sum +20 -0
  341. package/targets/7.1/facade/lsp/facade_gen.go +31 -0
  342. package/targets/7.1/facade/lsp/go.mod +19 -0
  343. package/targets/7.1/facade/lsp/go.sum +26 -0
  344. package/targets/7.1/facade/parser/facade_gen.go +102 -0
  345. package/targets/7.1/facade/parser/go.mod +25 -0
  346. package/targets/7.1/facade/parser/go.sum +24 -0
  347. package/targets/7.1/facade/printer/facade_gen.go +74 -0
  348. package/targets/7.1/facade/printer/go.mod +26 -0
  349. package/targets/7.1/facade/printer/go.sum +24 -0
  350. package/targets/7.1/facade/scanner/facade_gen.go +191 -0
  351. package/targets/7.1/facade/scanner/go.mod +25 -0
  352. package/targets/7.1/facade/scanner/go.sum +20 -0
  353. package/targets/7.1/facade/stringutil/facade_gen.go +176 -0
  354. package/targets/7.1/facade/stringutil/go.mod +9 -0
  355. package/targets/7.1/facade/stringutil/go.sum +2 -0
  356. package/targets/7.1/facade/transformers/facade_gen.go +12 -0
  357. package/targets/7.1/facade/transformers/go.mod +18 -0
  358. package/targets/7.1/facade/transformers/go.sum +24 -0
  359. package/targets/7.1/facade/tsoptions/facade_gen.go +274 -0
  360. package/targets/7.1/facade/tsoptions/go.mod +32 -0
  361. package/targets/7.1/facade/tsoptions/go.sum +24 -0
  362. package/targets/7.1/facade/tspath/facade_gen.go +550 -0
  363. package/targets/7.1/facade/tspath/go.mod +9 -0
  364. package/targets/7.1/facade/tspath/go.sum +6 -0
  365. package/targets/7.1/facade/vfs/cachedvfs/facade_gen.go +17 -0
  366. package/targets/7.1/facade/vfs/cachedvfs/go.mod +18 -0
  367. package/targets/7.1/facade/vfs/cachedvfs/go.sum +10 -0
  368. package/targets/7.1/facade/vfs/facade_gen.go +47 -0
  369. package/targets/7.1/facade/vfs/go.mod +18 -0
  370. package/targets/7.1/facade/vfs/go.sum +10 -0
  371. package/targets/7.1/facade/vfs/osvfs/facade_gen.go +20 -0
  372. package/targets/7.1/facade/vfs/osvfs/go.mod +21 -0
  373. package/targets/7.1/facade/vfs/osvfs/go.sum +10 -0
  374. package/tools/gen_facade/committed_facades_match_their_bridges_test.go +57 -0
  375. package/tools/gen_facade/facade_manifest_points_into_the_bridge_root_test.go +75 -0
  376. package/tools/gen_facade/facade_spells_internal_types_through_bridge_aliases_test.go +75 -0
  377. package/tools/gen_facade/facade_types_are_their_bridge_types_test.go +99 -0
  378. package/tools/gen_facade/go.mod +10 -0
  379. package/tools/gen_facade/go.sum +8 -0
  380. package/tools/gen_facade/main.go +734 -0
  381. package/tools/gen_shims/go.mod +4 -4
  382. package/tools/gen_shims/go.sum +6 -6
  383. package/tools/gen_shims/main.go +124 -66
  384. package/tools/gen_shims/mirror_structs_terminate_on_unexported_cycles_test.go +101 -0
  385. package/tools/shim_audit/baseline-7.1.json +720 -0
  386. package/tools/shim_audit/baseline.json +5 -4
  387. package/tools/shim_audit/go.mod +4 -4
  388. package/tools/shim_audit/go.sum +6 -6
  389. package/tools/shim_audit/linkname_signatures.go +178 -0
  390. package/tools/shim_audit/linkname_signatures_match_their_targets_test.go +64 -0
  391. package/tools/shim_audit/linkname_targets_follow_the_audited_compiler_test.go +38 -0
  392. package/tools/shim_audit/main.go +29 -4
  393. package/tools/shim_audit/neutral_api.go +160 -0
  394. package/tools/shim_audit/neutral_api_must_match_across_targets_test.go +74 -0
  395. package/utility/host.go +5 -4
  396. package/utility/preamble_output.go +15 -15
  397. package/utility/serve.go +1 -1
@@ -75,7 +75,7 @@ func BuildFiles(prog *driver.Program, selected []string, baseNodes map[string]*N
75
75
  if !IsWorkspaceSourceFile(file) {
76
76
  continue
77
77
  }
78
- if selected != nil && !selectedFiles[file.FileName()] {
78
+ if selected != nil && !selectedFiles[string(file.FileName())] {
79
79
  continue
80
80
  }
81
81
  g.putModuleNode(file)
@@ -139,7 +139,7 @@ func SourceTexts(prog *driver.Program) map[string]string {
139
139
  if file == nil {
140
140
  continue
141
141
  }
142
- out[file.FileName()] = file.Text()
142
+ out[string(file.FileName())] = file.Text()
143
143
  }
144
144
  return out
145
145
  }
@@ -168,8 +168,8 @@ func SourceTextsForFiles(prog *driver.Program, files []string) map[string]string
168
168
  }
169
169
  out := make(map[string]string, len(files))
170
170
  for _, source := range prog.TSProgram.SourceFiles() {
171
- if source != nil && selected[source.FileName()] {
172
- out[source.FileName()] = source.Text()
171
+ if source != nil && selected[string(source.FileName())] {
172
+ out[string(source.FileName())] = source.Text()
173
173
  }
174
174
  }
175
175
  return out
@@ -184,7 +184,7 @@ func collectDeclarations(g *Graph, file *shimast.SourceFile) {
184
184
  if file.Statements == nil {
185
185
  return
186
186
  }
187
- collectStatements(g, file.FileName(), file.Statements.Nodes)
187
+ collectStatements(g, string(file.FileName()), file.Statements.Nodes)
188
188
  }
189
189
 
190
190
  // collectStatements records a file or namespace statement list. qualifiedName
@@ -529,7 +529,7 @@ func functionBodyOfInitializer(initializer *shimast.Node) *shimast.Node {
529
529
  // code instead of just the overload header.
530
530
  func addNode(g *Graph, path string, node *shimast.Node, kind NodeKind) {
531
531
  symbol := node.Symbol()
532
- if symbol == nil || symbol.Name == "" {
532
+ if symbol == nil || shimast.SymbolNameOf(symbol) == "" {
533
533
  return
534
534
  }
535
535
  putDeclaredNode(g, path, qualifiedName(symbol), kind, node)
@@ -722,7 +722,7 @@ func methodName(symbol *shimast.Symbol) string {
722
722
  if name, ok := structuralMemberName(symbol); ok {
723
723
  return name
724
724
  }
725
- if symbol == nil || symbol.Parent == nil || symbol.Parent.Name == "" {
725
+ if symbol == nil || shimast.SymbolParentOf(symbol) == nil || shimast.SymbolNameOf(shimast.SymbolParentOf(symbol)) == "" {
726
726
  return ""
727
727
  }
728
728
  return qualifiedName(symbol)
@@ -733,11 +733,11 @@ func methodName(symbol *shimast.Symbol) string {
733
733
  // private declaration loses its binder counter; public literal names can contain
734
734
  // the same text. A constructor's internal-name prefix (\xFE) becomes "__".
735
735
  func simpleName(symbol *shimast.Symbol) string {
736
- if symbol == nil || symbol.Name == "" {
736
+ if symbol == nil || shimast.SymbolNameOf(symbol) == "" {
737
737
  return ""
738
738
  }
739
- name := strings.ReplaceAll(symbol.Name, "\xFE", "__")
740
- for _, declaration := range symbol.Declarations {
739
+ name := strings.ReplaceAll(shimast.SymbolNameOf(symbol), "\xFE", "__")
740
+ for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
741
741
  if declared := declaration.Name(); declared != nil && declared.Kind == shimast.KindPrivateIdentifier {
742
742
  return stripPrivateMangling(name)
743
743
  }
@@ -787,7 +787,7 @@ func qualifiedName(symbol *shimast.Symbol) string {
787
787
  if symbol == nil {
788
788
  return ""
789
789
  }
790
- for _, declaration := range symbol.Declarations {
790
+ for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
791
791
  if name, ok := objectDeclarationName(declaration); ok {
792
792
  return name
793
793
  }
@@ -807,14 +807,14 @@ func qualifiedName(symbol *shimast.Symbol) string {
807
807
  // module symbol is not a namespace — its declaration is the file, not a
808
808
  // `namespace` block — so a top-level declaration gets no prefix.
809
809
  func containerPrefix(symbol *shimast.Symbol) string {
810
- parent := symbol.Parent
811
- if parent != nil && parent.Name != "" && (isNamespaceSymbol(parent) || isTypeContainerSymbol(parent)) {
810
+ parent := shimast.SymbolParentOf(symbol)
811
+ if parent != nil && shimast.SymbolNameOf(parent) != "" && (isNamespaceSymbol(parent) || isTypeContainerSymbol(parent)) {
812
812
  return qualifiedName(parent)
813
813
  }
814
814
  // The binder does not assign Symbol.Parent to private namespace locals.
815
815
  // Their lexical namespace still owns their identity. Stop at a callable so
816
816
  // ClosureName remains the owner of function-local qualification.
817
- for _, declaration := range symbol.Declarations {
817
+ for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
818
818
  for owner := declaration.Parent; owner != nil; owner = owner.Parent {
819
819
  if isFunctionLike(owner) {
820
820
  break
@@ -833,10 +833,10 @@ func containerPrefix(symbol *shimast.Symbol) string {
833
833
  // also module declarations, but qualifying members by their quoted or internal
834
834
  // names would produce malformed ids, so they are excluded.
835
835
  func isNamespaceSymbol(symbol *shimast.Symbol) bool {
836
- if strings.HasPrefix(symbol.Name, "\"") || strings.Contains(symbol.Name, "\xFE") {
836
+ if strings.HasPrefix(shimast.SymbolNameOf(symbol), "\"") || strings.Contains(shimast.SymbolNameOf(symbol), "\xFE") {
837
837
  return false
838
838
  }
839
- for _, declaration := range symbol.Declarations {
839
+ for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
840
840
  if declaration.Kind == shimast.KindModuleDeclaration {
841
841
  return true
842
842
  }
@@ -847,7 +847,7 @@ func isNamespaceSymbol(symbol *shimast.Symbol) bool {
847
847
  // isTypeContainerSymbol reports whether symbol is a class or interface, whose
848
848
  // members the graph qualifies ("Class.method").
849
849
  func isTypeContainerSymbol(symbol *shimast.Symbol) bool {
850
- return symbol.Flags&(shimast.SymbolFlagsClass|shimast.SymbolFlagsInterface) != 0
850
+ return shimast.SymbolFlagsOf(symbol)&(shimast.SymbolFlagsClass|shimast.SymbolFlagsInterface) != 0
851
851
  }
852
852
 
853
853
  // moduleStatements returns the member statements inside a namespace/module body,
@@ -67,15 +67,15 @@ export class Impl implements Base {
67
67
  implFile := sourceFile(t, prog, "impl.ts").FileName()
68
68
  baseFile := sourceFile(t, prog, "base.ts").FileName()
69
69
  unrelatedFile := sourceFile(t, prog, "unrelated.ts").FileName()
70
- partial := BuildFiles(prog, []string{implFile}, complete.Nodes)
70
+ partial := BuildFiles(prog, []string{string(implFile)}, complete.Nodes)
71
71
 
72
- implMethod := nodeID(implFile, "Impl.run", NodeMethod)
73
- baseMethod := nodeID(baseFile, "Base.run", NodeMethod)
72
+ implMethod := nodeID(string(implFile), "Impl.run", NodeMethod)
73
+ baseMethod := nodeID(string(baseFile), "Base.run", NodeMethod)
74
74
  if partial.Nodes[implMethod] == nil {
75
75
  t.Fatalf("partial build omitted selected method %s", implMethod)
76
76
  }
77
77
  for _, node := range partial.Nodes {
78
- if node.File == baseFile || node.File == unrelatedFile {
78
+ if node.File == string(baseFile) || node.File == string(unrelatedFile) {
79
79
  t.Fatalf("partial build re-emitted unchanged node %s", node.ID)
80
80
  }
81
81
  }
@@ -80,7 +80,7 @@ export const value = 1;
80
80
  t.Fatalf("expected %d nodes, got %d: %v", len(want), declared, nodeIDSet(graph))
81
81
  }
82
82
  for name, kind := range want {
83
- id := nodeID(path, name, kind)
83
+ id := nodeID(string(path), name, kind)
84
84
  node, ok := graph.Nodes[id]
85
85
  if !ok {
86
86
  t.Fatalf("missing node for %s (%s); have %v", name, kind, nodeIDSet(graph))
@@ -8,7 +8,7 @@ func structuralMemberName(symbol *shimast.Symbol) (string, bool) {
8
8
  if symbol == nil {
9
9
  return "", false
10
10
  }
11
- for _, declaration := range symbol.Declarations {
11
+ for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
12
12
  parent := declaration.Parent
13
13
  if parent == nil {
14
14
  continue
@@ -62,9 +62,9 @@ export class UsersController {
62
62
  graph := Build(prog)
63
63
  path := sourceFile(t, prog, "main.ts").FileName()
64
64
 
65
- controller := nodeID(path, "UsersController", NodeClass)
66
- find := nodeID(path, "UsersController.find", NodeMethod)
67
- plain := nodeID(path, "UsersController.plain", NodeMethod)
65
+ controller := nodeID(string(path), "UsersController", NodeClass)
66
+ find := nodeID(string(path), "UsersController.find", NodeMethod)
67
+ plain := nodeID(string(path), "UsersController.plain", NodeMethod)
68
68
 
69
69
  classDec := findDecorator(graph, controller, "Controller")
70
70
  if classDec == nil {
@@ -270,7 +270,7 @@ func joinDocTagLines(text string) string {
270
270
  // relation, and privileging a tag would put one convention's name inside the
271
271
  // compiler host.
272
272
  func (g *Graph) collectDocRefs(checker *shimchecker.Checker, file *shimast.SourceFile) {
273
- for _, host := range g.docHosts[file.FileName()] {
273
+ for _, host := range g.docHosts[string(file.FileName())] {
274
274
  for _, doc := range documentationOf(host.declaration, file) {
275
275
  g.docRefsWithin(checker, host.target, doc)
276
276
  }
@@ -312,7 +312,7 @@ func (g *Graph) recordDocHost(target string, declaration *shimast.Node) {
312
312
  g.docHosts = map[string][]docHost{}
313
313
  }
314
314
  path := file.FileName()
315
- g.docHosts[path] = append(g.docHosts[path], docHost{
315
+ g.docHosts[string(path)] = append(g.docHosts[string(path)], docHost{
316
316
  target: target,
317
317
  declaration: declaration,
318
318
  })
@@ -172,7 +172,8 @@ func (m *dumpPathMapper) mapPath(file string) string {
172
172
 
173
173
  rawPhysical := normalized
174
174
  if shimtspath.GetRootLength(rawPhysical) == 0 {
175
- rawPhysical = shimtspath.GetNormalizedAbsolutePath(rawPhysical, m.rawProject)
175
+ // m.rawProject is rooted whenever m.project is: canonicalDumpPath keeps an unrooted spelling unrooted, and mapPath returned above for an unrooted m.project.
176
+ rawPhysical = shimtspath.GetNormalizedAbsolutePath(rawPhysical, shimtspath.RootedDirectoryPathFromAbsolute(m.rawProject))
176
177
  }
177
178
  rawKey := m.pathKey(rawPhysical)
178
179
  if wire, ok := m.rawToWire[rawKey]; ok {
@@ -187,11 +188,11 @@ func (m *dumpPathMapper) mapPath(file string) string {
187
188
  ))
188
189
  return rawPhysical
189
190
  }
190
- options := shimtspath.ComparePathsOptions{
191
- CurrentDirectory: m.project,
192
- UseCaseSensitiveFileNames: m.caseSensitive,
191
+ caseSensitivity := shimtspath.CaseInsensitive
192
+ if m.caseSensitive {
193
+ caseSensitivity = shimtspath.CaseSensitive
193
194
  }
194
- wire := shimtspath.GetRelativePathFromDirectory(m.project, physical, options)
195
+ wire := shimtspath.RelativePathFromDirectoryWith(caseSensitivity, m.project, physical)
195
196
  if shimtspath.GetRootLength(wire) != 0 {
196
197
  m.fail(fmt.Errorf(
197
198
  "ttscgraph: source path %q cannot be represented relative to project %q because they are on different filesystem roots",
@@ -39,7 +39,7 @@ export var duplicate = { second: 2 };
39
39
 
40
40
  graph := Build(prog)
41
41
  path := sourceFile(t, prog, "main.ts").FileName()
42
- node := graph.Nodes[nodeID(path, "duplicate", NodeVariable)]
42
+ node := graph.Nodes[nodeID(string(path), "duplicate", NodeVariable)]
43
43
  if node == nil {
44
44
  t.Fatalf("missing duplicate variable; nodes: %v", nodeIDSet(graph))
45
45
  }
@@ -24,7 +24,7 @@ func (g *Graph) addEdges(prog *driver.Program, selected map[string]bool, partial
24
24
  if !IsWorkspaceSourceFile(file) {
25
25
  continue
26
26
  }
27
- if partial && !selected[file.FileName()] {
27
+ if partial && !selected[string(file.FileName())] {
28
28
  continue
29
29
  }
30
30
  g.markExports(checker, file)
@@ -34,7 +34,7 @@ func (g *Graph) addEdges(prog *driver.Program, selected map[string]bool, partial
34
34
  g.collectDocRefs(checker, file)
35
35
  g.collectLiterals(checker, file)
36
36
  if file.Statements != nil {
37
- g.collectDecorators(file.FileName(), file.Statements.Nodes)
37
+ g.collectDecorators(string(file.FileName()), file.Statements.Nodes)
38
38
  }
39
39
  }
40
40
  }
@@ -72,7 +72,7 @@ func (g *Graph) collectHeritage(checker *shimchecker.Checker, file *shimast.Sour
72
72
  if file.Statements == nil {
73
73
  return
74
74
  }
75
- g.collectHeritageIn(checker, file.FileName(), file.Statements.Nodes)
75
+ g.collectHeritageIn(checker, string(file.FileName()), file.Statements.Nodes)
76
76
  }
77
77
 
78
78
  // collectHeritageIn adds heritage edges for the class/interface statements in a
@@ -111,7 +111,7 @@ func (g *Graph) collectHeritageIn(checker *shimchecker.Checker, path string, sta
111
111
  // records a heritage edge from node to the resolved base node.
112
112
  func (g *Graph) heritageEdges(checker *shimchecker.Checker, path string, node *shimast.Node, kind NodeKind, clauses []*shimast.Node) {
113
113
  symbol := node.Symbol()
114
- if symbol == nil || symbol.Name == "" {
114
+ if symbol == nil || shimast.SymbolNameOf(symbol) == "" {
115
115
  return
116
116
  }
117
117
  from := nodeID(path, qualifiedName(symbol), kind)
@@ -135,11 +135,11 @@ func (g *Graph) heritageEdges(checker *shimchecker.Checker, path string, node *s
135
135
  origin = "extends"
136
136
  }
137
137
  for _, typeNode := range clause.Types.Nodes {
138
- base := typeNode.AsExpressionWithTypeArguments()
139
- if base == nil || base.Expression == nil {
138
+ name := heritageElementName(typeNode)
139
+ if name == nil {
140
140
  continue
141
141
  }
142
- target := g.resolve(checker, base.Expression)
142
+ target := g.resolve(checker, name)
143
143
  if target == nil || target.Symbol == nil {
144
144
  continue
145
145
  }
@@ -147,12 +147,23 @@ func (g *Graph) heritageEdges(checker *shimchecker.Checker, path string, node *s
147
147
  if to == "" {
148
148
  continue
149
149
  }
150
- g.addEdgeAt(from, to, EdgeHeritage, origin, base.Expression.Pos(), base.Expression.End())
150
+ g.addEdgeAt(from, to, EdgeHeritage, origin, name.Pos(), name.End())
151
151
  g.memberRelationEdges(checker, node, kind, typeNode, target, origin)
152
152
  }
153
153
  }
154
154
  }
155
155
 
156
+ // heritageElementName is the name a heritage clause element refers to. The
157
+ // parser represents an interface's `extends` and a class's `implements`
158
+ // element as a type reference when it is an entity name, and every other
159
+ // element as an expression with type arguments.
160
+ func heritageElementName(element *shimast.Node) *shimast.Node {
161
+ if element.Kind == shimast.KindTypeReference {
162
+ return element.AsTypeReferenceNode().TypeName
163
+ }
164
+ return element.AsExpressionWithTypeArguments().Expression
165
+ }
166
+
156
167
  // memberRelationEdges records the directly declared member pairs that a
157
168
  // heritage clause makes checker-valid. Inferring them from equal names after the
158
169
  // dump was built would make an authoritative edge even when the checker rejects
@@ -201,8 +212,8 @@ func (g *Graph) memberRelationEdges(
201
212
  continue
202
213
  }
203
214
 
204
- derivedProperty := checker.GetPropertyOfType(derivedType, derivedMemberSymbol.Name)
205
- baseProperty := checker.GetPropertyOfType(baseType, derivedMemberSymbol.Name)
215
+ derivedProperty := checker.GetPropertyOfType(derivedType, shimast.SymbolNameOf(derivedMemberSymbol))
216
+ baseProperty := checker.GetPropertyOfType(baseType, shimast.SymbolNameOf(derivedMemberSymbol))
206
217
  if derivedProperty == nil || baseProperty == nil ||
207
218
  !propertyRootsAt(checker, derivedProperty, derivedMemberSymbol) {
208
219
  continue
@@ -251,7 +262,7 @@ func declaredTypeMembers(symbol *shimast.Symbol) []*shimast.Node {
251
262
  return nil
252
263
  }
253
264
  var members []*shimast.Node
254
- for _, declaration := range symbol.Declarations {
265
+ for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
255
266
  members = append(members, classMembers(declaration)...)
256
267
  }
257
268
  return members
@@ -277,7 +288,7 @@ func inheritedMemberForProperty(
277
288
  if root == nil {
278
289
  continue
279
290
  }
280
- for _, declaration := range root.Declarations {
291
+ for _, declaration := range shimast.SymbolDeclarationsOf(root) {
281
292
  if declaration == nil ||
282
293
  shimast.GetCombinedModifierFlags(declaration)&shimast.ModifierFlagsStatic != 0 ||
283
294
  declaration.Kind == shimast.KindConstructor {
@@ -345,7 +356,7 @@ func graphMemberNodeID(g *Graph, member *shimast.Node) string {
345
356
  if file == nil || name == "" {
346
357
  return ""
347
358
  }
348
- id := nodeID(file.FileName(), name, kind)
359
+ id := nodeID(string(file.FileName()), name, kind)
349
360
  stored, ok := g.lookupNode(id)
350
361
  if !ok {
351
362
  return ""
@@ -362,7 +373,7 @@ func graphMemberNodeID(g *Graph, member *shimast.Node) string {
362
373
  // top-level variable binding, or the class itself for a member that is not a
363
374
  // method (a property initializer).
364
375
  func (g *Graph) collectCalls(checker *shimchecker.Checker, file *shimast.SourceFile) {
365
- forEachContainer(file.FileName(), file, func(from string, node *shimast.Node) {
376
+ forEachContainer(string(file.FileName()), file, func(from string, node *shimast.Node) {
366
377
  g.callsWithin(checker, from, node)
367
378
  })
368
379
  }
@@ -435,7 +446,7 @@ func moduleID(path string) string {
435
446
  // pass recorded.
436
447
  func topLevelID(path string, statement *shimast.Node, kind NodeKind) string {
437
448
  symbol := statement.Symbol()
438
- if symbol == nil || symbol.Name == "" {
449
+ if symbol == nil || shimast.SymbolNameOf(symbol) == "" {
439
450
  return ""
440
451
  }
441
452
  return nodeID(path, qualifiedName(symbol), kind)
@@ -526,7 +537,7 @@ func forEachVariable(path string, statement *shimast.Node, fn func(string, *shim
526
537
  }
527
538
  for _, binding := range list.Declarations.Nodes {
528
539
  symbol := binding.Symbol()
529
- if symbol == nil || symbol.Name == "" {
540
+ if symbol == nil || shimast.SymbolNameOf(symbol) == "" {
530
541
  continue
531
542
  }
532
543
  fn(nodeID(path, qualifiedName(symbol), NodeVariable), binding)
@@ -690,14 +701,14 @@ func (g *Graph) recordImplementation(id string, assignment *shimast.Node) string
690
701
  sources = map[string]bool{}
691
702
  g.ImplementationSources[id] = sources
692
703
  }
693
- sources[file.FileName()] = true
704
+ sources[string(file.FileName())] = true
694
705
  current := g.Nodes[id]
695
706
  if current != nil && current.ImplementationFile == "" {
696
- current.ImplementationFile = file.FileName()
707
+ current.ImplementationFile = string(file.FileName())
697
708
  current.ImplementationPos = assignment.Pos()
698
709
  current.ImplementationEnd = assignment.End()
699
710
  }
700
- return file.FileName()
711
+ return string(file.FileName())
701
712
  }
702
713
 
703
714
  func (g *Graph) withEdgeEvidenceFile(from, file string, visit func()) {
@@ -779,11 +790,11 @@ func (g *Graph) valueUseEdge(checker *shimchecker.Checker, from string, targetEx
779
790
  }
780
791
  // Enum members remain outline facts on their enum rather than separate nodes.
781
792
  // Their reads therefore depend on that enum's existing identity.
782
- if kind == EdgeValueAccess && target.Symbol.Flags&shimast.SymbolFlagsEnumMember != 0 {
783
- if parent := target.Symbol.Parent; parent != nil {
793
+ if kind == EdgeValueAccess && shimast.SymbolFlagsOf(target.Symbol)&shimast.SymbolFlagsEnumMember != 0 {
794
+ if parent := shimast.SymbolParentOf(target.Symbol); parent != nil {
784
795
  if declaration := declarationNode(parent); declaration != nil {
785
796
  if file := declarationFile(parent); file != nil {
786
- target = &Target{Symbol: parent, File: file.FileName(), External: !IsWorkspaceSourceFile(file), Pos: declaration.Pos(), End: declaration.End()}
797
+ target = &Target{Symbol: parent, File: string(file.FileName()), External: !IsWorkspaceSourceFile(file), Pos: declaration.Pos(), End: declaration.End()}
787
798
  }
788
799
  }
789
800
  }
@@ -802,7 +813,7 @@ func (g *Graph) valueUseEdge(checker *shimchecker.Checker, from string, targetEx
802
813
  // the unit of truth: an `import type` or annotation-only dependency relates two
803
814
  // symbols without any runtime call.
804
815
  func (g *Graph) collectTypeRefs(checker *shimchecker.Checker, file *shimast.SourceFile) {
805
- forEachContainer(file.FileName(), file, func(from string, node *shimast.Node) {
816
+ forEachContainer(string(file.FileName()), file, func(from string, node *shimast.Node) {
806
817
  g.typeRefsWithin(checker, from, node)
807
818
  })
808
819
  }
@@ -836,7 +847,7 @@ func (g *Graph) typeRefsWithin(checker *shimchecker.Checker, from string, node *
836
847
  if target := g.assignedFunctionTarget(checker, from, child); target != "" {
837
848
  file := ""
838
849
  if source := shimast.GetSourceFileOfNode(child); source != nil {
839
- file = source.FileName()
850
+ file = string(source.FileName())
840
851
  }
841
852
  g.withEdgeEvidenceFile(target, file, func() {
842
853
  g.typeRefsWithin(checker, target, child.AsBinaryExpression().Right)
@@ -883,7 +894,7 @@ func (g *Graph) ensureTargetNode(target *Target) string {
883
894
  if kind == NodeClass && !target.External {
884
895
  // A named class expression's internal name denotes the same constructor
885
896
  // its variable binds. Keep those self-references on the existing value node.
886
- for _, declaration := range target.Symbol.Declarations {
897
+ for _, declaration := range shimast.SymbolDeclarationsOf(target.Symbol) {
887
898
  if declaration.Kind != shimast.KindClassExpression {
888
899
  continue
889
900
  }
@@ -910,7 +921,7 @@ func (g *Graph) ensureTargetNode(target *Target) string {
910
921
  }
911
922
  return ""
912
923
  }
913
- if kind == NodeVariable && target.External && target.Symbol.Flags&shimast.SymbolFlagsProperty != 0 {
924
+ if kind == NodeVariable && target.External && shimast.SymbolFlagsOf(target.Symbol)&shimast.SymbolFlagsProperty != 0 {
914
925
  return ""
915
926
  }
916
927
  name := qualifiedName(target.Symbol)
@@ -952,9 +963,9 @@ func (g *Graph) ensureTargetNode(target *Target) string {
952
963
  // resolved symbol. Names alone cannot distinguish unindexed shadowing locals;
953
964
  // overloads and merged symbols may legitimately carry several declarations.
954
965
  func nodeDeclaresSymbol(node *Node, symbol *shimast.Symbol) bool {
955
- for _, declaration := range symbol.Declarations {
966
+ for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
956
967
  file := shimast.GetSourceFileOfNode(declaration)
957
- if file != nil && file.FileName() == node.File && declaration.Pos() == node.Pos && declaration.End() == node.End {
968
+ if file != nil && string(file.FileName()) == node.File && declaration.Pos() == node.Pos && declaration.End() == node.End {
958
969
  return true
959
970
  }
960
971
  }
@@ -964,7 +975,7 @@ func nodeDeclaresSymbol(node *Node, symbol *shimast.Symbol) bool {
964
975
  // closureTargetID returns the node id of a closure the checker resolved to, or ""
965
976
  // when the target is not one Build recorded.
966
977
  func (g *Graph) closureTargetID(target *Target) string {
967
- for _, declaration := range target.Symbol.Declarations {
978
+ for _, declaration := range shimast.SymbolDeclarationsOf(target.Symbol) {
968
979
  if !IsClosure(declaration) {
969
980
  continue
970
981
  }
@@ -990,7 +1001,7 @@ func (g *Graph) closureTargetID(target *Target) string {
990
1001
  // resolved as NodeVariable even though Build recorded the getter/setter as a
991
1002
  // NodeMethod.
992
1003
  func symbolNodeKind(symbol *shimast.Symbol) NodeKind {
993
- for _, declaration := range symbol.Declarations {
1004
+ for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
994
1005
  switch declaration.Kind {
995
1006
  case shimast.KindClassDeclaration:
996
1007
  return NodeClass
@@ -1011,21 +1022,21 @@ func symbolNodeKind(symbol *shimast.Symbol) NodeKind {
1011
1022
  }
1012
1023
  }
1013
1024
  switch {
1014
- case symbol.Flags&shimast.SymbolFlagsClass != 0:
1025
+ case shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsClass != 0:
1015
1026
  return NodeClass
1016
- case symbol.Flags&shimast.SymbolFlagsInterface != 0:
1027
+ case shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsInterface != 0:
1017
1028
  return NodeInterface
1018
- case symbol.Flags&shimast.SymbolFlagsTypeAlias != 0:
1029
+ case shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsTypeAlias != 0:
1019
1030
  return NodeTypeAlias
1020
- case symbol.Flags&shimast.SymbolFlagsEnum != 0:
1031
+ case shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsEnum != 0:
1021
1032
  return NodeEnum
1022
- case symbol.Flags&shimast.SymbolFlagsFunction != 0:
1033
+ case shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsFunction != 0:
1023
1034
  return NodeFunction
1024
- case symbol.Flags&(shimast.SymbolFlagsMethod|shimast.SymbolFlagsConstructor|shimast.SymbolFlagsGetAccessor|shimast.SymbolFlagsSetAccessor) != 0:
1035
+ case shimast.SymbolFlagsOf(symbol)&(shimast.SymbolFlagsMethod|shimast.SymbolFlagsConstructor|shimast.SymbolFlagsGetAccessor|shimast.SymbolFlagsSetAccessor) != 0:
1025
1036
  return NodeMethod
1026
- case symbol.Flags&shimast.SymbolFlagsProperty != 0:
1037
+ case shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsProperty != 0:
1027
1038
  return NodeVariable
1028
- case symbol.Flags&shimast.SymbolFlagsVariable != 0:
1039
+ case shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsVariable != 0:
1029
1040
  return NodeVariable
1030
1041
  default:
1031
1042
  return ""
@@ -65,11 +65,11 @@ export class Service<T extends Constraint> extends Base<Payload> {}
65
65
  graph := Build(prog)
66
66
  path := sourceFile(t, prog, "main.ts").FileName()
67
67
 
68
- service := nodeID(path, "Service", NodeClass)
69
- injectable := nodeID(path, "Injectable", NodeFunction)
70
- base := nodeID(path, "Base", NodeClass)
71
- payload := nodeID(path, "Payload", NodeInterface)
72
- constraint := nodeID(path, "Constraint", NodeInterface)
68
+ service := nodeID(string(path), "Service", NodeClass)
69
+ injectable := nodeID(string(path), "Injectable", NodeFunction)
70
+ base := nodeID(string(path), "Base", NodeClass)
71
+ payload := nodeID(string(path), "Payload", NodeInterface)
72
+ constraint := nodeID(string(path), "Constraint", NodeInterface)
73
73
 
74
74
  // The decorator factory call is a fact, not an edge: no value-call to
75
75
  // Injectable, but a recorded decorator on the Service node.
@@ -54,8 +54,8 @@ export enum E {
54
54
 
55
55
  graph := Build(prog)
56
56
  path := sourceFile(t, prog, "main.ts").FileName()
57
- enumID := nodeID(path, "E", NodeEnum)
58
- baseID := nodeID(path, "base", NodeFunction)
57
+ enumID := nodeID(string(path), "E", NodeEnum)
58
+ baseID := nodeID(string(path), "base", NodeFunction)
59
59
 
60
60
  if _, ok := graph.Nodes[enumID]; !ok {
61
61
  t.Fatalf("enum E was not recorded as a node")
@@ -60,7 +60,7 @@ export class Cls {
60
60
  graph := Build(prog)
61
61
  path := sourceFile(t, prog, "main.ts").FileName()
62
62
 
63
- colors, ok := graph.Nodes[nodeID(path, "Colors", NodeEnum)]
63
+ colors, ok := graph.Nodes[nodeID(string(path), "Colors", NodeEnum)]
64
64
  if !ok {
65
65
  t.Fatalf("missing enum node; nodes: %v", nodeIDSet(graph))
66
66
  }
@@ -76,7 +76,7 @@ export class Cls {
76
76
 
77
77
  // The expected numeric values are not written as initializers in the fixture.
78
78
  // This result check does not prove which acquisition method produced them.
79
- implicit := graph.Nodes[nodeID(path, "Implicit", NodeEnum)]
79
+ implicit := graph.Nodes[nodeID(string(path), "Implicit", NodeEnum)]
80
80
  if implicit == nil ||
81
81
  len(implicit.EnumMembers) != 2 ||
82
82
  implicit.EnumMembers[0] != (EnumMember{Name: "First", Value: "0"}) ||
@@ -85,7 +85,7 @@ export class Cls {
85
85
  }
86
86
 
87
87
  // Three declared names must remain even when A and B share one value.
88
- dup := graph.Nodes[nodeID(path, "Dup", NodeEnum)]
88
+ dup := graph.Nodes[nodeID(string(path), "Dup", NodeEnum)]
89
89
  if dup == nil {
90
90
  t.Fatalf("missing Dup; nodes: %v", nodeIDSet(graph))
91
91
  }
@@ -101,15 +101,15 @@ export class Cls {
101
101
 
102
102
  // Reject the two candidate variable-node IDs for the authored Red member.
103
103
  for id := range graph.Nodes {
104
- if id == nodeID(path, "Colors.Red", NodeVariable) ||
105
- id == nodeID(path, "Red", NodeVariable) {
104
+ if id == nodeID(string(path), "Colors.Red", NodeVariable) ||
105
+ id == nodeID(string(path), "Red", NodeVariable) {
106
106
  t.Fatalf("an enum member became a node (%s); it is a fact on the enum", id)
107
107
  }
108
108
  }
109
109
 
110
110
  // The negative twin: this rides on enums only. A class's fields are member
111
111
  // nodes and its outline comes from those.
112
- if cls := graph.Nodes[nodeID(path, "Cls", NodeClass)]; cls == nil ||
112
+ if cls := graph.Nodes[nodeID(string(path), "Cls", NodeClass)]; cls == nil ||
113
113
  len(cls.EnumMembers) != 0 {
114
114
  t.Fatalf("a class node carried enum members: %v", cls)
115
115
  }
@@ -42,7 +42,7 @@ func (g *Graph) markExports(checker *shimchecker.Checker, file *shimast.SourceFi
42
42
  // A re-export is an alias; unwrap it to the declaration it points at so the
43
43
  // exported flag lands on the real node, not a re-exporting index file's
44
44
  // local alias symbol (which has no node of its own).
45
- if symbol.Flags&shimast.SymbolFlagsAlias != 0 {
45
+ if shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsAlias != 0 {
46
46
  if aliased := shimchecker.Checker_getAliasedSymbol(checker, symbol); aliased != nil {
47
47
  symbol = aliased
48
48
  }
@@ -64,16 +64,16 @@ func (g *Graph) markExports(checker *shimchecker.Checker, file *shimast.SourceFi
64
64
  // test suite would leave no trace in the graph.
65
65
  func (g *Graph) putModuleNode(file *shimast.SourceFile) *Node {
66
66
  path := file.FileName()
67
- id := nodeID(path, path, NodeModule)
67
+ id := nodeID(string(path), string(path), NodeModule)
68
68
  if existing, ok := g.Nodes[id]; ok {
69
69
  return existing
70
70
  }
71
71
  node := &Node{
72
72
  ID: id,
73
- Name: path,
74
- Simple: path,
73
+ Name: string(path),
74
+ Simple: string(path),
75
75
  Kind: NodeModule,
76
- File: path,
76
+ File: string(path),
77
77
  // A module that exports is by definition part of some surface; whether it is
78
78
  // the package's front door is the package.json's to say, not the graph's.
79
79
  Exported: true,
@@ -106,7 +106,7 @@ func (g *Graph) markExportedSymbol(symbol *shimast.Symbol) (string, bool) {
106
106
  if name == "" {
107
107
  return "", false
108
108
  }
109
- node, ok := g.lookupNode(nodeID(file.FileName(), name, kind))
109
+ node, ok := g.lookupNode(nodeID(string(file.FileName()), name, kind))
110
110
  if !ok {
111
111
  return "", false
112
112
  }
@@ -40,7 +40,7 @@ func TestFileDiagnosticsMatchTsgoCodeAndLocation(t *testing.T) {
40
40
  defer func() { _ = prog.Close() }()
41
41
 
42
42
  main := sourceFile(t, prog, "main.ts").FileName()
43
- got := FileDiagnostics(prog, main)
43
+ got := FileDiagnostics(prog, string(main))
44
44
 
45
45
  var match *driver.Diagnostic
46
46
  for i := range got {
@@ -55,7 +55,7 @@ func TestFileDiagnosticsMatchTsgoCodeAndLocation(t *testing.T) {
55
55
  if match.Line != 1 {
56
56
  t.Fatalf("TS2322 reported on line %d, expected line 1", match.Line)
57
57
  }
58
- if match.File != main {
58
+ if match.File != string(main) {
59
59
  t.Fatalf("diagnostic file %q is not the queried file %q", match.File, main)
60
60
  }
61
61
  if other := FileDiagnostics(prog, filepath.Join(root, "src", "absent.ts")); len(other) != 0 {
@@ -49,7 +49,7 @@ func TestFileDiagnosticsReportCodeColumnAndMessage(t *testing.T) {
49
49
  defer func() { _ = prog.Close() }()
50
50
 
51
51
  main := sourceFile(t, prog, "main.ts").FileName()
52
- got := FileDiagnostics(prog, main)
52
+ got := FileDiagnostics(prog, string(main))
53
53
 
54
54
  var match *driver.Diagnostic
55
55
  for i := range got {