codeflash/code_to_optimize
ali a6b936402d
fix: include same-class helper methods inside class wrapper for TypeScript
When optimizing TypeScript class methods that call other methods from the
same class, the helper methods were being appended OUTSIDE the class
definition. This caused syntax errors because class-specific keywords like
`private` are only valid inside a class body.

Changes:
- Add _find_same_class_helpers() method to identify helper methods belonging
  to the same class as the target method
- Modify extract_code_context() to include same-class helpers inside the
  class wrapper and filter them from the helpers list
- Fix all JavaScript/TypeScript tests by adding export keywords to test code
  so functions can be discovered by discover_functions()
- Add comprehensive tests for same-class helper extraction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:19:46 +02:00
..
code_directories update both of these 2026-01-09 02:07:25 -05:00
final_test_set Implemented testgen context retrieval. Context retrieved is the union of read-writable code and read-only code. Did some refactors to remove code_to_optimize_with_helpers, and updated tests. 2025-03-05 16:40:23 -08:00
js fix: include same-class helper methods inside class wrapper for TypeScript 2026-02-06 17:19:46 +02:00
tests tensorflow, jax, pytorch now working on mac metal 2026-01-15 19:04:31 -08:00
__init__.py Move codeflash python code base to cli/ 2023-12-29 18:37:49 -08:00
async_bubble_sort.py first pass 2025-09-26 13:53:15 -07:00
book_catalog.py ruff format 2024-10-12 20:58:44 -05:00
book_catalog2.py sqlalchemy experiment wip. 2024-05-16 15:38:37 -07:00
book_catalog3.py sqlalchemy experiment wip. 2024-05-16 15:38:37 -07:00
bubble_sort.py typo 2025-08-06 03:40:06 +03:00
bubble_sort2.py Implemented testgen context retrieval. Context retrieved is the union of read-writable code and read-only code. Did some refactors to remove code_to_optimize_with_helpers, and updated tests. 2025-03-05 16:40:23 -08:00
bubble_sort_3.py Move codeflash python code base to cli/ 2023-12-29 18:37:49 -08:00
bubble_sort_classmethod.py more tests 2025-03-31 18:36:32 -07:00
bubble_sort_codeflash_trace.py Support recursive functions, and @benchmark / @pytest.mark.benchmark ways of using benchmark. created tests for all of them 2025-04-09 17:19:20 -07:00
bubble_sort_dep1_helper.py Move codeflash python code base to cli/ 2023-12-29 18:37:49 -08:00
bubble_sort_dep2_swap.py Move codeflash python code base to cli/ 2023-12-29 18:37:49 -08:00
bubble_sort_deps.py cleaning up 2025-03-28 19:31:52 -07:00
bubble_sort_from_another_file.py Refactor PR creation process 2024-04-12 17:38:45 -07:00
bubble_sort_in_class.py Move codeflash python code base to cli/ 2023-12-29 18:37:49 -08:00
bubble_sort_in_nested_class.py Move codeflash python code base to cli/ 2023-12-29 18:37:49 -08:00
bubble_sort_method.py newline 2025-11-06 14:05:01 -08:00
bubble_sort_multithread.py gha failing on multithreaded t est 2025-04-16 19:27:45 -04:00
bubble_sort_nested_classmethod.py cleaning up 2025-03-28 19:31:52 -07:00
bubble_sort_picklepatch_test_unused_socket.py end to end test that proves picklepatcher works. example shown is a socket (which is unpickleable) that's used or not used 2025-04-10 21:43:56 -04:00
bubble_sort_picklepatch_test_used_socket.py end to end test that proves picklepatcher works. example shown is a socket (which is unpickleable) that's used or not used 2025-04-10 21:43:56 -04:00
bubble_sort_typed.py Running end-to-end. 2024-11-23 17:24:15 -08:00
crosshair_tests.py Running end-to-end. 2024-11-23 17:24:15 -08:00
find_common_tags.py Many fixes, concolic test coverage. 2024-11-07 16:00:57 -08:00
helper_method.py remove random binary characters 2024-10-13 16:09:41 -07:00
impure.py Test of a function mutating its unput 2024-02-29 03:18:12 -08:00
math_utils.py Refactor PR creation process 2024-04-12 17:38:45 -07:00
pig_latin.py Move codeflash python code base to cli/ 2023-12-29 18:37:49 -08:00
process_and_bubble_sort.py initial implementation for tracing benchmarks using a plugin, and projecting speedup 2025-04-09 17:18:08 -07:00
process_and_bubble_sort_codeflash_trace.py tests pass 2025-04-09 17:18:55 -07:00
remove_control_chars.py test file for init optimization example 2025-01-22 15:02:24 -08:00
sample_code.py almost ready 2026-01-15 18:58:13 -08:00
sleeptime.py Fix cli tests 2024-10-23 14:38:23 -07:00
text_processor.py another test function for init optim 2025-01-22 16:31:56 -08:00
topological_sort.py revert newline 2025-10-31 14:51:37 -07:00
typed_topological_sort.py Many fixes, concolic test coverage. 2024-11-07 11:33:10 -08:00
use_cosine_similarity_from_other_file.py Implemented testgen context retrieval. Context retrieved is the union of read-writable code and read-only code. Did some refactors to remove code_to_optimize_with_helpers, and updated tests. 2025-03-05 16:40:23 -08:00
User_post.py Merge branch 'main' of https://github.com/codeflash-ai/codeflash into pathlib-migration 2024-10-13 18:14:44 -05:00