Skip to main content

Crate react_compiler_inference

Crate react_compiler_inference 

Source

Re-exports§

pub use align_method_call_scopes::align_method_call_scopes;
pub use align_object_method_scopes::align_object_method_scopes;
pub use align_reactive_scopes_to_block_scopes_hir::align_reactive_scopes_to_block_scopes_hir;
pub use build_reactive_scope_terminals_hir::build_reactive_scope_terminals_hir;
pub use flatten_reactive_loops_hir::flatten_reactive_loops_hir;
pub use flatten_scopes_with_hooks_or_use_hir::flatten_scopes_with_hooks_or_use_hir;
pub use analyse_functions::analyse_functions;
pub use infer_mutation_aliasing_effects::infer_mutation_aliasing_effects;
pub use infer_mutation_aliasing_ranges::infer_mutation_aliasing_ranges;
pub use infer_reactive_places::infer_reactive_places;
pub use infer_reactive_scope_variables::infer_reactive_scope_variables;
pub use memoize_fbt_and_macro_operands_in_same_scope::memoize_fbt_and_macro_operands_in_same_scope;
pub use merge_overlapping_reactive_scopes_hir::merge_overlapping_reactive_scopes_hir;
pub use propagate_scope_dependencies_hir::propagate_scope_dependencies_hir;

Modules§

align_method_call_scopes
Ensures that method call instructions have scopes such that either:
align_object_method_scopes
Aligns scopes of object method values to that of their enclosing object expressions. To produce a well-formed JS program in Codegen, object methods and object expressions must be in the same ReactiveBlock as object method definitions must be inlined.
align_reactive_scopes_to_block_scopes_hir
Aligns reactive scope boundaries to block scope boundaries in the HIR.
analyse_functions
Recursively analyzes nested function expressions and object methods to infer their aliasing effect signatures.
build_reactive_scope_terminals_hir
Builds reactive scope terminals in the HIR.
flatten_reactive_loops_hir
Prunes any reactive scopes that are within a loop (for, while, etc). We don’t yet support memoization within loops because this would require an extra layer of reconciliation (plus a way to identify values across runs, similar to how we use key in JSX for lists). Eventually we may integrate more deeply into the runtime so that we can do a single level of reconciliation, but for now we’ve found it’s sufficient to memoize around the loop.
flatten_scopes_with_hooks_or_use_hir
For simplicity the majority of compiler passes do not treat hooks specially. However, hooks are different from regular functions in two key ways:
infer_mutation_aliasing_effects
Infers the mutation/aliasing effects for instructions and terminals.
infer_mutation_aliasing_ranges
Infers mutable ranges for identifiers and populates Place effects.
infer_reactive_places
Infers which Places are reactive.
infer_reactive_scope_variables
Infers which variables belong to reactive scopes.
memoize_fbt_and_macro_operands_in_same_scope
Port of MemoizeFbtAndMacroOperandsInSameScope from TypeScript.
merge_overlapping_reactive_scopes_hir
Merges reactive scopes that have overlapping ranges.
propagate_scope_dependencies_hir
Propagates scope dependencies through the HIR, computing which values each reactive scope depends on.