Skip to main content

hoist_expression

Function hoist_expression 

Source
pub(crate) fn hoist_expression(
    ast_expression: Expr,
    state: &mut StateManager,
) -> Expr
Expand description

Hoists an expression to the program level by creating a const variable declaration. This is the Rust equivalent of the JavaScript hoistExpression function.

§Arguments

  • ast_expression - The expression to hoist
  • state - The state manager to add the hoisted declaration to

§Returns

An identifier referencing the hoisted variable