Esempio n. 1
0
def _prepare_for_rebinding(bb):
    """Replaces `bb` with semantically equivalent version for rebinding."""
    bb = compiler.normalize_all_equal_bit(bb)
    bb, _ = tree_transformations.remove_mapped_or_applied_identity(bb)
    bb = transformations.to_call_dominant(bb)
    bb, _ = tree_transformations.remove_unused_block_locals(bb)
    return bb
Esempio n. 2
0
    def _remove_functional_symbol_bindings(comp):
        """Removes symbol bindings which contain functional types."""

        comp, refs_renamed = tree_transformations.uniquify_reference_names(
            comp)
        comp, lambdas_replaced = tree_transformations.replace_called_lambda_with_block(
            comp)
        comp, selections_inlined = tree_transformations.inline_selections_from_tuple(
            comp)
        if selections_inlined:
            comp, _ = tree_transformations.uniquify_reference_names(comp)
        comp, functions_inlined = _inline_functions(comp)
        comp, locals_removed = tree_transformations.remove_unused_block_locals(
            comp)

        modified = (refs_renamed or lambdas_replaced or selections_inlined
                    or functions_inlined or locals_removed)
        return comp, modified