Skip to content

Fix class method export detection for JavaScript/TypeScript#1246

Merged
misrasaurabh1 merged 3 commits intomainfrom
fix/class-method-export-detection
Feb 2, 2026
Merged

Fix class method export detection for JavaScript/TypeScript#1246
misrasaurabh1 merged 3 commits intomainfrom
fix/class-method-export-detection

Conversation

@misrasaurabh1
Copy link
Contributor

Summary

  • Fixed an issue where class methods were incorrectly flagged as "not exported" when their containing class was actually exported
  • The is_function_exported() method now accepts an optional class_name parameter to check if the containing class is exported
  • This enables proper reference finding for class methods like BloomFilter.getHashValues

Test plan

  • Added 3 new tests for class method export detection
  • All 48 existing import_resolver tests pass
  • All 35 find_references tests pass
  • All 43 treesitter_utils tests pass

🤖 Generated with Claude Code

When checking if a function is exported for reference finding, the
is_function_exported() method now accepts an optional class_name
parameter. For class methods, it checks whether the containing class
is exported (either as a named export or default export).

This fixes the issue where class methods like `BloomFilter.getHashValues`
would incorrectly show "Function getHashValues is not exported from..."
warnings when the BloomFilter class was actually exported.

Changes:
- treesitter_utils.py: Extended is_function_exported() to check class
  exports when class_name parameter is provided
- find_references.py: Added class_name parameter throughout the call
  chain to pass class context
- support.py: Pass function.class_name when calling find_references
- Added tests for class method export detection scenarios

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@misrasaurabh1 misrasaurabh1 merged commit 239a5a8 into main Feb 2, 2026
17 of 27 checks passed
@misrasaurabh1 misrasaurabh1 deleted the fix/class-method-export-detection branch February 2, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant