codegraphcontext-rust 0.9.15__tar.gz → 0.9.16__tar.gz
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.
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/PKG-INFO +1 -1
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/pyproject.toml +1 -1
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/go.rs +154 -4
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/java.rs +167 -56
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/javascript.rs +252 -90
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/kotlin.rs +163 -32
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/mod.rs +34 -17
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/python.rs +80 -23
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/tsx.rs +104 -2
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/typescript.rs +24 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/resolution/calls.rs +365 -57
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-python/src/lib.rs +21 -2
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/cgc_wiki_cli.py +1 -1
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/context_generator.py +6 -6
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/persistence/duckdb_writer.py +19 -9
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/LICENSE +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/README.md +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/Cargo.lock +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/Cargo.toml +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/Cargo.toml +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/c_lang.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/cpp.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/csharp.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/dart.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/elixir.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/haskell.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/perl.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/php.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/ruby.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/rust_lang.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/scala.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/swift.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lib.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/parser.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/resolution/inheritance.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/resolution/mod.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/sanitize.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/types.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-python/Cargo.toml +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-python/src/conversions.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/Cargo.toml +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/build.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/src/grammar/alloc.h +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/src/grammar/array.h +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/src/grammar/parser.c +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/src/grammar/parser.h +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/src/grammar/scanner.c +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/src/grammar/tree_sitter/parser.h +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/tree-sitter-perl-vendor/src/lib.rs +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/__init__.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/__main__.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/cli/__init__.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/cli/cli_helpers.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/cli/config_manager.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/cli/main.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/cli/registry_commands.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/cli/setup_macos.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/cli/setup_wizard.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/cli/visualizer.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/__init__.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/bundle_registry.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/cgc_bundle.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/cgcignore.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/database.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/database_falkordb.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/database_falkordb_remote.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/database_kuzu.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/falkor_worker.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/jobs.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/core/watcher.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/prompts.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/server.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tool_definitions.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/__init__.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/advanced_language_query_tool.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/code_finder.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/graph_builder.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/handlers/analysis_handlers.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/handlers/indexing_handlers.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/handlers/management_handlers.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/handlers/query_handlers.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/handlers/watcher_handlers.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/__init__.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/constants.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/discovery.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/engine.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/execution_flows.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/module_grouping.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/noise_filter.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/op_param_extraction.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/persistence/__init__.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/persistence/parquet_loader.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/persistence/writer.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/pipeline.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/pre_scan.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/rationale_extraction.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/resolution/__init__.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/resolution/calls.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/resolution/inheritance.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/route_extraction.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/sanitize.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/schema.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/schema_contract.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/indexing/scip_pipeline.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/c.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/cpp.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/csharp.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/dart.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/elixir.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/go.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/haskell.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/java.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/javascript.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/kotlin.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/perl.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/php.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/python.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/ruby.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/rust.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/scala.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/swift.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/typescript.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/languages/typescriptjsx.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/package_resolver.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/c_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/cpp_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/csharp_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/dart_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/go_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/haskell_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/java_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/javascript_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/perl_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/python_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/ruby_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/rust_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/scala_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/swift_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/query_tool_languages/typescript_toolkit.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/scip_indexer.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/scip_pb2.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/system.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/tools/tree_sitter_parser.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/utils/debug_log.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/utils/path_ignore.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/utils/repo_path.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/utils/tree_sitter_manager.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/utils/visualize_graph.py +0 -0
- {codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/src/codegraphcontext/viz/server.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codegraphcontext-rust"
|
|
7
|
-
version = "0.9.
|
|
7
|
+
version = "0.9.16"
|
|
8
8
|
description = "Rust-accelerated code indexing engine for CodeGraphContext. 19 languages, 5-18x faster parsing via tree-sitter + rayon."
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Shashank Shekhar Singh", email = "shashankshekharsingh1205@gmail.com" },
|
|
@@ -176,8 +176,11 @@ impl GoExtractor {
|
|
|
176
176
|
if child.kind() == "parameter_declaration" {
|
|
177
177
|
let type_node = child.child_by_field_name("type");
|
|
178
178
|
if let Some(tn) = type_node {
|
|
179
|
-
|
|
180
|
-
return
|
|
179
|
+
// Strip pointer and type parameters: `*List[T]` -> `List`.
|
|
180
|
+
return self.base_type_name(&tn, source).or_else(|| {
|
|
181
|
+
let type_text = get_node_text(&tn, source);
|
|
182
|
+
Some(type_text.trim_start_matches('*').to_string())
|
|
183
|
+
});
|
|
181
184
|
}
|
|
182
185
|
}
|
|
183
186
|
}
|
|
@@ -185,6 +188,69 @@ impl GoExtractor {
|
|
|
185
188
|
None
|
|
186
189
|
}
|
|
187
190
|
|
|
191
|
+
/// Bare type name of a type node: `T`, `*T`, `pkg.T`, `T[U]` all yield `T`.
|
|
192
|
+
fn base_type_name(&self, type_node: &Node, source: &[u8]) -> Option<String> {
|
|
193
|
+
match type_node.kind() {
|
|
194
|
+
"type_identifier" => Some(get_node_text(type_node, source).to_string()),
|
|
195
|
+
"pointer_type" => type_node
|
|
196
|
+
.named_child(0)
|
|
197
|
+
.and_then(|inner| self.base_type_name(&inner, source)),
|
|
198
|
+
"qualified_type" => type_node
|
|
199
|
+
.child_by_field_name("name")
|
|
200
|
+
.map(|n| get_node_text(&n, source).to_string()),
|
|
201
|
+
"generic_type" => type_node
|
|
202
|
+
.child_by_field_name("type")
|
|
203
|
+
.and_then(|inner| self.base_type_name(&inner, source)),
|
|
204
|
+
_ => None,
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/// Embedded (anonymous) fields of a struct_type, e.g. `Base`, `*Base`, `pkg.Base`.
|
|
209
|
+
fn struct_embedded_bases(&self, struct_type: &Node, source: &[u8]) -> Vec<String> {
|
|
210
|
+
let mut bases = Vec::new();
|
|
211
|
+
for i in 0..struct_type.named_child_count() {
|
|
212
|
+
let Some(field_list) = struct_type.named_child(i) else { continue };
|
|
213
|
+
if field_list.kind() != "field_declaration_list" {
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
for j in 0..field_list.named_child_count() {
|
|
217
|
+
let Some(field) = field_list.named_child(j) else { continue };
|
|
218
|
+
if field.kind() != "field_declaration" || field.child_by_field_name("name").is_some() {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if let Some(base) = field
|
|
222
|
+
.child_by_field_name("type")
|
|
223
|
+
.and_then(|t| self.base_type_name(&t, source))
|
|
224
|
+
{
|
|
225
|
+
bases.push(base);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
bases
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/// Embedded interfaces of an interface_type, e.g. `io.Reader`, `Closer`.
|
|
233
|
+
/// Type-set constraints (`~int | string`) and the builtins `any`/`comparable`
|
|
234
|
+
/// are not inheritance and are skipped.
|
|
235
|
+
fn interface_embedded_bases(&self, interface_type: &Node, source: &[u8]) -> Vec<String> {
|
|
236
|
+
let mut bases = Vec::new();
|
|
237
|
+
for i in 0..interface_type.named_child_count() {
|
|
238
|
+
let Some(elem) = interface_type.named_child(i) else { continue };
|
|
239
|
+
if elem.kind() != "type_elem" || elem.named_child_count() != 1 {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if let Some(base) = elem
|
|
243
|
+
.named_child(0)
|
|
244
|
+
.and_then(|t| self.base_type_name(&t, source))
|
|
245
|
+
{
|
|
246
|
+
if base != "any" && base != "comparable" {
|
|
247
|
+
bases.push(base);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
bases
|
|
252
|
+
}
|
|
253
|
+
|
|
188
254
|
fn get_docstring(&self, func_node: &Node, source: &[u8]) -> Option<String> {
|
|
189
255
|
let mut prev = func_node.prev_sibling();
|
|
190
256
|
while let Some(sib) = prev {
|
|
@@ -382,12 +448,18 @@ impl LanguageExtractor for GoExtractor {
|
|
|
382
448
|
None => continue,
|
|
383
449
|
};
|
|
384
450
|
let name = get_node_text(&node, source).to_string();
|
|
451
|
+
let bases = node
|
|
452
|
+
.parent()
|
|
453
|
+
.and_then(|spec| spec.child_by_field_name("type"))
|
|
454
|
+
.filter(|t| t.kind() == "struct_type")
|
|
455
|
+
.map(|t| self.struct_embedded_bases(&t, source))
|
|
456
|
+
.unwrap_or_default();
|
|
385
457
|
|
|
386
458
|
let mut class = ClassData {
|
|
387
459
|
name,
|
|
388
460
|
line_number: type_decl.start_position().row + 1,
|
|
389
461
|
end_line: type_decl.end_position().row + 1,
|
|
390
|
-
bases
|
|
462
|
+
bases,
|
|
391
463
|
context: None,
|
|
392
464
|
decorators: Vec::new(),
|
|
393
465
|
lang: self.lang_name().to_string(),
|
|
@@ -414,12 +486,18 @@ impl LanguageExtractor for GoExtractor {
|
|
|
414
486
|
None => continue,
|
|
415
487
|
};
|
|
416
488
|
let name = get_node_text(&node, source).to_string();
|
|
489
|
+
let bases = node
|
|
490
|
+
.parent()
|
|
491
|
+
.and_then(|spec| spec.child_by_field_name("type"))
|
|
492
|
+
.filter(|t| t.kind() == "interface_type")
|
|
493
|
+
.map(|t| self.interface_embedded_bases(&t, source))
|
|
494
|
+
.unwrap_or_default();
|
|
417
495
|
|
|
418
496
|
let mut class = ClassData {
|
|
419
497
|
name,
|
|
420
498
|
line_number: type_decl.start_position().row + 1,
|
|
421
499
|
end_line: type_decl.end_position().row + 1,
|
|
422
|
-
bases
|
|
500
|
+
bases,
|
|
423
501
|
context: None,
|
|
424
502
|
decorators: Vec::new(),
|
|
425
503
|
lang: self.lang_name().to_string(),
|
|
@@ -668,6 +746,78 @@ type Speaker interface {
|
|
|
668
746
|
assert!(classes.iter().any(|c| c.name == "Speaker"));
|
|
669
747
|
}
|
|
670
748
|
|
|
749
|
+
#[test]
|
|
750
|
+
fn test_struct_embedded_fields_as_bases() {
|
|
751
|
+
let code = r#"
|
|
752
|
+
package main
|
|
753
|
+
|
|
754
|
+
type Server struct {
|
|
755
|
+
Base
|
|
756
|
+
*Logger
|
|
757
|
+
http.Handler
|
|
758
|
+
name string
|
|
759
|
+
a, b int
|
|
760
|
+
}
|
|
761
|
+
"#;
|
|
762
|
+
let (tree, source) = parse_source(code);
|
|
763
|
+
let ext = GoExtractor;
|
|
764
|
+
let classes = ext.find_classes(&tree.root_node(), &source, false);
|
|
765
|
+
let server = classes.iter().find(|c| c.name == "Server").unwrap();
|
|
766
|
+
assert_eq!(server.bases, vec!["Base", "Logger", "Handler"]);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
#[test]
|
|
770
|
+
fn test_interface_embedding_as_bases() {
|
|
771
|
+
let code = r#"
|
|
772
|
+
package main
|
|
773
|
+
|
|
774
|
+
type ReadCloser interface {
|
|
775
|
+
io.Reader
|
|
776
|
+
Closer
|
|
777
|
+
Extra() int
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
type Number interface {
|
|
781
|
+
~int | ~float64
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
type Key interface {
|
|
785
|
+
comparable
|
|
786
|
+
}
|
|
787
|
+
"#;
|
|
788
|
+
let (tree, source) = parse_source(code);
|
|
789
|
+
let ext = GoExtractor;
|
|
790
|
+
let classes = ext.find_classes(&tree.root_node(), &source, false);
|
|
791
|
+
let rc = classes.iter().find(|c| c.name == "ReadCloser").unwrap();
|
|
792
|
+
assert_eq!(rc.bases, vec!["Reader", "Closer"]);
|
|
793
|
+
let num = classes.iter().find(|c| c.name == "Number").unwrap();
|
|
794
|
+
assert!(num.bases.is_empty());
|
|
795
|
+
let key = classes.iter().find(|c| c.name == "Key").unwrap();
|
|
796
|
+
assert!(key.bases.is_empty());
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
#[test]
|
|
800
|
+
fn test_generic_receiver_strips_type_params() {
|
|
801
|
+
let code = r#"
|
|
802
|
+
package main
|
|
803
|
+
|
|
804
|
+
type List[T any] struct {
|
|
805
|
+
items []T
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
func (l *List[T]) Push(v T) {}
|
|
809
|
+
|
|
810
|
+
func (p Pair[K, V]) Key() K { return p.k }
|
|
811
|
+
"#;
|
|
812
|
+
let (tree, source) = parse_source(code);
|
|
813
|
+
let ext = GoExtractor;
|
|
814
|
+
let funcs = ext.find_functions(&tree.root_node(), &source, false);
|
|
815
|
+
let push = funcs.iter().find(|f| f.name == "Push").unwrap();
|
|
816
|
+
assert_eq!(push.class_context.as_deref(), Some("List"));
|
|
817
|
+
let key = funcs.iter().find(|f| f.name == "Key").unwrap();
|
|
818
|
+
assert_eq!(key.class_context.as_deref(), Some("Pair"));
|
|
819
|
+
}
|
|
820
|
+
|
|
671
821
|
#[test]
|
|
672
822
|
fn test_find_imports() {
|
|
673
823
|
let code = r#"
|
{codegraphcontext_rust-0.9.15 → codegraphcontext_rust-0.9.16}/rust/cgc-core/src/lang/java.rs
RENAMED
|
@@ -183,6 +183,37 @@ impl JavaExtractor {
|
|
|
183
183
|
Some(base.to_string())
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
fn child_of_kind<'t>(node: &Node<'t>, kind: &str) -> Option<Node<'t>> {
|
|
187
|
+
(0..node.child_count())
|
|
188
|
+
.filter_map(|i| node.child(i))
|
|
189
|
+
.find(|c| c.kind() == kind)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/// Type names listed under a superclass / super_interfaces /
|
|
193
|
+
/// extends_interfaces node, with generic arguments stripped.
|
|
194
|
+
fn base_type_names(node: &Node, source: &[u8]) -> Vec<String> {
|
|
195
|
+
// The types sit either directly under the node (superclass) or in a
|
|
196
|
+
// type_list child (super_interfaces, extends_interfaces).
|
|
197
|
+
let holder = Self::child_of_kind(node, "type_list")
|
|
198
|
+
.or_else(|| Self::child_of_kind(node, "interface_type_list"))
|
|
199
|
+
.unwrap_or(*node);
|
|
200
|
+
let mut names = Vec::new();
|
|
201
|
+
for i in 0..holder.child_count() {
|
|
202
|
+
let Some(child) = holder.child(i) else { continue };
|
|
203
|
+
let type_node = match child.kind() {
|
|
204
|
+
"type_identifier" | "scoped_type_identifier" => child,
|
|
205
|
+
// generic_type: first child is the raw type, then type_arguments
|
|
206
|
+
"generic_type" => match child.child(0) {
|
|
207
|
+
Some(t) => t,
|
|
208
|
+
None => continue,
|
|
209
|
+
},
|
|
210
|
+
_ => continue,
|
|
211
|
+
};
|
|
212
|
+
names.push(get_node_text(&type_node, source).to_string());
|
|
213
|
+
}
|
|
214
|
+
names
|
|
215
|
+
}
|
|
216
|
+
|
|
186
217
|
/// Start byte of the closest ancestor of one of `kinds`, if any.
|
|
187
218
|
fn enclosing_scope(node: &Node, kinds: &[&str]) -> Option<usize> {
|
|
188
219
|
let mut curr = node.parent();
|
|
@@ -254,6 +285,38 @@ impl JavaExtractor {
|
|
|
254
285
|
None
|
|
255
286
|
}
|
|
256
287
|
|
|
288
|
+
/// Resolve `this.<var>` to a field's declared type, searching only the
|
|
289
|
+
/// enclosing type declarations (innermost first).
|
|
290
|
+
fn lookup_field_type(
|
|
291
|
+
node: &Node,
|
|
292
|
+
var: &str,
|
|
293
|
+
typed: &HashMap<(usize, String), String>,
|
|
294
|
+
) -> Option<String> {
|
|
295
|
+
let mut curr = node.parent();
|
|
296
|
+
while let Some(p) = curr {
|
|
297
|
+
if TYPE_DECL_KINDS.contains(&p.kind()) {
|
|
298
|
+
if let Some(t) = typed.get(&(p.start_byte(), var.to_string())) {
|
|
299
|
+
return Some(t.clone());
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
curr = p.parent();
|
|
303
|
+
}
|
|
304
|
+
None
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/// Simple type name of a constructor call's type node:
|
|
308
|
+
/// `Box<String>` → `Box`, `a.b.Foo` → `Foo`, `ArrayList<>` → `ArrayList`.
|
|
309
|
+
fn constructor_name(type_node: &Node, source: &[u8]) -> String {
|
|
310
|
+
let raw = if type_node.kind() == "generic_type" {
|
|
311
|
+
type_node.child(0).unwrap_or(*type_node)
|
|
312
|
+
} else {
|
|
313
|
+
*type_node
|
|
314
|
+
};
|
|
315
|
+
let text = get_node_text(&raw, source);
|
|
316
|
+
let text = text.split('<').next().unwrap_or(text);
|
|
317
|
+
text.rsplit('.').next().unwrap_or(text).trim().to_string()
|
|
318
|
+
}
|
|
319
|
+
|
|
257
320
|
/// Extract parameter names from a formal_parameters text like "(int x, String name)"
|
|
258
321
|
fn extract_parameter_names(&self, params_text: &str) -> Vec<String> {
|
|
259
322
|
let mut params = Vec::new();
|
|
@@ -384,56 +447,24 @@ impl LanguageExtractor for JavaExtractor {
|
|
|
384
447
|
};
|
|
385
448
|
let class_name = get_node_text(&name_node, source).to_string();
|
|
386
449
|
|
|
450
|
+
// Base types, as simple names usable for lookup (generic arguments
|
|
451
|
+
// dropped): `extends Base<T>` → `Base`, `implements a.b.Api` → `a.b.Api`.
|
|
387
452
|
let mut bases = Vec::new();
|
|
388
453
|
|
|
389
|
-
//
|
|
390
|
-
if let Some(
|
|
391
|
-
bases.
|
|
454
|
+
// class X extends Base
|
|
455
|
+
if let Some(superclass) = node.child_by_field_name("superclass") {
|
|
456
|
+
bases.extend(Self::base_type_names(&superclass, source));
|
|
392
457
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
let interfaces_node = node
|
|
458
|
+
// class/record/enum X implements A, B
|
|
459
|
+
if let Some(ifaces) = node
|
|
396
460
|
.child_by_field_name("interfaces")
|
|
397
|
-
.or_else(||
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
// Find type_list within
|
|
405
|
-
let type_list = ifaces
|
|
406
|
-
.child_by_field_name("list")
|
|
407
|
-
.or_else(|| {
|
|
408
|
-
(0..ifaces.child_count())
|
|
409
|
-
.filter_map(|i| ifaces.child(i))
|
|
410
|
-
.find(|c| c.kind() == "type_list")
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
if let Some(tl) = type_list {
|
|
414
|
-
for i in 0..tl.child_count() {
|
|
415
|
-
if let Some(child) = tl.child(i) {
|
|
416
|
-
if matches!(
|
|
417
|
-
child.kind(),
|
|
418
|
-
"type_identifier" | "generic_type" | "scoped_type_identifier"
|
|
419
|
-
) {
|
|
420
|
-
bases.push(get_node_text(&child, source).to_string());
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
} else {
|
|
425
|
-
// Fallback: scan children of interfaces node directly
|
|
426
|
-
for i in 0..ifaces.child_count() {
|
|
427
|
-
if let Some(child) = ifaces.child(i) {
|
|
428
|
-
if matches!(
|
|
429
|
-
child.kind(),
|
|
430
|
-
"type_identifier" | "generic_type" | "scoped_type_identifier"
|
|
431
|
-
) {
|
|
432
|
-
bases.push(get_node_text(&child, source).to_string());
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
461
|
+
.or_else(|| Self::child_of_kind(&node, "super_interfaces"))
|
|
462
|
+
{
|
|
463
|
+
bases.extend(Self::base_type_names(&ifaces, source));
|
|
464
|
+
}
|
|
465
|
+
// interface X extends A, B
|
|
466
|
+
if let Some(ext) = Self::child_of_kind(&node, "extends_interfaces") {
|
|
467
|
+
bases.extend(Self::base_type_names(&ext, source));
|
|
437
468
|
}
|
|
438
469
|
|
|
439
470
|
let (context, _, _) = get_parent_context(&node, source, TYPE_DECL_KINDS);
|
|
@@ -475,10 +506,11 @@ impl LanguageExtractor for JavaExtractor {
|
|
|
475
506
|
let trimmed = import_text.trim();
|
|
476
507
|
let path = if let Some(rest) = trimmed.strip_prefix("import") {
|
|
477
508
|
let rest = rest.trim();
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
509
|
+
// `static` is a keyword only when followed by whitespace
|
|
510
|
+
// (a package may be named e.g. `staticfoo`).
|
|
511
|
+
let rest = match rest.strip_prefix("static") {
|
|
512
|
+
Some(r) if r.starts_with(char::is_whitespace) => r.trim(),
|
|
513
|
+
_ => rest,
|
|
482
514
|
};
|
|
483
515
|
rest.trim_end_matches(';').trim().to_string()
|
|
484
516
|
} else {
|
|
@@ -513,10 +545,15 @@ impl LanguageExtractor for JavaExtractor {
|
|
|
513
545
|
continue;
|
|
514
546
|
}
|
|
515
547
|
|
|
516
|
-
let
|
|
548
|
+
let call_text = get_node_text(&node, source);
|
|
549
|
+
let call_name = if node.parent().map(|p| p.kind()) == Some("object_creation_expression") {
|
|
550
|
+
Self::constructor_name(&node, source)
|
|
551
|
+
} else {
|
|
552
|
+
call_text.to_string()
|
|
553
|
+
};
|
|
517
554
|
let line_number = node.start_position().row + 1;
|
|
518
555
|
|
|
519
|
-
let call_key = format!("{}_{}",
|
|
556
|
+
let call_key = format!("{}_{}", call_text, line_number);
|
|
520
557
|
if seen_calls.contains(&call_key) {
|
|
521
558
|
continue;
|
|
522
559
|
}
|
|
@@ -568,12 +605,19 @@ impl LanguageExtractor for JavaExtractor {
|
|
|
568
605
|
// Resolve the receiver variable to its declared type when
|
|
569
606
|
// known; otherwise keep the identifier (e.g. a static
|
|
570
607
|
// `Foo.bar()` call, where the identifier is the type).
|
|
571
|
-
|
|
608
|
+
// `this.repo.save()` → the receiver is the field `repo`.
|
|
609
|
+
let (field_only, obj_rest) = match obj_text.strip_prefix("this.") {
|
|
610
|
+
Some(rest) => (true, rest),
|
|
611
|
+
None => (false, obj_text),
|
|
612
|
+
};
|
|
613
|
+
let base_obj = obj_rest.split('.').next().unwrap_or(obj_rest);
|
|
572
614
|
if !base_obj.contains('(') {
|
|
573
|
-
|
|
615
|
+
let resolved = if field_only {
|
|
616
|
+
Self::lookup_field_type(&node, base_obj, &typed_names)
|
|
617
|
+
} else {
|
|
574
618
|
Self::lookup_receiver_type(&node, base_obj, &typed_names)
|
|
575
|
-
|
|
576
|
-
);
|
|
619
|
+
};
|
|
620
|
+
inferred_obj_type = Some(resolved.unwrap_or_else(|| base_obj.to_string()));
|
|
577
621
|
}
|
|
578
622
|
}
|
|
579
623
|
} else if call_node.kind() == "object_creation_expression" {
|
|
@@ -838,4 +882,71 @@ public class PointController {
|
|
|
838
882
|
assert_eq!(ty("req.validate").as_deref(), Some("Req")); // parameter
|
|
839
883
|
assert_eq!(ty("Helper.run").as_deref(), Some("Helper")); // static call
|
|
840
884
|
}
|
|
885
|
+
|
|
886
|
+
#[test]
|
|
887
|
+
fn test_bases_strip_keywords_and_generics() {
|
|
888
|
+
let code = r#"
|
|
889
|
+
public class OrderController extends BaseCrudController<
|
|
890
|
+
CreateReq, UpdateReq> implements Auditable, a.b.Traceable<Order> {
|
|
891
|
+
}
|
|
892
|
+
public interface SettingRepository extends TenantAwareRepository<Setting>, Searchable {
|
|
893
|
+
}
|
|
894
|
+
public record Point(int x) implements Comparable<Point> {
|
|
895
|
+
}
|
|
896
|
+
"#;
|
|
897
|
+
let (tree, source) = parse_source(code);
|
|
898
|
+
let classes = JavaExtractor.find_classes(&tree.root_node(), &source, false);
|
|
899
|
+
let bases = |n: &str| classes.iter().find(|c| c.name == n).unwrap().bases.clone();
|
|
900
|
+
assert_eq!(bases("OrderController"), vec!["BaseCrudController", "Auditable", "a.b.Traceable"]);
|
|
901
|
+
assert_eq!(bases("SettingRepository"), vec!["TenantAwareRepository", "Searchable"]);
|
|
902
|
+
assert_eq!(bases("Point"), vec!["Comparable"]);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
#[test]
|
|
906
|
+
fn test_this_field_receiver_type() {
|
|
907
|
+
let code = r#"
|
|
908
|
+
public class OrderService {
|
|
909
|
+
private final OrderRepository repo;
|
|
910
|
+
public void save(Order repo) {
|
|
911
|
+
this.repo.save(repo);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
"#;
|
|
915
|
+
let (tree, source) = parse_source(code);
|
|
916
|
+
let calls = JavaExtractor.find_calls(&tree.root_node(), &source);
|
|
917
|
+
let save = calls.iter().find(|c| c.full_name == "this.repo.save").unwrap();
|
|
918
|
+
// The field type wins over the same-named parameter.
|
|
919
|
+
assert_eq!(save.inferred_obj_type.as_deref(), Some("OrderRepository"));
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
#[test]
|
|
923
|
+
fn test_static_import_requires_keyword() {
|
|
924
|
+
let code = r#"
|
|
925
|
+
import static a.B.c;
|
|
926
|
+
import staticfoo.Bar;
|
|
927
|
+
"#;
|
|
928
|
+
let (tree, source) = parse_source(code);
|
|
929
|
+
let imports = JavaExtractor.find_imports(&tree.root_node(), &source);
|
|
930
|
+
let names: Vec<_> = imports.iter().map(|i| i.name.as_str()).collect();
|
|
931
|
+
assert_eq!(names, vec!["a.B.c", "staticfoo.Bar"]);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
#[test]
|
|
935
|
+
fn test_constructor_call_simple_name() {
|
|
936
|
+
let code = r#"
|
|
937
|
+
public class Main {
|
|
938
|
+
public void run() {
|
|
939
|
+
Box<String> b = new Box<String>();
|
|
940
|
+
List<String> l = new ArrayList<>();
|
|
941
|
+
Object f = new a.b.Foo();
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
"#;
|
|
945
|
+
let (tree, source) = parse_source(code);
|
|
946
|
+
let calls = JavaExtractor.find_calls(&tree.root_node(), &source);
|
|
947
|
+
let full = |n: &str| calls.iter().find(|c| c.name == n).unwrap().full_name.clone();
|
|
948
|
+
assert_eq!(full("Box"), "Box<String>");
|
|
949
|
+
assert_eq!(full("ArrayList"), "ArrayList<>");
|
|
950
|
+
assert_eq!(full("Foo"), "a.b.Foo");
|
|
951
|
+
}
|
|
841
952
|
}
|