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.
- 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_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 +9 -9
- 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 +17 -17
- 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 +1 -1
- 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 +49 -38
- 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 +5 -5
- 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 +7 -7
- 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 +6 -6
- 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
|
@@ -64,17 +64,17 @@ export function outerB(): number {
|
|
|
64
64
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
65
65
|
|
|
66
66
|
for _, owner := range []string{"outerA", "outerB"} {
|
|
67
|
-
localID := nodeID(path, owner+".inner", NodeFunction)
|
|
67
|
+
localID := nodeID(string(path), owner+".inner", NodeFunction)
|
|
68
68
|
if local := graph.Nodes[localID]; local == nil || local.Name != owner+".inner" {
|
|
69
69
|
t.Fatalf("missing scoped local %s.inner; nodes: %v", owner, nodeIDSet(graph))
|
|
70
70
|
}
|
|
71
|
-
if !hasEdge(graph, nodeID(path, owner, NodeFunction), localID, EdgeValueCall) {
|
|
71
|
+
if !hasEdge(graph, nodeID(string(path), owner, NodeFunction), localID, EdgeValueCall) {
|
|
72
72
|
t.Fatalf("missing %s -> %s.inner call; edges: %v", owner, owner, graph.Edges)
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// No unqualified function-local node is minted...
|
|
77
|
-
if _, ok := graph.Nodes[nodeID(path, "inner", NodeFunction)]; ok {
|
|
77
|
+
if _, ok := graph.Nodes[nodeID(string(path), "inner", NodeFunction)]; ok {
|
|
78
78
|
t.Fatalf("a function-local 'inner' was minted as a node (would collide across scopes)")
|
|
79
79
|
}
|
|
80
80
|
// ...so no edge points at a phantom shared 'inner'.
|
|
@@ -58,11 +58,11 @@ export class Unrelated {
|
|
|
58
58
|
graph := Build(prog)
|
|
59
59
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
60
60
|
|
|
61
|
-
base := nodeID(path, "Base", NodeInterface)
|
|
62
|
-
derived := nodeID(path, "Derived", NodeInterface)
|
|
63
|
-
impl := nodeID(path, "Impl", NodeClass)
|
|
64
|
-
unrelated := nodeID(path, "Unrelated", NodeClass)
|
|
65
|
-
greet := nodeID(path, "Unrelated.greet", NodeMethod)
|
|
61
|
+
base := nodeID(string(path), "Base", NodeInterface)
|
|
62
|
+
derived := nodeID(string(path), "Derived", NodeInterface)
|
|
63
|
+
impl := nodeID(string(path), "Impl", NodeClass)
|
|
64
|
+
unrelated := nodeID(string(path), "Unrelated", NodeClass)
|
|
65
|
+
greet := nodeID(string(path), "Unrelated.greet", NodeMethod)
|
|
66
66
|
|
|
67
67
|
// Interface `extends`: Derived inherits Base.
|
|
68
68
|
if !hasEdge(graph, derived, base, EdgeHeritage) {
|
|
@@ -48,8 +48,8 @@ export class Derived extends Base implements Base {}
|
|
|
48
48
|
graph := Build(prog)
|
|
49
49
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
50
50
|
|
|
51
|
-
derived := nodeID(path, "Derived", NodeClass)
|
|
52
|
-
base := nodeID(path, "Base", NodeClass)
|
|
51
|
+
derived := nodeID(string(path), "Derived", NodeClass)
|
|
52
|
+
base := nodeID(string(path), "Base", NodeClass)
|
|
53
53
|
|
|
54
54
|
wireKinds := map[string]bool{}
|
|
55
55
|
for _, edge := range graph.Edges {
|
|
@@ -47,9 +47,9 @@ export class Sub extends Sup implements Iface {}
|
|
|
47
47
|
graph := Build(prog)
|
|
48
48
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
49
49
|
|
|
50
|
-
sub := nodeID(path, "Sub", NodeClass)
|
|
51
|
-
sup := nodeID(path, "Sup", NodeClass)
|
|
52
|
-
iface := nodeID(path, "Iface", NodeInterface)
|
|
50
|
+
sub := nodeID(string(path), "Sub", NodeClass)
|
|
51
|
+
sup := nodeID(string(path), "Sup", NodeClass)
|
|
52
|
+
iface := nodeID(string(path), "Iface", NodeInterface)
|
|
53
53
|
|
|
54
54
|
if got := edgeOrigin(graph, sub, sup, EdgeHeritage); got != "extends" {
|
|
55
55
|
t.Fatalf("Sub -> Sup: want heritage Origin \"extends\", got %q; edges: %v", got, graph.Edges)
|
|
@@ -63,11 +63,11 @@ export class SubExt extends Ext {}
|
|
|
63
63
|
implPath := sourceFile(t, prog, "impl.ts").FileName()
|
|
64
64
|
|
|
65
65
|
// Barrel traversal: the base resolved to the sibling source, not the index.
|
|
66
|
-
base := nodeID(implPath, "Base", NodeClass)
|
|
66
|
+
base := nodeID(string(implPath), "Base", NodeClass)
|
|
67
67
|
if node, ok := graph.Nodes[base]; !ok || node.External {
|
|
68
68
|
t.Fatalf("Base node missing or misclassified external (barrel not traversed): %+v", node)
|
|
69
69
|
}
|
|
70
|
-
sub := nodeID(mainPath, "Sub", NodeClass)
|
|
70
|
+
sub := nodeID(string(mainPath), "Sub", NodeClass)
|
|
71
71
|
if !hasEdge(graph, sub, base, EdgeHeritage) {
|
|
72
72
|
t.Fatalf("missing heritage edge Sub -> Base@impl.ts; edges: %v", graph.Edges)
|
|
73
73
|
}
|
|
@@ -81,7 +81,7 @@ export class SubExt extends Ext {}
|
|
|
81
81
|
if !ext.External || !strings.Contains(ext.File, "/node_modules/") {
|
|
82
82
|
t.Fatalf("Ext should be an external node_modules leaf: %+v", ext)
|
|
83
83
|
}
|
|
84
|
-
subExt := nodeID(mainPath, "SubExt", NodeClass)
|
|
84
|
+
subExt := nodeID(string(mainPath), "SubExt", NodeClass)
|
|
85
85
|
if !hasEdge(graph, subExt, ext.ID, EdgeHeritage) {
|
|
86
86
|
t.Fatalf("missing heritage edge SubExt -> Ext (external); edges: %v", graph.Edges)
|
|
87
87
|
}
|
|
@@ -28,7 +28,7 @@ func (g *Graph) collectLiterals(checker *shimchecker.Checker, file *shimast.Sour
|
|
|
28
28
|
if file.Statements == nil {
|
|
29
29
|
return
|
|
30
30
|
}
|
|
31
|
-
g.collectLiteralsIn(checker, file.FileName(), file.Statements.Nodes)
|
|
31
|
+
g.collectLiteralsIn(checker, string(file.FileName()), file.Statements.Nodes)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// collectLiteralsIn walks a statement list — a file's top level, or a namespace
|
|
@@ -54,7 +54,7 @@ func (g *Graph) collectLiteralsIn(checker *shimchecker.Checker, path string, sta
|
|
|
54
54
|
// left alone rather than given a partial one.
|
|
55
55
|
func (g *Graph) putLiterals(checker *shimchecker.Checker, path string, statement *shimast.Node, kind NodeKind) {
|
|
56
56
|
symbol := statement.Symbol()
|
|
57
|
-
if symbol == nil || symbol
|
|
57
|
+
if symbol == nil || shimast.SymbolNameOf(symbol) == "" {
|
|
58
58
|
return
|
|
59
59
|
}
|
|
60
60
|
node, ok := g.Nodes[nodeID(path, qualifiedName(symbol), kind)]
|
|
@@ -103,7 +103,7 @@ func enumMembers(checker *shimchecker.Checker, statement *shimast.Node) []EnumMe
|
|
|
103
103
|
if symbol == nil {
|
|
104
104
|
continue
|
|
105
105
|
}
|
|
106
|
-
member := EnumMember{Name: symbol
|
|
106
|
+
member := EnumMember{Name: shimast.SymbolNameOf(symbol)}
|
|
107
107
|
if t := shimchecker.Checker_getTypeOfSymbol(checker, symbol); t != nil {
|
|
108
108
|
if value, ok := literalValue(t); ok {
|
|
109
109
|
member.Value = value
|
package/internal/graph/literals_are_absent_when_the_type_admits_more_than_it_can_name_test.go
CHANGED
|
@@ -58,7 +58,7 @@ export enum Computed {
|
|
|
58
58
|
|
|
59
59
|
// A nonempty control detects omission of the entire literal pass; this count
|
|
60
60
|
// does not independently check the control's four values.
|
|
61
|
-
if got := literalsOf(t, graph, nodeID(path, "Narrow", NodeTypeAlias)); len(got) != 4 {
|
|
61
|
+
if got := literalsOf(t, graph, nodeID(string(path), "Narrow", NodeTypeAlias)); len(got) != 4 {
|
|
62
62
|
t.Fatalf("control union did not report its four members: got %v", got)
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -72,7 +72,7 @@ export enum Computed {
|
|
|
72
72
|
{"Primitive", NodeTypeAlias, "a primitive is not a value set"},
|
|
73
73
|
{"Computed", NodeEnum, "a computed enum member has a value nothing here can name"},
|
|
74
74
|
} {
|
|
75
|
-
if got := literalsOf(t, graph, nodeID(path, testCase.name, testCase.kind)); len(got) != 0 {
|
|
75
|
+
if got := literalsOf(t, graph, nodeID(string(path), testCase.name, testCase.kind)); len(got) != 0 {
|
|
76
76
|
t.Fatalf("%s reported a partial value set %v: %s", testCase.name, got, testCase.why)
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -54,24 +54,24 @@ export enum Implicit {
|
|
|
54
54
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
55
55
|
|
|
56
56
|
// Multiline declaration with independent literal expected values.
|
|
57
|
-
wrapped := literalsOf(t, graph, nodeID(path, "Wrapped", NodeEnum))
|
|
57
|
+
wrapped := literalsOf(t, graph, nodeID(string(path), "Wrapped", NodeEnum))
|
|
58
58
|
if want := []string{`"a"`, `"b"`, `"c"`}; !slices.Equal(wrapped, want) {
|
|
59
59
|
t.Fatalf("multi-line enum under-reported its members: got %v, want %v", wrapped, want)
|
|
60
60
|
}
|
|
61
61
|
// Layout is not the fact; the single-line twin must agree exactly.
|
|
62
|
-
flat := literalsOf(t, graph, nodeID(path, "Flat", NodeEnum))
|
|
62
|
+
flat := literalsOf(t, graph, nodeID(string(path), "Flat", NodeEnum))
|
|
63
63
|
if !slices.Equal(flat, wrapped) {
|
|
64
64
|
t.Fatalf("enum layout changed the value set: wrapped %v, flat %v", wrapped, flat)
|
|
65
65
|
}
|
|
66
66
|
// Implicitly numbered members have literal semantic expectations; no numeric
|
|
67
67
|
// initializers are written, but this does not certify the acquisition method.
|
|
68
|
-
implicit := literalsOf(t, graph, nodeID(path, "Implicit", NodeEnum))
|
|
68
|
+
implicit := literalsOf(t, graph, nodeID(string(path), "Implicit", NodeEnum))
|
|
69
69
|
if want := []string{"0", "1"}; !slices.Equal(implicit, want) {
|
|
70
70
|
t.Fatalf("implicitly numbered enum did not report its resolved values: got %v, want %v", implicit, want)
|
|
71
71
|
}
|
|
72
72
|
// Reject this particular method-node identity; other enum detail fields and
|
|
73
73
|
// member-node spellings are not examined.
|
|
74
|
-
if node, ok := graph.Nodes[nodeID(path, "Wrapped.A", NodeMethod)]; ok {
|
|
74
|
+
if node, ok := graph.Nodes[nodeID(string(path), "Wrapped.A", NodeMethod)]; ok {
|
|
75
75
|
t.Fatalf("enum member unexpectedly modeled as a node (%v); literals may no longer be the only carrier", node.ID)
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -57,8 +57,8 @@ export type Flat = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h';
|
|
|
57
57
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
58
58
|
|
|
59
59
|
want := []string{`"a"`, `"b"`, `"c"`, `"d"`, `"e"`, `"f"`, `"g"`, `"h"`}
|
|
60
|
-
wrapped := literalsOf(t, graph, nodeID(path, "Wrapped", NodeTypeAlias))
|
|
61
|
-
flat := literalsOf(t, graph, nodeID(path, "Flat", NodeTypeAlias))
|
|
60
|
+
wrapped := literalsOf(t, graph, nodeID(string(path), "Wrapped", NodeTypeAlias))
|
|
61
|
+
flat := literalsOf(t, graph, nodeID(string(path), "Flat", NodeTypeAlias))
|
|
62
62
|
|
|
63
63
|
if !slices.Equal(wrapped, want) {
|
|
64
64
|
t.Fatalf("wrapped union under-reported its members: got %v, want %v", wrapped, want)
|
|
@@ -69,7 +69,7 @@ export type Mixed = 'a' | 1 | true;
|
|
|
69
69
|
// Kinds mix in one union, and source form is what keeps them apart.
|
|
70
70
|
{"Mixed", []string{`"a"`, "1", "true"}},
|
|
71
71
|
} {
|
|
72
|
-
got := literalsOf(t, graph, nodeID(path, testCase.name, NodeTypeAlias))
|
|
72
|
+
got := literalsOf(t, graph, nodeID(string(path), testCase.name, NodeTypeAlias))
|
|
73
73
|
if !slices.Equal(got, testCase.want) {
|
|
74
74
|
t.Fatalf("%s rendered %v, want %v", testCase.name, got, testCase.want)
|
|
75
75
|
}
|
|
@@ -46,18 +46,18 @@ export type Duplicated = Narrow | 'a';
|
|
|
46
46
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
47
47
|
|
|
48
48
|
// One hop: the three members reaching Wide through Narrow are Wide's too.
|
|
49
|
-
wide := literalsOf(t, graph, nodeID(path, "Wide", NodeTypeAlias))
|
|
49
|
+
wide := literalsOf(t, graph, nodeID(string(path), "Wide", NodeTypeAlias))
|
|
50
50
|
if want := []string{`"a"`, `"b"`, `"c"`, `"d"`}; !slices.Equal(wide, want) {
|
|
51
51
|
t.Fatalf("alias indirection lost members: got %v, want %v", wide, want)
|
|
52
52
|
}
|
|
53
53
|
// Two authored hops; this result check does not measure resolution cost.
|
|
54
|
-
wider := literalsOf(t, graph, nodeID(path, "Wider", NodeTypeAlias))
|
|
54
|
+
wider := literalsOf(t, graph, nodeID(string(path), "Wider", NodeTypeAlias))
|
|
55
55
|
if want := []string{`"a"`, `"b"`, `"c"`, `"d"`, `"e"`}; !slices.Equal(wider, want) {
|
|
56
56
|
t.Fatalf("nested alias indirection lost members: got %v, want %v", wider, want)
|
|
57
57
|
}
|
|
58
58
|
// A member named twice is one member; the checker has already deduped, so the
|
|
59
59
|
// list must not report `"a"` once per mention.
|
|
60
|
-
duplicated := literalsOf(t, graph, nodeID(path, "Duplicated", NodeTypeAlias))
|
|
60
|
+
duplicated := literalsOf(t, graph, nodeID(string(path), "Duplicated", NodeTypeAlias))
|
|
61
61
|
if want := []string{`"a"`, `"b"`, `"c"`}; !slices.Equal(duplicated, want) {
|
|
62
62
|
t.Fatalf("a member named twice was reported twice: got %v, want %v", duplicated, want)
|
|
63
63
|
}
|
|
@@ -71,11 +71,11 @@ export class Derived extends Base {
|
|
|
71
71
|
to string
|
|
72
72
|
origin string
|
|
73
73
|
}{
|
|
74
|
-
{nodeID(path, "Implementation.run", NodeMethod), nodeID(path, "Contract.run", NodeMethod), "implements"},
|
|
75
|
-
{nodeID(path, "Implementation.name", NodeMethod), nodeID(path, "Contract.name", NodeVariable), "implements"},
|
|
76
|
-
{nodeID(path, "Implementation.callback", NodeMethod), nodeID(path, "Contract.callback", NodeVariable), "implements"},
|
|
77
|
-
{nodeID(path, "Derived.act", NodeMethod), nodeID(path, "Base.act", NodeMethod), "overrides"},
|
|
78
|
-
{nodeID(path, "Derived.property", NodeVariable), nodeID(path, "Base.property", NodeVariable), "overrides"},
|
|
74
|
+
{nodeID(string(path), "Implementation.run", NodeMethod), nodeID(string(path), "Contract.run", NodeMethod), "implements"},
|
|
75
|
+
{nodeID(string(path), "Implementation.name", NodeMethod), nodeID(string(path), "Contract.name", NodeVariable), "implements"},
|
|
76
|
+
{nodeID(string(path), "Implementation.callback", NodeMethod), nodeID(string(path), "Contract.callback", NodeVariable), "implements"},
|
|
77
|
+
{nodeID(string(path), "Derived.act", NodeMethod), nodeID(string(path), "Base.act", NodeMethod), "overrides"},
|
|
78
|
+
{nodeID(string(path), "Derived.property", NodeVariable), nodeID(string(path), "Base.property", NodeVariable), "overrides"},
|
|
79
79
|
}
|
|
80
80
|
for _, assertion := range assertions {
|
|
81
81
|
if got := edgeOrigin(built, assertion.from, assertion.to, EdgeMemberRelation); got != assertion.origin {
|
|
@@ -83,8 +83,8 @@ export class Derived extends Base {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
derivedConstructor := nodeID(path, "Derived.__constructor", NodeMethod)
|
|
87
|
-
baseConstructor := nodeID(path, "Base.__constructor", NodeMethod)
|
|
86
|
+
derivedConstructor := nodeID(string(path), "Derived.__constructor", NodeMethod)
|
|
87
|
+
baseConstructor := nodeID(string(path), "Base.__constructor", NodeMethod)
|
|
88
88
|
if built.Nodes[derivedConstructor] == nil || built.Nodes[baseConstructor] == nil {
|
|
89
89
|
t.Fatalf("missing fixture constructor nodes; nodes: %v", nodeIDSet(built))
|
|
90
90
|
}
|
|
@@ -149,8 +149,8 @@ export class ProtectedPretender implements ProtectedBase {
|
|
|
149
149
|
built := Build(prog)
|
|
150
150
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
151
151
|
for _, id := range []string{
|
|
152
|
-
nodeID(path, "MixedFlagDerived.item", NodeMethod),
|
|
153
|
-
nodeID(path, "MixedFlagBase.item", NodeVariable),
|
|
152
|
+
nodeID(string(path), "MixedFlagDerived.item", NodeMethod),
|
|
153
|
+
nodeID(string(path), "MixedFlagBase.item", NodeVariable),
|
|
154
154
|
} {
|
|
155
155
|
if _, ok := built.Nodes[id]; !ok {
|
|
156
156
|
t.Fatalf("mixed-symbol boundary node %s is missing; nodes: %v", id, built.Nodes)
|
|
@@ -161,17 +161,17 @@ export class ProtectedPretender implements ProtectedBase {
|
|
|
161
161
|
to string
|
|
162
162
|
origin string
|
|
163
163
|
}{
|
|
164
|
-
{nodeID(path, "StringGeneric.map", NodeMethod), nodeID(path, "Generic.map", NodeMethod), "implements"},
|
|
165
|
-
{nodeID(path, "StringGeneric.required", NodeVariable), nodeID(path, "Generic.required", NodeVariable), "implements"},
|
|
166
|
-
{nodeID(path, "WrongGeneric.required", NodeVariable), nodeID(path, "Generic.required", NodeVariable), "implements"},
|
|
167
|
-
{nodeID(path, "ParserImpl.parse", NodeMethod), nodeID(path, "Parser.parse", NodeMethod), "implements"},
|
|
168
|
-
{nodeID(path, "RequiredGood.value", NodeVariable), nodeID(path, "OptionalContract.value", NodeVariable), "implements"},
|
|
169
|
-
{nodeID(path, "PropertyDerived.run", NodeVariable), nodeID(path, "MethodBase.run", NodeMethod), "overrides"},
|
|
170
|
-
{nodeID(path, "AbstractPropertyDerived.label", NodeVariable), nodeID(path, "AbstractAccessorBase.label", NodeMethod), "overrides"},
|
|
171
|
-
{nodeID(path, "SplitDerived.alpha", NodeMethod), nodeID(path, "SplitBase.alpha", NodeMethod), "overrides"},
|
|
172
|
-
{nodeID(path, "SplitDerived.beta", NodeMethod), nodeID(path, "SplitBase.beta", NodeMethod), "overrides"},
|
|
173
|
-
{nodeID(path, "MergedDerived.augment", NodeMethod), nodeID(path, "MergedBase.augment", NodeMethod), "overrides"},
|
|
174
|
-
{nodeID(path, "ProtectedGood.token", NodeVariable), nodeID(path, "ProtectedBase.token", NodeVariable), "overrides"},
|
|
164
|
+
{nodeID(string(path), "StringGeneric.map", NodeMethod), nodeID(string(path), "Generic.map", NodeMethod), "implements"},
|
|
165
|
+
{nodeID(string(path), "StringGeneric.required", NodeVariable), nodeID(string(path), "Generic.required", NodeVariable), "implements"},
|
|
166
|
+
{nodeID(string(path), "WrongGeneric.required", NodeVariable), nodeID(string(path), "Generic.required", NodeVariable), "implements"},
|
|
167
|
+
{nodeID(string(path), "ParserImpl.parse", NodeMethod), nodeID(string(path), "Parser.parse", NodeMethod), "implements"},
|
|
168
|
+
{nodeID(string(path), "RequiredGood.value", NodeVariable), nodeID(string(path), "OptionalContract.value", NodeVariable), "implements"},
|
|
169
|
+
{nodeID(string(path), "PropertyDerived.run", NodeVariable), nodeID(string(path), "MethodBase.run", NodeMethod), "overrides"},
|
|
170
|
+
{nodeID(string(path), "AbstractPropertyDerived.label", NodeVariable), nodeID(string(path), "AbstractAccessorBase.label", NodeMethod), "overrides"},
|
|
171
|
+
{nodeID(string(path), "SplitDerived.alpha", NodeMethod), nodeID(string(path), "SplitBase.alpha", NodeMethod), "overrides"},
|
|
172
|
+
{nodeID(string(path), "SplitDerived.beta", NodeMethod), nodeID(string(path), "SplitBase.beta", NodeMethod), "overrides"},
|
|
173
|
+
{nodeID(string(path), "MergedDerived.augment", NodeMethod), nodeID(string(path), "MergedBase.augment", NodeMethod), "overrides"},
|
|
174
|
+
{nodeID(string(path), "ProtectedGood.token", NodeVariable), nodeID(string(path), "ProtectedBase.token", NodeVariable), "overrides"},
|
|
175
175
|
}
|
|
176
176
|
for _, pair := range expected {
|
|
177
177
|
if got := edgeOrigin(built, pair.from, pair.to, EdgeMemberRelation); got != pair.origin {
|
|
@@ -183,12 +183,12 @@ export class ProtectedPretender implements ProtectedBase {
|
|
|
183
183
|
from string
|
|
184
184
|
to string
|
|
185
185
|
}{
|
|
186
|
-
{nodeID(path, "WrongGeneric.map", NodeMethod), nodeID(path, "Generic.map", NodeMethod)},
|
|
187
|
-
{nodeID(path, "OptionalWrong.value", NodeVariable), nodeID(path, "RequiredContract.value", NodeVariable)},
|
|
188
|
-
{nodeID(path, "MethodWrong.run", NodeMethod), nodeID(path, "PropertyBase.run", NodeVariable)},
|
|
189
|
-
{nodeID(path, "ConcretePropertyWrong.label", NodeVariable), nodeID(path, "ConcreteAccessorBase.label", NodeMethod)},
|
|
190
|
-
{nodeID(path, "MixedFlagDerived.item", NodeMethod), nodeID(path, "MixedFlagBase.item", NodeVariable)},
|
|
191
|
-
{nodeID(path, "ProtectedPretender.token", NodeVariable), nodeID(path, "ProtectedBase.token", NodeVariable)},
|
|
186
|
+
{nodeID(string(path), "WrongGeneric.map", NodeMethod), nodeID(string(path), "Generic.map", NodeMethod)},
|
|
187
|
+
{nodeID(string(path), "OptionalWrong.value", NodeVariable), nodeID(string(path), "RequiredContract.value", NodeVariable)},
|
|
188
|
+
{nodeID(string(path), "MethodWrong.run", NodeMethod), nodeID(string(path), "PropertyBase.run", NodeVariable)},
|
|
189
|
+
{nodeID(string(path), "ConcretePropertyWrong.label", NodeVariable), nodeID(string(path), "ConcreteAccessorBase.label", NodeMethod)},
|
|
190
|
+
{nodeID(string(path), "MixedFlagDerived.item", NodeMethod), nodeID(string(path), "MixedFlagBase.item", NodeVariable)},
|
|
191
|
+
{nodeID(string(path), "ProtectedPretender.token", NodeVariable), nodeID(string(path), "ProtectedBase.token", NodeVariable)},
|
|
192
192
|
}
|
|
193
193
|
for _, pair := range rejected {
|
|
194
194
|
if built.Nodes[pair.from] == nil || built.Nodes[pair.to] == nil {
|
|
@@ -84,12 +84,12 @@ export class InvalidDerived extends Base {
|
|
|
84
84
|
from string
|
|
85
85
|
to string
|
|
86
86
|
}{
|
|
87
|
-
{nodeID(path, "WrongKind.value", NodeMethod), nodeID(path, "Contract.value", NodeVariable)},
|
|
88
|
-
{nodeID(path, "WrongKind.run", NodeMethod), nodeID(path, "Contract.run", NodeMethod)},
|
|
89
|
-
{nodeID(path, "StaticOnly.value", NodeVariable), nodeID(path, "Contract.value", NodeVariable)},
|
|
90
|
-
{nodeID(path, "StaticOnly.run", NodeMethod), nodeID(path, "Contract.run", NodeMethod)},
|
|
91
|
-
{nodeID(path, "InvalidDerived.value", NodeMethod), nodeID(path, "Base.value", NodeVariable)},
|
|
92
|
-
{nodeID(path, "InvalidDerived.run", NodeMethod), nodeID(path, "Base.run", NodeMethod)},
|
|
87
|
+
{nodeID(string(path), "WrongKind.value", NodeMethod), nodeID(string(path), "Contract.value", NodeVariable)},
|
|
88
|
+
{nodeID(string(path), "WrongKind.run", NodeMethod), nodeID(string(path), "Contract.run", NodeMethod)},
|
|
89
|
+
{nodeID(string(path), "StaticOnly.value", NodeVariable), nodeID(string(path), "Contract.value", NodeVariable)},
|
|
90
|
+
{nodeID(string(path), "StaticOnly.run", NodeMethod), nodeID(string(path), "Contract.run", NodeMethod)},
|
|
91
|
+
{nodeID(string(path), "InvalidDerived.value", NodeMethod), nodeID(string(path), "Base.value", NodeVariable)},
|
|
92
|
+
{nodeID(string(path), "InvalidDerived.run", NodeMethod), nodeID(string(path), "Base.run", NodeMethod)},
|
|
93
93
|
}
|
|
94
94
|
for _, pair := range absent {
|
|
95
95
|
if built.Nodes[pair.from] == nil || built.Nodes[pair.to] == nil {
|
|
@@ -104,9 +104,9 @@ export class InvalidDerived extends Base {
|
|
|
104
104
|
from string
|
|
105
105
|
to string
|
|
106
106
|
}{
|
|
107
|
-
{nodeID(path, "WrongKind.kept", NodeVariable), nodeID(path, "Contract.kept", NodeVariable)},
|
|
108
|
-
{nodeID(path, "Valid.value", NodeVariable), nodeID(path, "Contract.value", NodeVariable)},
|
|
109
|
-
{nodeID(path, "Valid.run", NodeMethod), nodeID(path, "Contract.run", NodeMethod)},
|
|
107
|
+
{nodeID(string(path), "WrongKind.kept", NodeVariable), nodeID(string(path), "Contract.kept", NodeVariable)},
|
|
108
|
+
{nodeID(string(path), "Valid.value", NodeVariable), nodeID(string(path), "Contract.value", NodeVariable)},
|
|
109
|
+
{nodeID(string(path), "Valid.run", NodeMethod), nodeID(string(path), "Contract.run", NodeMethod)},
|
|
110
110
|
}
|
|
111
111
|
for _, pair := range valid {
|
|
112
112
|
if got := edgeOrigin(built, pair.from, pair.to, EdgeMemberRelation); got != "implements" {
|
|
@@ -115,8 +115,8 @@ export class InvalidDerived extends Base {
|
|
|
115
115
|
}
|
|
116
116
|
if got := edgeOrigin(
|
|
117
117
|
built,
|
|
118
|
-
nodeID(path, "InvalidDerived.kept", NodeVariable),
|
|
119
|
-
nodeID(path, "Base.kept", NodeVariable),
|
|
118
|
+
nodeID(string(path), "InvalidDerived.kept", NodeVariable),
|
|
119
|
+
nodeID(string(path), "Base.kept", NodeVariable),
|
|
120
120
|
EdgeMemberRelation,
|
|
121
121
|
); got != "overrides" {
|
|
122
122
|
t.Fatalf("valid override sibling in an invalid class was suppressed: got %q; edges: %v", got, built.Edges)
|
|
@@ -57,8 +57,8 @@ export function caller(): void {
|
|
|
57
57
|
graph := Build(prog)
|
|
58
58
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
59
59
|
|
|
60
|
-
deep := nodeID(path, "A.B.C.deep", NodeFunction)
|
|
61
|
-
caller := nodeID(path, "caller", NodeFunction)
|
|
60
|
+
deep := nodeID(string(path), "A.B.C.deep", NodeFunction)
|
|
61
|
+
caller := nodeID(string(path), "caller", NodeFunction)
|
|
62
62
|
|
|
63
63
|
if _, ok := graph.Nodes[deep]; !ok {
|
|
64
64
|
t.Fatalf("missing deeply-namespaced node %q; nodes: %v", deep, graph.Nodes)
|
|
@@ -77,13 +77,13 @@ export type WorkerRef = Service.Worker;
|
|
|
77
77
|
graph := Build(prog)
|
|
78
78
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
79
79
|
|
|
80
|
-
serviceHelper := nodeID(path, "Service.helper", NodeFunction)
|
|
81
|
-
serviceRun := nodeID(path, "Service.run", NodeFunction)
|
|
82
|
-
serviceWorker := nodeID(path, "Service.Worker", NodeClass)
|
|
83
|
-
workerProcess := nodeID(path, "Service.Worker.process", NodeMethod)
|
|
84
|
-
bootstrap := nodeID(path, "bootstrap", NodeFunction)
|
|
85
|
-
workerRef := nodeID(path, "WorkerRef", NodeTypeAlias)
|
|
86
|
-
payload := nodeID(path, "Payload", NodeInterface)
|
|
80
|
+
serviceHelper := nodeID(string(path), "Service.helper", NodeFunction)
|
|
81
|
+
serviceRun := nodeID(string(path), "Service.run", NodeFunction)
|
|
82
|
+
serviceWorker := nodeID(string(path), "Service.Worker", NodeClass)
|
|
83
|
+
workerProcess := nodeID(string(path), "Service.Worker.process", NodeMethod)
|
|
84
|
+
bootstrap := nodeID(string(path), "bootstrap", NodeFunction)
|
|
85
|
+
workerRef := nodeID(string(path), "WorkerRef", NodeTypeAlias)
|
|
86
|
+
payload := nodeID(string(path), "Payload", NodeInterface)
|
|
87
87
|
|
|
88
88
|
// The namespaced declarations are nodes in their own right.
|
|
89
89
|
for _, id := range []string{serviceHelper, serviceRun, serviceWorker, workerProcess} {
|
|
@@ -58,28 +58,28 @@ export const c = hidden();
|
|
|
58
58
|
"hidden": NodeFunction, "Local": NodeClass, "Local.method": NodeMethod,
|
|
59
59
|
"Shape": NodeInterface, "Shape.value": NodeVariable, "Alias": NodeTypeAlias, "local": NodeVariable,
|
|
60
60
|
} {
|
|
61
|
-
if node := g.Nodes[nodeID(file, prefix+"."+name, kind)]; node == nil || node.Name != prefix+"."+name || node.End <= node.Pos {
|
|
61
|
+
if node := g.Nodes[nodeID(string(file), prefix+"."+name, kind)]; node == nil || node.Name != prefix+"."+name || node.End <= node.Pos {
|
|
62
62
|
t.Errorf("missing lexical declaration %s.%s", prefix, name)
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
for _, name := range []string{"A.hidden", "B.hidden", "hidden", "A.Deep.hidden", "A.factory.hidden"} {
|
|
67
|
-
id := nodeID(file, name, NodeFunction)
|
|
67
|
+
id := nodeID(string(file), name, NodeFunction)
|
|
68
68
|
if g.Nodes[id] == nil {
|
|
69
69
|
t.Errorf("missing %s", name)
|
|
70
70
|
}
|
|
71
|
-
if got := hasEdge(g, id, nodeID(file, "target", NodeFunction), EdgeValueCall); got != (name == "B.hidden") {
|
|
71
|
+
if got := hasEdge(g, id, nodeID(string(file), "target", NodeFunction), EdgeValueCall); got != (name == "B.hidden") {
|
|
72
72
|
t.Errorf("%s calls target = %t, want %t", name, got, name == "B.hidden")
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
for caller, target := range map[string]string{"A.a": "A.hidden", "B.b": "B.hidden", "c": "hidden", "A.Deep.d": "A.Deep.hidden"} {
|
|
76
76
|
for _, candidate := range []string{"A.hidden", "B.hidden", "hidden", "A.Deep.hidden", "A.factory.hidden"} {
|
|
77
|
-
if got := hasEdge(g, nodeID(file, caller, NodeVariable), nodeID(file, candidate, NodeFunction), EdgeValueCall); got != (candidate == target) {
|
|
77
|
+
if got := hasEdge(g, nodeID(string(file), caller, NodeVariable), nodeID(string(file), candidate, NodeFunction), EdgeValueCall); got != (candidate == target) {
|
|
78
78
|
t.Errorf("%s -> %s = %t, want %t", caller, candidate, got, candidate == target)
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
if !hasEdge(g, nodeID(file, "A.factory", NodeFunction), nodeID(file, "A.factory.hidden", NodeFunction), EdgeValueCall) {
|
|
82
|
+
if !hasEdge(g, nodeID(string(file), "A.factory", NodeFunction), nodeID(string(file), "A.factory.hidden", NodeFunction), EdgeValueCall) {
|
|
83
83
|
t.Error("factory lost its own hidden closure")
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -42,8 +42,8 @@ export { Service };
|
|
|
42
42
|
graph := Build(prog)
|
|
43
43
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
44
44
|
|
|
45
|
-
service := graph.Nodes[nodeID(path, "Service", NodeClass)]
|
|
46
|
-
internal := graph.Nodes[nodeID(path, "Internal", NodeClass)]
|
|
45
|
+
service := graph.Nodes[nodeID(string(path), "Service", NodeClass)]
|
|
46
|
+
internal := graph.Nodes[nodeID(string(path), "Internal", NodeClass)]
|
|
47
47
|
if service == nil || internal == nil {
|
|
48
48
|
t.Fatalf("Build did not record both classes; have %v", nodeIDSet(graph))
|
|
49
49
|
}
|
|
@@ -84,8 +84,8 @@ export namespace Names {
|
|
|
84
84
|
}
|
|
85
85
|
graph := Build(prog)
|
|
86
86
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
87
|
-
caller := nodeID(path, "caller", NodeFunction)
|
|
88
|
-
helper := nodeID(path, "helper", NodeFunction)
|
|
87
|
+
caller := nodeID(string(path), "caller", NodeFunction)
|
|
88
|
+
helper := nodeID(string(path), "helper", NodeFunction)
|
|
89
89
|
for _, item := range []struct {
|
|
90
90
|
name string
|
|
91
91
|
kind NodeKind
|
|
@@ -109,7 +109,7 @@ export namespace Names {
|
|
|
109
109
|
{"api.computed", NodeMethod, EdgeValueCall},
|
|
110
110
|
{"api.value", NodeMethod, EdgeValueAccess},
|
|
111
111
|
} {
|
|
112
|
-
id := nodeID(path, item.name, item.kind)
|
|
112
|
+
id := nodeID(string(path), item.name, item.kind)
|
|
113
113
|
node := graph.Nodes[id]
|
|
114
114
|
if node == nil || node.Pos <= 0 || node.End <= node.Pos {
|
|
115
115
|
t.Errorf("missing member/span %s: %+v", item.name, node)
|
|
@@ -122,12 +122,12 @@ export namespace Names {
|
|
|
122
122
|
t.Errorf("missing member-to-helper relation from %s", item.name)
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
if !hasEdge(graph, nodeID(path, "control", NodeFunction), nodeID(path, "Control.run", NodeMethod), EdgeValueCall) {
|
|
125
|
+
if !hasEdge(graph, nodeID(string(path), "control", NodeFunction), nodeID(string(path), "Control.run", NodeMethod), EdgeValueCall) {
|
|
126
126
|
t.Error("ordinary class method call was lost")
|
|
127
127
|
}
|
|
128
128
|
for _, name := range []string{`Names.api["a[\"\"]"]`, `Names.api.a[""]`} {
|
|
129
|
-
id := nodeID(path, name, NodeMethod)
|
|
130
|
-
if graph.Nodes[id] == nil || !hasEdge(graph, nodeID(path, "Names.caller", NodeFunction), id, EdgeValueCall) || !hasEdge(graph, id, helper, EdgeValueCall) {
|
|
129
|
+
id := nodeID(string(path), name, NodeMethod)
|
|
130
|
+
if graph.Nodes[id] == nil || !hasEdge(graph, nodeID(string(path), "Names.caller", NodeFunction), id, EdgeValueCall) || !hasEdge(graph, id, helper, EdgeValueCall) {
|
|
131
131
|
t.Errorf("namespace object identity/relationships missing: %s", name)
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -146,18 +146,18 @@ export namespace Names {
|
|
|
146
146
|
{"Control.prefix__#7@#read", "prefix__#7@#read", NodeMethod, EdgeValueAccess},
|
|
147
147
|
{"Control.#value", "#value", NodeMethod, EdgeValueCall},
|
|
148
148
|
} {
|
|
149
|
-
id := nodeID(path, item.qualified, item.kind)
|
|
149
|
+
id := nodeID(string(path), item.qualified, item.kind)
|
|
150
150
|
node := graph.Nodes[id]
|
|
151
151
|
if node == nil || node.Simple != item.simple || node.Pos <= 0 || node.End <= node.Pos {
|
|
152
152
|
t.Errorf("literal/private identity %q: %+v, want simple %q", item.qualified, node, item.simple)
|
|
153
153
|
continue
|
|
154
154
|
}
|
|
155
155
|
if item.qualified == "Control.#value" {
|
|
156
|
-
if !hasEdge(graph, nodeID(path, "Control.__#41@#value", NodeMethod), id, EdgeValueCall) {
|
|
156
|
+
if !hasEdge(graph, nodeID(string(path), "Control.__#41@#value", NodeMethod), id, EdgeValueCall) {
|
|
157
157
|
t.Error("public literal method lost its distinct private call target")
|
|
158
158
|
}
|
|
159
159
|
} else if len(item.qualified) >= len("Control.") && item.qualified[:len("Control.")] == "Control." {
|
|
160
|
-
if !hasEdge(graph, nodeID(path, "control", NodeFunction), id, item.relation) {
|
|
160
|
+
if !hasEdge(graph, nodeID(string(path), "control", NodeFunction), id, item.relation) {
|
|
161
161
|
t.Errorf("missing control caller relation to %q", item.qualified)
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -82,7 +82,7 @@ export const shape = (({
|
|
|
82
82
|
|
|
83
83
|
graph := Build(prog)
|
|
84
84
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
85
|
-
node := graph.Nodes[nodeID(path, "shape", NodeVariable)]
|
|
85
|
+
node := graph.Nodes[nodeID(string(path), "shape", NodeVariable)]
|
|
86
86
|
if node == nil {
|
|
87
87
|
t.Fatalf("missing shape variable; nodes: %v", nodeIDSet(graph))
|
|
88
88
|
}
|
|
@@ -50,7 +50,7 @@ func TestOverloadImplementationReplacesSignature(t *testing.T) {
|
|
|
50
50
|
graph := Build(prog)
|
|
51
51
|
file := sourceFile(t, prog, "main.ts")
|
|
52
52
|
path := file.FileName()
|
|
53
|
-
id := nodeID(path, "Query.join", NodeMethod)
|
|
53
|
+
id := nodeID(string(path), "Query.join", NodeMethod)
|
|
54
54
|
node := graph.Nodes[id]
|
|
55
55
|
if node == nil {
|
|
56
56
|
t.Fatalf("missing node Query.join; have %v", nodeIDSet(graph))
|
|
@@ -59,7 +59,7 @@ func TestOverloadImplementationReplacesSignature(t *testing.T) {
|
|
|
59
59
|
if !strings.Contains(source, "return this.realJoin") {
|
|
60
60
|
t.Fatalf("expected Query.join node to cover the implementation body, got:\n%s", source)
|
|
61
61
|
}
|
|
62
|
-
if !hasEdge(graph, id, nodeID(path, "Query.realJoin", NodeMethod), EdgeValueCall) {
|
|
62
|
+
if !hasEdge(graph, id, nodeID(string(path), "Query.realJoin", NodeMethod), EdgeValueCall) {
|
|
63
63
|
t.Fatalf("missing value-call edge Query.join -> Query.realJoin; edges: %v", graph.Edges)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -56,12 +56,12 @@ export interface Contract {
|
|
|
56
56
|
|
|
57
57
|
graph := Build(prog)
|
|
58
58
|
path := sourceFile(t, prog, "main.ts").FileName()
|
|
59
|
-
dep := nodeID(path, "Dep", NodeInterface)
|
|
60
|
-
makeDep := nodeID(path, "makeDep", NodeFunction)
|
|
61
|
-
service := nodeID(path, "Service", NodeClass)
|
|
62
|
-
serviceDep := nodeID(path, "Service.dep", NodeVariable)
|
|
63
|
-
contract := nodeID(path, "Contract", NodeInterface)
|
|
64
|
-
contractDep := nodeID(path, "Contract.dep", NodeVariable)
|
|
59
|
+
dep := nodeID(string(path), "Dep", NodeInterface)
|
|
60
|
+
makeDep := nodeID(string(path), "makeDep", NodeFunction)
|
|
61
|
+
service := nodeID(string(path), "Service", NodeClass)
|
|
62
|
+
serviceDep := nodeID(string(path), "Service.dep", NodeVariable)
|
|
63
|
+
contract := nodeID(string(path), "Contract", NodeInterface)
|
|
64
|
+
contractDep := nodeID(string(path), "Contract.dep", NodeVariable)
|
|
65
65
|
|
|
66
66
|
for _, id := range []string{serviceDep, contractDep} {
|
|
67
67
|
if _, ok := graph.Nodes[id]; !ok {
|
|
@@ -126,7 +126,7 @@ func Resolve(checker *shimchecker.Checker, ref *shimast.Node) *Target {
|
|
|
126
126
|
if symbol == nil {
|
|
127
127
|
return nil
|
|
128
128
|
}
|
|
129
|
-
if symbol
|
|
129
|
+
if shimast.SymbolFlagsOf(symbol)&shimast.SymbolFlagsAlias != 0 {
|
|
130
130
|
if aliased := shimchecker.Checker_getAliasedSymbol(checker, symbol); aliased != nil {
|
|
131
131
|
symbol = aliased
|
|
132
132
|
}
|
|
@@ -136,7 +136,7 @@ func Resolve(checker *shimchecker.Checker, ref *shimast.Node) *Target {
|
|
|
136
136
|
target.Pos = declaration.Pos()
|
|
137
137
|
target.End = declaration.End()
|
|
138
138
|
if file := shimast.GetSourceFileOfNode(declaration); file != nil {
|
|
139
|
-
target.File = file.FileName()
|
|
139
|
+
target.File = string(file.FileName())
|
|
140
140
|
target.External = !IsWorkspaceSourceFile(file)
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -156,27 +156,27 @@ func declarationFile(symbol *shimast.Symbol) *shimast.SourceFile {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
func declarationNode(symbol *shimast.Symbol) *shimast.Node {
|
|
159
|
-
if len(symbol
|
|
159
|
+
if len(shimast.SymbolDeclarationsOf(symbol)) == 0 {
|
|
160
160
|
return nil
|
|
161
161
|
}
|
|
162
162
|
// Prefer a non-declaration-file declaration. A declaration-merged symbol (a
|
|
163
163
|
// class paired with an interface, or a function with a namespace) can list a
|
|
164
164
|
// `.d.ts` declaration first; classifying by it would mark a real workspace
|
|
165
165
|
// symbol external and sever it from the graph.
|
|
166
|
-
for _, declaration := range symbol
|
|
166
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
167
167
|
if file := shimast.GetSourceFileOfNode(declaration); file != nil && !file.IsDeclarationFile && declaration.Body() != nil {
|
|
168
168
|
return declaration
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
for _, declaration := range symbol
|
|
171
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
172
172
|
if file := shimast.GetSourceFileOfNode(declaration); file != nil && !file.IsDeclarationFile {
|
|
173
173
|
return declaration
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
for _, declaration := range symbol
|
|
176
|
+
for _, declaration := range shimast.SymbolDeclarationsOf(symbol) {
|
|
177
177
|
if declaration.Body() != nil {
|
|
178
178
|
return declaration
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
return symbol
|
|
181
|
+
return shimast.SymbolDeclarationsOf(symbol)[0]
|
|
182
182
|
}
|