Expand description
Shared extraction utilities for extract_function (and future inline_symbol).
Provides:
detect_free_variables— classify identifier references in a byte rangedetect_return_value— infer what the extracted function should returngenerate_extracted_function— produce function text for TS/JS or Python
Structs§
- Free
Variable Result - Classification result for free variables in a selected byte range.
- Scope
Conflict - A detected scope conflict when inlining a function body at a call site.
Enums§
- Return
Kind - What the extracted function should return.
Functions§
- detect_
free_ variables - Walk the AST for a byte range and classify every identifier reference.
- detect_
return_ value - Detect what the extracted code range should return.
- detect_
scope_ conflicts - Detect scope conflicts between the call site scope and the function body being inlined.
- generate_
call_ site - Generate the call site text that replaces the extracted range.
- generate_
extracted_ function - Generate the text for an extracted function.
- substitute_
params - Substitute parameter names with argument expressions in a function body.
- validate_
single_ return - Validate that a function has at most one return statement (suitable for inlining).