Skip to content

Conversation

@misrasaurabh1
Copy link
Contributor

Refactors JavaScript optimization code to use the FunctionToOptimize dataclass instead of passing function names as raw strings. This eliminates redundant parameters like class_name and provides better type safety throughout the codebase.

  • Add class_name property to FunctionToOptimize for parity with FunctionInfo
  • Add from_function_info classmethod to convert from FunctionInfo
  • Update instrument.py transformers (StandaloneCallTransformer, ExpectCallTransformer) to accept FunctionToOptimize
  • Update wrapper functions (transform_expect_calls, transform_standalone_calls, _instrument_js_test_code, instrument_generated_js_test)
  • Update find_references.py (ReferenceFinder.find_references, find_references convenience function)
  • Update callers in support.py and verifier.py
  • Update all test files

Test plan

  • All existing tests pass (667 tests)
  • pytest tests/test_javascript_assertion_removal.py - 78 tests pass
  • pytest tests/test_languages/test_find_references.py - 35 tests pass
  • pytest tests/test_languages/test_javascript_instrumentation.py - 29 tests pass

misrasaurabh1 and others added 2 commits February 2, 2026 01:53
…JS optimization

Replace raw function_name/qualified_name/class_name string parameters with
the FunctionToOptimize dataclass throughout JavaScript optimization code.
This provides better type safety and eliminates redundant parameters.

Changes:
- Add class_name property to FunctionToOptimize (similar to FunctionInfo)
- Add from_function_info classmethod for FunctionInfo conversion
- Update instrument.py transformers and functions to accept FunctionToOptimize
- Update find_references.py to accept FunctionToOptimize
- Update support.py and verifier.py callers
- Update all test files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

3 participants