ttsc 0.33.0 → 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.
- package/README.md +2 -0
- package/cmd/ttsc/api_compile.go +3 -2
- package/cmd/ttsc/api_transform.go +1 -1
- package/cmd/ttsc/build.go +5 -4
- package/cmd/ttsc-cache/account.go +16 -0
- package/cmd/ttsc-cache/account_test.go +91 -0
- package/cmd/ttsc-cache/main.go +1 -1
- package/cmd/ttsc-cache/protocol_test.go +2 -2
- package/cmd/ttsc-cache/publisher_seal_test.go +1 -1
- package/cmd/ttsc-cache/stock_go_failure_test.go +1 -1
- package/cmd/ttsc-cache/stock_go_test.go +2 -2
- package/cmd/ttsc-cache/store.go +5 -0
- package/cmd/ttsc-cache/tuple.go +6 -2
- package/cmd/ttsc-cache/tuple_test.go +1 -1
- package/cmd/ttscgraph/main.go +6 -1
- package/cmd/ttscgraph/run_help_version_and_bad_flags_exit_codes_test.go +6 -1
- package/cmd/ttscgraph/serve.go +22 -20
- package/cmd/ttscgraph/serve_alternative_members_and_reads_refresh_test.go +95 -0
- package/cmd/ttscgraph/serve_shards.go +26 -15
- package/cmd/ttscgraph/serve_shards_abandoned_generation_converges_on_retry_test.go +2 -2
- package/cmd/ttscgraph/serve_shards_delete_removed_source_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_prune_unreferenced_external_endpoints_test.go +1 -1
- package/cmd/ttscgraph/serve_shards_publish_created_source_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_refresh_cross_file_implementation_test.go +2 -2
- package/cmd/ttscgraph/serve_shards_refresh_dependent_diagnostics_test.go +3 -3
- package/cmd/ttscgraph/serve_shards_rename_moves_source_identity_test.go +5 -5
- package/cmd/ttscgraph/serve_shards_reuse_unaffected_sources_test.go +8 -8
- package/cmd/ttscgraph/serve_source_encoding_test.go +2 -2
- package/driver/build_information_uses_selected_output_identity_test.go +5 -4
- package/driver/check_observations.go +1 -1
- package/driver/config_discovery.go +5 -1
- package/driver/declaration_shape.go +15 -21
- package/driver/diagnostics_preamble.go +2 -2
- package/driver/emit_containment.go +11 -14
- package/driver/emit_plugin.go +51 -43
- package/driver/emit_plugin_output.go +6 -5
- package/driver/emit_provenance.go +12 -15
- package/driver/graph.go +8 -8
- package/driver/host.go +15 -5
- package/driver/input_observation.go +22 -21
- package/driver/input_observation_test.go +11 -10
- package/driver/overlay.go +11 -11
- package/driver/program.go +102 -51
- package/driver/resolution_candidates.go +50 -32
- package/driver/resolution_candidates_test.go +18 -5
- package/driver/rewrite.go +11 -13
- package/driver/session.go +13 -7
- package/driver/target_ts70.go +85 -0
- package/driver/target_ts71.go +97 -0
- package/driver/transform_dependencies.go +1 -1
- package/driver/transform_source_map.go +21 -20
- package/go.mod +3 -3
- package/go.sum +4 -4
- package/internal/graph/alternative_member_declarations_resolve_uses_test.go +145 -0
- package/internal/graph/assigned_implementations_of_declaration_file_symbols_leave_no_edge_source_test.go +2 -2
- package/internal/graph/assigned_implementations_of_node_modules_symbols_leave_no_edge_source_test.go +2 -2
- package/internal/graph/build.go +75 -33
- package/internal/graph/build_files_reuses_committed_cross_file_endpoints_test.go +4 -4
- package/internal/graph/build_records_a_node_per_top_level_declaration_test.go +1 -1
- package/internal/graph/declaration_members.go +143 -0
- package/internal/graph/decorators_capture_name_and_literal_arguments_test.go +3 -3
- package/internal/graph/doc_tags.go +2 -2
- package/internal/graph/dump_paths.go +6 -5
- package/internal/graph/duplicate_variable_object_members_keep_first_declaration_test.go +1 -1
- package/internal/graph/edges.go +151 -68
- package/internal/graph/edges_cover_class_level_references_test.go +5 -5
- package/internal/graph/enum_initializer_calls_are_edges_test.go +2 -2
- package/internal/graph/enum_members_carry_their_names_on_the_enum_node_test.go +6 -6
- package/internal/graph/exports.go +6 -6
- package/internal/graph/file_diagnostics_match_tsgo_code_and_location_test.go +2 -2
- package/internal/graph/file_diagnostics_report_code_column_and_message_test.go +1 -1
- package/internal/graph/function_locals_do_not_collide_test.go +3 -3
- package/internal/graph/heritage_edges_cover_implements_and_interface_extends_test.go +5 -5
- package/internal/graph/heritage_edges_keep_extends_and_implements_to_same_base_test.go +2 -2
- package/internal/graph/heritage_edges_record_extends_versus_implements_origin_test.go +3 -3
- package/internal/graph/heritage_edges_traverse_barrels_and_stop_at_external_leaves_test.go +3 -3
- package/internal/graph/literals.go +3 -3
- package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go +2 -2
- package/internal/graph/literals_cover_enum_members_the_graph_has_no_nodes_for_test.go +4 -4
- package/internal/graph/literals_do_not_depend_on_declaration_line_wrapping_test.go +2 -2
- package/internal/graph/literals_render_every_value_in_typescript_source_form_test.go +1 -1
- package/internal/graph/literals_resolve_through_alias_indirection_test.go +3 -3
- package/internal/graph/member_relation_edges_follow_checker_validity_test.go +7 -7
- package/internal/graph/member_relation_edges_preserve_checker_boundaries_test.go +19 -19
- package/internal/graph/member_relation_edges_reject_checker_invalid_pairs_test.go +11 -11
- package/internal/graph/namespace_dotted_form_qualifies_deeply_test.go +2 -2
- package/internal/graph/namespace_members_become_qualified_nodes_and_edges_test.go +7 -7
- package/internal/graph/namespace_private_declarations_keep_lexical_identity_test.go +85 -0
- package/internal/graph/nodes_are_marked_exported_through_the_export_table_test.go +2 -2
- package/internal/graph/object_literal_declarations_resolve_calls_test.go +9 -9
- package/internal/graph/object_literal_members_ride_on_the_snapshot_test.go +1 -1
- package/internal/graph/overload_implementation_replaces_signature_test.go +2 -2
- package/internal/graph/property_member_edges_remain_owner_visible_test.go +6 -6
- package/internal/graph/resolve.go +37 -12
- package/internal/graph/resolve_unwraps_barrel_reexport_to_real_declaration_test.go +6 -6
- package/internal/graph/source.go +1 -1
- package/internal/graph/type_ref_edges_cover_typeof_as_satisfies_test.go +7 -7
- package/internal/graph/type_ref_edges_resolve_named_types_across_files_test.go +2 -2
- package/internal/graph/value_access_edges_cover_properties_test.go +5 -5
- package/internal/graph/value_call_edges_attribute_function_assignments_to_members_test.go +3 -3
- package/internal/graph/value_call_edges_cover_jsx_components_test.go +2 -2
- package/internal/graph/value_call_edges_cover_methods_and_constructors_test.go +3 -3
- package/internal/graph/value_call_edges_cover_variable_bound_callables_test.go +2 -2
- package/internal/graph/value_call_edges_do_not_double_record_invoked_member_access_test.go +4 -4
- package/internal/graph/value_call_edges_record_construct_versus_call_origin_test.go +3 -3
- package/internal/graph/value_call_edges_resolve_across_files_and_dedupe_test.go +2 -2
- package/internal/graph/value_call_edges_skip_self_and_unresolved_test.go +4 -4
- package/internal/graph/value_reads_cover_expression_positions_test.go +88 -0
- package/lib/compiler/internal/buildNativeCompiler.d.ts +5 -2
- package/lib/compiler/internal/buildNativeCompiler.js +12 -4
- package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
- package/lib/flags/COMPILER_ENUM_WHITESPACE.js +1 -1
- package/lib/flags/COMPILER_ENUM_WHITESPACE.js.map +1 -1
- package/lib/flags/COMPILER_OPTIONS.js +1079 -149
- package/lib/flags/COMPILER_OPTIONS.js.map +1 -1
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js +1 -1
- package/lib/flags/COMPILER_OPTION_ASCII_FOLDS.js.map +1 -1
- package/lib/flags/COMPILER_OPTION_KINDS.js +1 -1
- package/lib/flags/COMPILER_OPTION_KINDS.js.map +1 -1
- package/lib/flags/CompilerOptionSpec.d.ts +9 -2
- package/lib/internal/pluginSource.d.ts +1 -0
- package/lib/internal/pluginSource.js +1 -0
- package/lib/internal/pluginSource.js.map +1 -1
- package/lib/launcher/internal/TypeScriptSyncApi.d.ts +140 -0
- package/lib/launcher/internal/TypeScriptSyncApi.js +99 -0
- package/lib/launcher/internal/TypeScriptSyncApi.js.map +1 -0
- package/lib/launcher/internal/buildSingleRootInMemory.d.ts +80 -0
- package/lib/launcher/internal/buildSingleRootInMemory.js +253 -0
- package/lib/launcher/internal/buildSingleRootInMemory.js.map +1 -0
- package/lib/launcher/internal/buildSingleRootProject.d.ts +22 -18
- package/lib/launcher/internal/buildSingleRootProject.js +27 -18
- package/lib/launcher/internal/buildSingleRootProject.js.map +1 -1
- package/lib/launcher/internal/compilerArgsAsConfigOptions.d.ts +39 -0
- package/lib/launcher/internal/compilerArgsAsConfigOptions.js +115 -0
- package/lib/launcher/internal/compilerArgsAsConfigOptions.js.map +1 -0
- package/lib/plugin/CapabilityPluginResolver.js +3 -0
- package/lib/plugin/CapabilityPluginResolver.js.map +1 -1
- package/lib/plugin/internal/load/loadProjectPlugins.js +6 -2
- package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
- package/lib/plugin/internal/source/CompilerTarget.d.ts +127 -0
- package/lib/plugin/internal/source/CompilerTarget.js +231 -0
- package/lib/plugin/internal/source/CompilerTarget.js.map +1 -0
- package/lib/plugin/internal/source/NativeSourcePackages.js +6 -5
- package/lib/plugin/internal/source/NativeSourcePackages.js.map +1 -1
- package/lib/plugin/internal/source/SourcePluginAdmission.d.ts +18 -1
- package/lib/plugin/internal/source/SourcePluginAdmission.js +24 -2
- package/lib/plugin/internal/source/SourcePluginAdmission.js.map +1 -1
- package/lib/plugin/internal/source/SourcePluginWorkspace.d.ts +6 -3
- package/lib/plugin/internal/source/SourcePluginWorkspace.js +31 -13
- package/lib/plugin/internal/source/SourcePluginWorkspace.js.map +1 -1
- package/lib/plugin/internal/source/buildSourcePlugin.js +3 -1
- package/lib/plugin/internal/source/buildSourcePlugin.js.map +1 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts +1 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js +9 -1
- package/lib/plugin/internal/source/hashPluginBuildEnvironment.js.map +1 -1
- package/package.json +14 -9
- package/shim/ast/enums_gen.go +1 -0
- package/shim/ast/go.mod +2 -2
- package/shim/ast/go.sum +4 -4
- package/shim/ast/neutral.go +141 -0
- package/shim/astnav/go.mod +2 -2
- package/shim/astnav/go.sum +4 -4
- package/shim/bundled/go.mod +2 -2
- package/shim/bundled/go.sum +4 -4
- package/shim/checker/go.mod +2 -2
- package/shim/checker/go.sum +4 -4
- package/shim/compiler/go.mod +2 -2
- package/shim/compiler/go.sum +4 -4
- package/shim/compiler/neutral.go +213 -0
- package/shim/core/go.mod +2 -2
- package/shim/core/go.sum +4 -4
- package/shim/diagnosticwriter/go.mod +2 -2
- package/shim/diagnosticwriter/go.sum +4 -4
- package/shim/lsp/go.mod +2 -2
- package/shim/lsp/go.sum +4 -4
- package/shim/parser/go.mod +2 -2
- package/shim/parser/go.sum +4 -4
- package/shim/printer/go.mod +2 -2
- package/shim/printer/go.sum +4 -4
- package/shim/scanner/go.mod +2 -2
- package/shim/scanner/go.sum +4 -4
- package/shim/stringutil/go.mod +1 -1
- package/shim/stringutil/go.sum +2 -2
- package/shim/stringutil/shim.go +15 -0
- package/shim/transformers/go.mod +2 -2
- package/shim/transformers/go.sum +4 -4
- package/shim/tsoptions/go.mod +2 -2
- package/shim/tsoptions/go.sum +4 -4
- package/shim/tsoptions/neutral.go +56 -0
- package/shim/tspath/go.mod +1 -1
- package/shim/tspath/go.sum +2 -2
- package/shim/tspath/neutral.go +150 -0
- package/shim/tspath/typed_paths.go +266 -0
- package/shim/vfs/cachedvfs/go.mod +2 -2
- package/shim/vfs/cachedvfs/go.sum +4 -4
- package/shim/vfs/go.mod +2 -2
- package/shim/vfs/go.sum +4 -4
- package/shim/vfs/neutral.go +20 -0
- package/shim/vfs/osvfs/go.mod +2 -2
- package/shim/vfs/osvfs/go.sum +4 -4
- package/src/compiler/internal/buildNativeCompiler.ts +13 -4
- package/src/flags/COMPILER_ENUM_WHITESPACE.ts +1 -1
- package/src/flags/COMPILER_OPTIONS.ts +1080 -150
- package/src/flags/COMPILER_OPTION_ASCII_FOLDS.ts +1 -1
- package/src/flags/COMPILER_OPTION_KINDS.ts +1 -1
- package/src/flags/CompilerOptionSpec.ts +11 -2
- package/src/internal/pluginSource.ts +1 -0
- package/src/launcher/internal/TypeScriptSyncApi.ts +186 -0
- package/src/launcher/internal/buildSingleRootInMemory.ts +319 -0
- package/src/launcher/internal/buildSingleRootProject.ts +26 -18
- package/src/launcher/internal/compilerArgsAsConfigOptions.ts +112 -0
- package/src/plugin/CapabilityPluginResolver.ts +4 -1
- package/src/plugin/internal/load/loadProjectPlugins.ts +12 -2
- package/src/plugin/internal/source/CompilerTarget.ts +249 -0
- package/src/plugin/internal/source/NativeSourcePackages.ts +10 -4
- package/src/plugin/internal/source/SourcePluginAdmission.ts +28 -2
- package/src/plugin/internal/source/SourcePluginWorkspace.ts +45 -19
- package/src/plugin/internal/source/buildSourcePlugin.ts +3 -1
- package/src/plugin/internal/source/hashPluginBuildEnvironment.ts +9 -1
- package/targets/7.1/bridge/ast/enums_gen.go +174 -0
- package/targets/7.1/bridge/ast/extra-shim.json +4 -0
- package/targets/7.1/bridge/ast/go.mod +14 -0
- package/targets/7.1/bridge/ast/go.sum +20 -0
- package/targets/7.1/bridge/ast/lint.go +1412 -0
- package/targets/7.1/bridge/ast/neutral.go +141 -0
- package/targets/7.1/bridge/ast/parent.go +60 -0
- package/targets/7.1/bridge/ast/safe_text.go +108 -0
- package/targets/7.1/bridge/ast/shim.go +1656 -0
- package/targets/7.1/bridge/ast/surface.go +686 -0
- package/targets/7.1/bridge/ast/test/next_jsdoc_comment_location_reaches_variable_statement_test.go +51 -0
- package/targets/7.1/bridge/ast/test/node_text_joins_multi_hop_qualified_name_test.go +47 -0
- package/targets/7.1/bridge/ast/test/node_text_joins_one_hop_qualified_name_test.go +35 -0
- package/targets/7.1/bridge/ast/test/node_text_returns_empty_for_nil_test.go +31 -0
- package/targets/7.1/bridge/ast/test/node_text_returns_identifier_text_test.go +34 -0
- package/targets/7.1/bridge/ast/test/node_text_skips_empty_qualified_left_test.go +60 -0
- package/targets/7.1/bridge/astnav/go.mod +14 -0
- package/targets/7.1/bridge/astnav/go.sum +22 -0
- package/targets/7.1/bridge/astnav/shim.go +24 -0
- package/targets/7.1/bridge/bundled/extra-shim.json +1 -0
- package/targets/7.1/bridge/bundled/go.mod +10 -0
- package/targets/7.1/bridge/bundled/go.sum +10 -0
- package/targets/7.1/bridge/bundled/shim.go +24 -0
- package/targets/7.1/bridge/checker/enums_gen.go +150 -0
- package/targets/7.1/bridge/checker/extra-shim.json +37 -0
- package/targets/7.1/bridge/checker/go.mod +15 -0
- package/targets/7.1/bridge/checker/go.sum +24 -0
- package/targets/7.1/bridge/checker/node_builder_fields_gen.go +19 -0
- package/targets/7.1/bridge/checker/shim.go +1390 -0
- package/targets/7.1/bridge/compiler/contentmapper_process.go +70 -0
- package/targets/7.1/bridge/compiler/emit_sourcemap.go +296 -0
- package/targets/7.1/bridge/compiler/emitassemble.go +81 -0
- package/targets/7.1/bridge/compiler/emithook.go +44 -0
- package/targets/7.1/bridge/compiler/extra-shim.json +4 -0
- package/targets/7.1/bridge/compiler/go.mod +15 -0
- package/targets/7.1/bridge/compiler/go.sum +24 -0
- package/targets/7.1/bridge/compiler/incremental.go +185 -0
- package/targets/7.1/bridge/compiler/neutral.go +256 -0
- package/targets/7.1/bridge/compiler/resolution.go +571 -0
- package/targets/7.1/bridge/compiler/shim.go +70 -0
- package/targets/7.1/bridge/core/enums_gen.go +15 -0
- package/targets/7.1/bridge/core/extra-shim.json +4 -0
- package/targets/7.1/bridge/core/go.mod +7 -0
- package/targets/7.1/bridge/core/go.sum +8 -0
- package/targets/7.1/bridge/core/modulekind.go +19 -0
- package/targets/7.1/bridge/core/shim.go +272 -0
- package/targets/7.1/bridge/diagnosticwriter/go.mod +14 -0
- package/targets/7.1/bridge/diagnosticwriter/go.sum +20 -0
- package/targets/7.1/bridge/diagnosticwriter/lint.go +411 -0
- package/targets/7.1/bridge/diagnosticwriter/shim.go +56 -0
- package/targets/7.1/bridge/lsp/extra-shim.json +4 -0
- package/targets/7.1/bridge/lsp/go.mod +16 -0
- package/targets/7.1/bridge/lsp/go.sum +26 -0
- package/targets/7.1/bridge/lsp/shim.go +112 -0
- package/targets/7.1/bridge/parser/extra-shim.json +4 -0
- package/targets/7.1/bridge/parser/go.mod +14 -0
- package/targets/7.1/bridge/parser/go.sum +24 -0
- package/targets/7.1/bridge/parser/shim.go +61 -0
- package/targets/7.1/bridge/printer/emithost.go +69 -0
- package/targets/7.1/bridge/printer/go.mod +15 -0
- package/targets/7.1/bridge/printer/go.sum +24 -0
- package/targets/7.1/bridge/printer/shim.go +168 -0
- package/targets/7.1/bridge/printer/sourcemap.go +49 -0
- package/targets/7.1/bridge/scanner/extra-shim.json +4 -0
- package/targets/7.1/bridge/scanner/go.mod +14 -0
- package/targets/7.1/bridge/scanner/go.sum +20 -0
- package/targets/7.1/bridge/scanner/regexp.go +42 -0
- package/targets/7.1/bridge/scanner/shim.go +137 -0
- package/targets/7.1/bridge/stringutil/extra-shim.json +1 -0
- package/targets/7.1/bridge/stringutil/go.mod +5 -0
- package/targets/7.1/bridge/stringutil/go.sum +2 -0
- package/targets/7.1/bridge/stringutil/shim.go +131 -0
- package/targets/7.1/bridge/transformers/go.mod +15 -0
- package/targets/7.1/bridge/transformers/go.sum +24 -0
- package/targets/7.1/bridge/transformers/shim.go +24 -0
- package/targets/7.1/bridge/tsoptions/command_line_raw.go +44 -0
- package/targets/7.1/bridge/tsoptions/extra-shim.json +4 -0
- package/targets/7.1/bridge/tsoptions/go.mod +15 -0
- package/targets/7.1/bridge/tsoptions/go.sum +24 -0
- package/targets/7.1/bridge/tsoptions/neutral.go +47 -0
- package/targets/7.1/bridge/tsoptions/shim.go +193 -0
- package/targets/7.1/bridge/tspath/extra-shim.json +4 -0
- package/targets/7.1/bridge/tspath/go.mod +5 -0
- package/targets/7.1/bridge/tspath/go.sum +6 -0
- package/targets/7.1/bridge/tspath/neutral.go +142 -0
- package/targets/7.1/bridge/tspath/shim.go +382 -0
- package/targets/7.1/bridge/vfs/cachedvfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/cachedvfs/go.mod +5 -0
- package/targets/7.1/bridge/vfs/cachedvfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/cachedvfs/shim.go +12 -0
- package/targets/7.1/bridge/vfs/decode.go +26 -0
- package/targets/7.1/bridge/vfs/decode_test.go +42 -0
- package/targets/7.1/bridge/vfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/go.mod +10 -0
- package/targets/7.1/bridge/vfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/neutral.go +23 -0
- package/targets/7.1/bridge/vfs/osvfs/extra-shim.json +4 -0
- package/targets/7.1/bridge/vfs/osvfs/go.mod +10 -0
- package/targets/7.1/bridge/vfs/osvfs/go.sum +10 -0
- package/targets/7.1/bridge/vfs/osvfs/shim.go +14 -0
- package/targets/7.1/bridge/vfs/shim.go +27 -0
- package/targets/7.1/facade/ast/facade_gen.go +2691 -0
- package/targets/7.1/facade/ast/go.mod +20 -0
- package/targets/7.1/facade/ast/go.sum +20 -0
- package/targets/7.1/facade/astnav/facade_gen.go +15 -0
- package/targets/7.1/facade/astnav/go.mod +22 -0
- package/targets/7.1/facade/astnav/go.sum +22 -0
- package/targets/7.1/facade/bundled/facade_gen.go +32 -0
- package/targets/7.1/facade/bundled/go.mod +21 -0
- package/targets/7.1/facade/bundled/go.sum +10 -0
- package/targets/7.1/facade/checker/facade_gen.go +563 -0
- package/targets/7.1/facade/checker/go.mod +26 -0
- package/targets/7.1/facade/checker/go.sum +24 -0
- package/targets/7.1/facade/compiler/facade_gen.go +198 -0
- package/targets/7.1/facade/compiler/go.mod +41 -0
- package/targets/7.1/facade/compiler/go.sum +24 -0
- package/targets/7.1/facade/core/facade_gen.go +130 -0
- package/targets/7.1/facade/core/go.mod +12 -0
- package/targets/7.1/facade/core/go.sum +8 -0
- package/targets/7.1/facade/diagnosticwriter/facade_gen.go +36 -0
- package/targets/7.1/facade/diagnosticwriter/go.mod +22 -0
- package/targets/7.1/facade/diagnosticwriter/go.sum +20 -0
- package/targets/7.1/facade/lsp/facade_gen.go +31 -0
- package/targets/7.1/facade/lsp/go.mod +19 -0
- package/targets/7.1/facade/lsp/go.sum +26 -0
- package/targets/7.1/facade/parser/facade_gen.go +102 -0
- package/targets/7.1/facade/parser/go.mod +25 -0
- package/targets/7.1/facade/parser/go.sum +24 -0
- package/targets/7.1/facade/printer/facade_gen.go +74 -0
- package/targets/7.1/facade/printer/go.mod +26 -0
- package/targets/7.1/facade/printer/go.sum +24 -0
- package/targets/7.1/facade/scanner/facade_gen.go +191 -0
- package/targets/7.1/facade/scanner/go.mod +25 -0
- package/targets/7.1/facade/scanner/go.sum +20 -0
- package/targets/7.1/facade/stringutil/facade_gen.go +176 -0
- package/targets/7.1/facade/stringutil/go.mod +9 -0
- package/targets/7.1/facade/stringutil/go.sum +2 -0
- package/targets/7.1/facade/transformers/facade_gen.go +12 -0
- package/targets/7.1/facade/transformers/go.mod +18 -0
- package/targets/7.1/facade/transformers/go.sum +24 -0
- package/targets/7.1/facade/tsoptions/facade_gen.go +274 -0
- package/targets/7.1/facade/tsoptions/go.mod +32 -0
- package/targets/7.1/facade/tsoptions/go.sum +24 -0
- package/targets/7.1/facade/tspath/facade_gen.go +550 -0
- package/targets/7.1/facade/tspath/go.mod +9 -0
- package/targets/7.1/facade/tspath/go.sum +6 -0
- package/targets/7.1/facade/vfs/cachedvfs/facade_gen.go +17 -0
- package/targets/7.1/facade/vfs/cachedvfs/go.mod +18 -0
- package/targets/7.1/facade/vfs/cachedvfs/go.sum +10 -0
- package/targets/7.1/facade/vfs/facade_gen.go +47 -0
- package/targets/7.1/facade/vfs/go.mod +18 -0
- package/targets/7.1/facade/vfs/go.sum +10 -0
- package/targets/7.1/facade/vfs/osvfs/facade_gen.go +20 -0
- package/targets/7.1/facade/vfs/osvfs/go.mod +21 -0
- package/targets/7.1/facade/vfs/osvfs/go.sum +10 -0
- package/tools/gen_facade/committed_facades_match_their_bridges_test.go +57 -0
- package/tools/gen_facade/facade_manifest_points_into_the_bridge_root_test.go +75 -0
- package/tools/gen_facade/facade_spells_internal_types_through_bridge_aliases_test.go +75 -0
- package/tools/gen_facade/facade_types_are_their_bridge_types_test.go +99 -0
- package/tools/gen_facade/go.mod +10 -0
- package/tools/gen_facade/go.sum +8 -0
- package/tools/gen_facade/main.go +734 -0
- package/tools/gen_shims/go.mod +4 -4
- package/tools/gen_shims/go.sum +6 -6
- package/tools/gen_shims/main.go +124 -66
- package/tools/gen_shims/mirror_structs_terminate_on_unexported_cycles_test.go +101 -0
- package/tools/shim_audit/baseline-7.1.json +720 -0
- package/tools/shim_audit/baseline.json +5 -4
- package/tools/shim_audit/go.mod +4 -4
- package/tools/shim_audit/go.sum +6 -6
- package/tools/shim_audit/linkname_signatures.go +178 -0
- package/tools/shim_audit/linkname_signatures_match_their_targets_test.go +64 -0
- package/tools/shim_audit/linkname_targets_follow_the_audited_compiler_test.go +38 -0
- package/tools/shim_audit/main.go +29 -4
- package/tools/shim_audit/neutral_api.go +160 -0
- package/tools/shim_audit/neutral_api_must_match_across_targets_test.go +74 -0
- package/utility/host.go +5 -4
- package/utility/preamble_output.go +15 -15
- package/utility/serve.go +1 -1
package/internal/graph/build.go
CHANGED
|
@@ -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,14 +184,12 @@ 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
|
-
// collectStatements records
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
// chain, so a node recorded here and an edge target resolved later agree without
|
|
194
|
-
// the walk having to thread the namespace name through.
|
|
190
|
+
// collectStatements records a file or namespace statement list. qualifiedName
|
|
191
|
+
// combines compiler symbol ownership with lexical namespaces for private
|
|
192
|
+
// declarations, keeping indexed nodes and later resolved targets consistent.
|
|
195
193
|
func collectStatements(g *Graph, path string, statements []*shimast.Node) {
|
|
196
194
|
for _, statement := range statements {
|
|
197
195
|
switch statement.Kind {
|
|
@@ -214,6 +212,7 @@ func collectStatements(g *Graph, path string, statements []*shimast.Node) {
|
|
|
214
212
|
collectMembers(g, path, statement)
|
|
215
213
|
case shimast.KindTypeAliasDeclaration:
|
|
216
214
|
addNode(g, path, statement, NodeTypeAlias)
|
|
215
|
+
collectMembers(g, path, statement)
|
|
217
216
|
case shimast.KindEnumDeclaration:
|
|
218
217
|
addNode(g, path, statement, NodeEnum)
|
|
219
218
|
case shimast.KindVariableStatement:
|
|
@@ -242,6 +241,9 @@ func collectVariables(g *Graph, path string, statement *shimast.Node) {
|
|
|
242
241
|
for _, binding := range list.Declarations.Nodes {
|
|
243
242
|
addNode(g, path, binding, NodeVariable)
|
|
244
243
|
g.collectObjectMembers(path, binding)
|
|
244
|
+
if expression := boundClassExpression(binding); expression != nil {
|
|
245
|
+
collectMembers(g, path, expression)
|
|
246
|
+
}
|
|
245
247
|
collectClosures(g, path, binding)
|
|
246
248
|
}
|
|
247
249
|
}
|
|
@@ -527,15 +529,15 @@ func functionBodyOfInitializer(initializer *shimast.Node) *shimast.Node {
|
|
|
527
529
|
// code instead of just the overload header.
|
|
528
530
|
func addNode(g *Graph, path string, node *shimast.Node, kind NodeKind) {
|
|
529
531
|
symbol := node.Symbol()
|
|
530
|
-
if symbol == nil || symbol
|
|
532
|
+
if symbol == nil || shimast.SymbolNameOf(symbol) == "" {
|
|
531
533
|
return
|
|
532
534
|
}
|
|
533
535
|
putDeclaredNode(g, path, qualifiedName(symbol), kind, node)
|
|
534
536
|
}
|
|
535
537
|
|
|
536
|
-
// collectMembers records callable members
|
|
537
|
-
//
|
|
538
|
-
//
|
|
538
|
+
// collectMembers records callable and property members of modeled type and
|
|
539
|
+
// class declarations. Structural and lexical owner names are shared with
|
|
540
|
+
// checker-resolved targets, including parameter properties and bound literals.
|
|
539
541
|
func collectMembers(g *Graph, path string, statement *shimast.Node) {
|
|
540
542
|
for _, member := range classMembers(statement) {
|
|
541
543
|
name := methodName(member.Symbol())
|
|
@@ -650,20 +652,44 @@ func declarationHasImplementation(declaration *shimast.Node, kind NodeKind) bool
|
|
|
650
652
|
}
|
|
651
653
|
}
|
|
652
654
|
|
|
653
|
-
// classMembers returns
|
|
654
|
-
//
|
|
655
|
+
// classMembers returns direct class/interface members, constructor parameter
|
|
656
|
+
// properties and named nested type-literal members. Type aliases and bound class
|
|
657
|
+
// expressions use the same member surface for indexing and edge attribution.
|
|
655
658
|
func classMembers(statement *shimast.Node) []*shimast.Node {
|
|
659
|
+
var members []*shimast.Node
|
|
656
660
|
switch statement.Kind {
|
|
657
661
|
case shimast.KindClassDeclaration:
|
|
658
662
|
if decl := statement.AsClassDeclaration(); decl != nil && decl.Members != nil {
|
|
659
|
-
|
|
663
|
+
members = decl.Members.Nodes
|
|
664
|
+
}
|
|
665
|
+
case shimast.KindClassExpression:
|
|
666
|
+
if decl := statement.AsClassExpression(); decl != nil && decl.Members != nil {
|
|
667
|
+
members = decl.Members.Nodes
|
|
660
668
|
}
|
|
661
669
|
case shimast.KindInterfaceDeclaration:
|
|
662
670
|
if decl := statement.AsInterfaceDeclaration(); decl != nil && decl.Members != nil {
|
|
663
|
-
|
|
671
|
+
members = decl.Members.Nodes
|
|
672
|
+
}
|
|
673
|
+
case shimast.KindTypeAliasDeclaration:
|
|
674
|
+
return typeLiteralMembers(statement.Type())
|
|
675
|
+
}
|
|
676
|
+
var extra []*shimast.Node
|
|
677
|
+
for _, member := range members {
|
|
678
|
+
if member.Kind == shimast.KindConstructor {
|
|
679
|
+
for _, parameter := range member.Parameters() {
|
|
680
|
+
if isParameterProperty(parameter) {
|
|
681
|
+
extra = append(extra, parameter)
|
|
682
|
+
}
|
|
683
|
+
}
|
|
664
684
|
}
|
|
685
|
+
extra = append(extra, typeLiteralMembers(member.Type())...)
|
|
665
686
|
}
|
|
666
|
-
|
|
687
|
+
if len(extra) == 0 {
|
|
688
|
+
return members
|
|
689
|
+
}
|
|
690
|
+
result := make([]*shimast.Node, 0, len(members)+len(extra))
|
|
691
|
+
result = append(result, members...)
|
|
692
|
+
return append(result, extra...)
|
|
667
693
|
}
|
|
668
694
|
|
|
669
695
|
// isMethodMember reports whether a class/interface member kind is a callable the
|
|
@@ -680,7 +706,7 @@ func isMethodMember(kind shimast.Kind) bool {
|
|
|
680
706
|
|
|
681
707
|
func isPropertyMember(kind shimast.Kind) bool {
|
|
682
708
|
switch kind {
|
|
683
|
-
case shimast.KindPropertyDeclaration, shimast.KindPropertySignature:
|
|
709
|
+
case shimast.KindPropertyDeclaration, shimast.KindPropertySignature, shimast.KindParameter:
|
|
684
710
|
return true
|
|
685
711
|
default:
|
|
686
712
|
return false
|
|
@@ -693,7 +719,10 @@ func isPropertyMember(kind shimast.Kind) bool {
|
|
|
693
719
|
// symbol.Parent is the class/interface symbol, set by the binder for every
|
|
694
720
|
// member.
|
|
695
721
|
func methodName(symbol *shimast.Symbol) string {
|
|
696
|
-
if
|
|
722
|
+
if name, ok := structuralMemberName(symbol); ok {
|
|
723
|
+
return name
|
|
724
|
+
}
|
|
725
|
+
if symbol == nil || shimast.SymbolParentOf(symbol) == nil || shimast.SymbolNameOf(shimast.SymbolParentOf(symbol)) == "" {
|
|
697
726
|
return ""
|
|
698
727
|
}
|
|
699
728
|
return qualifiedName(symbol)
|
|
@@ -704,11 +733,11 @@ func methodName(symbol *shimast.Symbol) string {
|
|
|
704
733
|
// private declaration loses its binder counter; public literal names can contain
|
|
705
734
|
// the same text. A constructor's internal-name prefix (\xFE) becomes "__".
|
|
706
735
|
func simpleName(symbol *shimast.Symbol) string {
|
|
707
|
-
if symbol == nil || symbol
|
|
736
|
+
if symbol == nil || shimast.SymbolNameOf(symbol) == "" {
|
|
708
737
|
return ""
|
|
709
738
|
}
|
|
710
|
-
name := strings.ReplaceAll(symbol
|
|
711
|
-
for _, declaration := range symbol
|
|
739
|
+
name := strings.ReplaceAll(shimast.SymbolNameOf(symbol), "\xFE", "__")
|
|
740
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
712
741
|
if declared := declaration.Name(); declared != nil && declared.Kind == shimast.KindPrivateIdentifier {
|
|
713
742
|
return stripPrivateMangling(name)
|
|
714
743
|
}
|
|
@@ -758,11 +787,14 @@ func qualifiedName(symbol *shimast.Symbol) string {
|
|
|
758
787
|
if symbol == nil {
|
|
759
788
|
return ""
|
|
760
789
|
}
|
|
761
|
-
for _, declaration := range symbol
|
|
790
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
762
791
|
if name, ok := objectDeclarationName(declaration); ok {
|
|
763
792
|
return name
|
|
764
793
|
}
|
|
765
794
|
}
|
|
795
|
+
if name, ok := structuralMemberName(symbol); ok {
|
|
796
|
+
return name
|
|
797
|
+
}
|
|
766
798
|
name := simpleName(symbol)
|
|
767
799
|
if prefix := containerPrefix(symbol); prefix != "" {
|
|
768
800
|
return prefix + "." + name
|
|
@@ -775,13 +807,23 @@ func qualifiedName(symbol *shimast.Symbol) string {
|
|
|
775
807
|
// module symbol is not a namespace — its declaration is the file, not a
|
|
776
808
|
// `namespace` block — so a top-level declaration gets no prefix.
|
|
777
809
|
func containerPrefix(symbol *shimast.Symbol) string {
|
|
778
|
-
parent := symbol
|
|
779
|
-
if parent
|
|
780
|
-
return ""
|
|
781
|
-
}
|
|
782
|
-
if isNamespaceSymbol(parent) || isTypeContainerSymbol(parent) {
|
|
810
|
+
parent := shimast.SymbolParentOf(symbol)
|
|
811
|
+
if parent != nil && shimast.SymbolNameOf(parent) != "" && (isNamespaceSymbol(parent) || isTypeContainerSymbol(parent)) {
|
|
783
812
|
return qualifiedName(parent)
|
|
784
813
|
}
|
|
814
|
+
// The binder does not assign Symbol.Parent to private namespace locals.
|
|
815
|
+
// Their lexical namespace still owns their identity. Stop at a callable so
|
|
816
|
+
// ClosureName remains the owner of function-local qualification.
|
|
817
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
818
|
+
for owner := declaration.Parent; owner != nil; owner = owner.Parent {
|
|
819
|
+
if isFunctionLike(owner) {
|
|
820
|
+
break
|
|
821
|
+
}
|
|
822
|
+
if owner.Kind == shimast.KindModuleDeclaration && owner.Symbol() != nil && isNamespaceSymbol(owner.Symbol()) {
|
|
823
|
+
return qualifiedName(owner.Symbol())
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
785
827
|
return ""
|
|
786
828
|
}
|
|
787
829
|
|
|
@@ -791,10 +833,10 @@ func containerPrefix(symbol *shimast.Symbol) string {
|
|
|
791
833
|
// also module declarations, but qualifying members by their quoted or internal
|
|
792
834
|
// names would produce malformed ids, so they are excluded.
|
|
793
835
|
func isNamespaceSymbol(symbol *shimast.Symbol) bool {
|
|
794
|
-
if strings.HasPrefix(symbol
|
|
836
|
+
if strings.HasPrefix(shimast.SymbolNameOf(symbol), "\"") || strings.Contains(shimast.SymbolNameOf(symbol), "\xFE") {
|
|
795
837
|
return false
|
|
796
838
|
}
|
|
797
|
-
for _, declaration := range symbol
|
|
839
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
798
840
|
if declaration.Kind == shimast.KindModuleDeclaration {
|
|
799
841
|
return true
|
|
800
842
|
}
|
|
@@ -805,7 +847,7 @@ func isNamespaceSymbol(symbol *shimast.Symbol) bool {
|
|
|
805
847
|
// isTypeContainerSymbol reports whether symbol is a class or interface, whose
|
|
806
848
|
// members the graph qualifies ("Class.method").
|
|
807
849
|
func isTypeContainerSymbol(symbol *shimast.Symbol) bool {
|
|
808
|
-
return symbol
|
|
850
|
+
return shimast.SymbolFlagsOf(symbol)&(shimast.SymbolFlagsClass|shimast.SymbolFlagsInterface) != 0
|
|
809
851
|
}
|
|
810
852
|
|
|
811
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))
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
package graph
|
|
2
|
+
|
|
3
|
+
import shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
4
|
+
|
|
5
|
+
// structuralMemberName replaces anonymous type/class binder containers with
|
|
6
|
+
// the declaration that names them. An unbound literal has no stable owner.
|
|
7
|
+
func structuralMemberName(symbol *shimast.Symbol) (string, bool) {
|
|
8
|
+
if symbol == nil {
|
|
9
|
+
return "", false
|
|
10
|
+
}
|
|
11
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
12
|
+
parent := declaration.Parent
|
|
13
|
+
if parent == nil {
|
|
14
|
+
continue
|
|
15
|
+
}
|
|
16
|
+
var owner string
|
|
17
|
+
switch {
|
|
18
|
+
case parent.Kind == shimast.KindTypeLiteral:
|
|
19
|
+
owner = typeLiteralOwner(parent)
|
|
20
|
+
case parent.Kind == shimast.KindClassExpression:
|
|
21
|
+
owner = classExpressionOwner(parent)
|
|
22
|
+
case isParameterProperty(declaration):
|
|
23
|
+
class := parent.Parent
|
|
24
|
+
if class != nil && class.Kind == shimast.KindClassExpression {
|
|
25
|
+
owner = classExpressionOwner(class)
|
|
26
|
+
} else if class != nil && class.Symbol() != nil {
|
|
27
|
+
owner = qualifiedName(class.Symbol())
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if owner != "" {
|
|
31
|
+
return appendObjectMemberName(owner, simpleName(symbol)), true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return "", false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// typeLiteralOwner follows only type structure with a named declaration owner;
|
|
38
|
+
// a function return or parameter type is not a property of that function.
|
|
39
|
+
func typeLiteralOwner(literal *shimast.Node) string {
|
|
40
|
+
for node := literal.Parent; node != nil; node = node.Parent {
|
|
41
|
+
switch node.Kind {
|
|
42
|
+
case shimast.KindUnionType, shimast.KindIntersectionType, shimast.KindParenthesizedType:
|
|
43
|
+
continue
|
|
44
|
+
case shimast.KindTypeAliasDeclaration, shimast.KindPropertySignature, shimast.KindPropertyDeclaration:
|
|
45
|
+
if node.Symbol() != nil {
|
|
46
|
+
return qualifiedName(node.Symbol())
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
break
|
|
50
|
+
}
|
|
51
|
+
return ""
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// typeLiteralMembers enumerates statically owned literal members once in AST
|
|
55
|
+
// order, including literals nested under named properties and intersections.
|
|
56
|
+
func typeLiteralMembers(typeNode *shimast.Node) []*shimast.Node {
|
|
57
|
+
if typeNode == nil {
|
|
58
|
+
return nil
|
|
59
|
+
}
|
|
60
|
+
var members []*shimast.Node
|
|
61
|
+
var walk func(*shimast.Node)
|
|
62
|
+
walk = func(node *shimast.Node) {
|
|
63
|
+
if node.Kind == shimast.KindTypeLiteral {
|
|
64
|
+
literal := node.AsTypeLiteralNode()
|
|
65
|
+
if typeLiteralOwner(node) == "" || literal.Members == nil {
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
for _, member := range literal.Members.Nodes {
|
|
69
|
+
if _, ok := staticObjectMemberName(member.Name()); !ok {
|
|
70
|
+
continue
|
|
71
|
+
}
|
|
72
|
+
members = append(members, member)
|
|
73
|
+
walkType := member.Type()
|
|
74
|
+
if walkType != nil {
|
|
75
|
+
walk(walkType)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
switch node.Kind {
|
|
81
|
+
case shimast.KindUnionType, shimast.KindIntersectionType, shimast.KindParenthesizedType:
|
|
82
|
+
node.ForEachChild(func(child *shimast.Node) bool { walk(child); return false })
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
walk(typeNode)
|
|
86
|
+
return members
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// isParameterProperty admits constructor parameters with a property modifier,
|
|
90
|
+
// leaving ordinary parameters local to their constructor.
|
|
91
|
+
func isParameterProperty(node *shimast.Node) bool {
|
|
92
|
+
return node.Kind == shimast.KindParameter && node.Parent != nil && node.Parent.Kind == shimast.KindConstructor &&
|
|
93
|
+
shimast.GetCombinedModifierFlags(node)&shimast.ModifierFlagsParameterPropertyModifier != 0
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// boundClassExpression unwraps the transparent expression forms around a
|
|
97
|
+
// variable's class initializer, without guessing classes returned by factories.
|
|
98
|
+
func boundClassExpression(binding *shimast.Node) *shimast.Node {
|
|
99
|
+
variable := binding.AsVariableDeclaration()
|
|
100
|
+
if variable == nil {
|
|
101
|
+
return nil
|
|
102
|
+
}
|
|
103
|
+
node := variable.Initializer
|
|
104
|
+
for node != nil {
|
|
105
|
+
switch node.Kind {
|
|
106
|
+
case shimast.KindClassExpression:
|
|
107
|
+
return node
|
|
108
|
+
case shimast.KindParenthesizedExpression, shimast.KindAsExpression, shimast.KindSatisfiesExpression,
|
|
109
|
+
shimast.KindTypeAssertionExpression, shimast.KindNonNullExpression:
|
|
110
|
+
node = node.Expression()
|
|
111
|
+
default:
|
|
112
|
+
return nil
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return nil
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// classExpressionOwner uses the outer binding even for a named expression;
|
|
119
|
+
// its internal class name is private to that expression's body.
|
|
120
|
+
func classExpressionOwner(expression *shimast.Node) string {
|
|
121
|
+
if binding := classExpressionBinding(expression); binding != nil {
|
|
122
|
+
return qualifiedName(binding.Symbol())
|
|
123
|
+
}
|
|
124
|
+
return ""
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// classExpressionBinding preserves the actual declaration behind an owner
|
|
128
|
+
// name, so a shadowing local cannot borrow a same-named indexed value.
|
|
129
|
+
func classExpressionBinding(expression *shimast.Node) *shimast.Node {
|
|
130
|
+
for parent := expression.Parent; parent != nil; parent = parent.Parent {
|
|
131
|
+
switch parent.Kind {
|
|
132
|
+
case shimast.KindParenthesizedExpression, shimast.KindAsExpression, shimast.KindSatisfiesExpression,
|
|
133
|
+
shimast.KindTypeAssertionExpression, shimast.KindNonNullExpression:
|
|
134
|
+
continue
|
|
135
|
+
case shimast.KindVariableDeclaration:
|
|
136
|
+
if parent.Symbol() != nil && boundClassExpression(parent) == expression {
|
|
137
|
+
return parent
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
break
|
|
141
|
+
}
|
|
142
|
+
return nil
|
|
143
|
+
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
caseSensitivity := shimtspath.CaseInsensitive
|
|
192
|
+
if m.caseSensitive {
|
|
193
|
+
caseSensitivity = shimtspath.CaseSensitive
|
|
193
194
|
}
|
|
194
|
-
wire := shimtspath.
|
|
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
|
}
|