Broad refactor (part 7): Swap in the new CFG implementation, along with the...
Broad refactor (part 7): Swap in the new CFG implementation, along with the new directives support. Simplify the process by which transformers are applied and their testing. Changes to converters: * all tests have been refactored to use the new helpers; functionally they remain the same * several converters have been renamed to be more consistent with the overall naming patterns: single_return.py -> return_statements.py; list_comprehension.py -> list_comprehensions.py; if_exp.py -> conditional_expressions.py * conditional expression converter has been rewritten to use local functions instead of lambdas, which are not yet supported by the static analyzers * the handling of if statements in control_flow.py now uses both the liveness and reaching definitions analyses to more robustly detect output variables * a new directives.py converter is introduced, that transforms user directives (see lang/directives.py) into AST annotations and removes the function calls from the code * list_comprehensions.py is slightly refactored for better readability; it is still not yet enabled * slices.py and lists.py now use the new directives mechanism to obtain list type information * side_effects_guards_test.py has been refactored to avoid flakiness Changes to AG core: * conversion.py now uses the helpers from converter.py and removes the redundant function * converter_testing.py now offers a more unified helper that can be used to test most use cases with less boilerplate * the new directives module now completely replaces the obsolete type_hints.py Changes to static analysis: * activity.py no longer considers index mutation to modify the parent (e.g. a[0] = 1 is not considered to modify a) * activity.py no longer detects the local symbol changes (the IS_MODIFIED_SINCE_ENTRY annotation), which is now handled by reaching_definitions.py * activity.py marks the created field as obsolete, to be removed once the loops in control_flow are migrated to use the dataflow analyses * the obsolete annos.py extension has been removes in favor of the consolidated tags in anno.py * the new CFG implementation now completely replaces the old version * live_values.py and type_info.py also use the symbol definitions from reaching_definitions.py PiperOrigin-RevId: 204563046
Loading
Please sign in to comment