pub(crate) fn resolve_for_loop(
    yul_for: &pt::YulFor,
    context: &ExprContext,
    reachable: bool,
    loop_scope: &mut LoopScopes,
    symtable: &mut Symtable,
    function_table: &mut FunctionsTable,
    ns: &mut Namespace,
) -> Result<(YulStatement, bool), ()> {
    symtable.new_scope();
    function_table.new_scope();
    let mut next_reachable = reachable;
    let resolved_init_block = resolve_for_init_block(
        &yul_for.init_block,
        context,
        next_reachable,
        loop_scope,
        symtable,
        function_table,
        ns,
    )?;
    next_reachable &= resolved_init_block.1;

    let resolved_cond =
        resolve_condition(&yul_for.condition, context, symtable, function_table, ns)?;

    loop_scope.new_scope();

    let resolved_exec_block = resolve_yul_block(
        &yul_for.execution_block.loc,
        &yul_for.execution_block.statements,
        context,
        next_reachable,
        loop_scope,
        function_table,
        symtable,
        ns,
    );
    next_reachable &= resolved_exec_block.1;

    loop_scope.leave_scope();

    let resolved_post_block = resolve_yul_block(
        &yul_for.post_block.loc,
        &yul_for.post_block.statements,
        context,
        next_reachable,
        loop_scope,
        function_table,
        symtable,
        ns,
    );

    symtable.leave_scope();
    function_table.leave_scope(ns);

    Ok((
        YulStatement::For {
            loc: yul_for.loc,
            reachable,
            init_block: resolved_init_block.0,
            condition: resolved_cond,
            post_block: resolved_post_block.0,
            execution_block: resolved_exec_block.0,
        },
        resolved_init_block.1,
    ))
}
/// Resolve a for-loop statement
/// Returns the resolved block and a bool to indicate if the next statement is reachable.
Resolve a for-loop statement
Returns the resolved block and a bool to indicate if the next statement is reachable.
Resolve a for - loop statement Returns the resolved block and a bool to indicate if the next statement is reachable .
pub(crate) fn resolve_for_loop(
    yul_for: &pt::YulFor,
    context: &ExprContext,
    reachable: bool,
    loop_scope: &mut LoopScopes,
    symtable: &mut Symtable,
    function_table: &mut FunctionsTable,
    ns: &mut Namespace,
) -> Result<(YulStatement, bool), ()> {
    symtable.new_scope();
    function_table.new_scope();
    let mut next_reachable = reachable;
    let resolved_init_block = resolve_for_init_block(
        &yul_for.init_block,
        context,
        next_reachable,
        loop_scope,
        symtable,
        function_table,
        ns,
    )?;
    next_reachable &= resolved_init_block.1;
    let resolved_cond =
        resolve_condition(&yul_for.condition, context, symtable, function_table, ns)?;
    loop_scope.new_scope();
    let resolved_exec_block = resolve_yul_block(
        &yul_for.execution_block.loc,
        &yul_for.execution_block.statements,
        context,
        next_reachable,
        loop_scope,
        function_table,
        symtable,
        ns,
    );
    next_reachable &= resolved_exec_block.1;
    loop_scope.leave_scope();
    let resolved_post_block = resolve_yul_block(
        &yul_for.post_block.loc,
        &yul_for.post_block.statements,
        context,
        next_reachable,
        loop_scope,
        function_table,
        symtable,
        ns,
    );
    symtable.leave_scope();
    function_table.leave_scope(ns);
    Ok((
        YulStatement::For {
            loc: yul_for.loc,
            reachable,
            init_block: resolved_init_block.0,
            condition: resolved_cond,
            post_block: resolved_post_block.0,
            execution_block: resolved_exec_block.0,
        },
        resolved_init_block.1,
    ))
}
pub ( crate ) fn resolve_for_loop ( yul_for : & pt :: YulFor , context : & ExprContext , reachable : bool , loop_scope : & mut LoopScopes , symtable : & mut Symtable , function_table : & mut FunctionsTable , ns : & mut Namespace , ) -> Result < ( YulStatement , bool ) , ( ) > { symtable . new_scope ( ) ; function_table . new_scope ( ) ; let mut next_reachable = reachable ; let resolved_init_block = resolve_for_init_block ( & yul_for . init_block , context , next_reachable , loop_scope , symtable , function_table , ns , ) ? ; next_reachable &= resolved_init_block . 1 ; let resolved_cond = resolve_condition ( & yul_for . condition , context , symtable , function_table , ns ) ? ; loop_scope . new_scope ( ) ; let resolved_exec_block = resolve_yul_block ( & yul_for . execution_block . loc , & yul_for . execution_block . statements , context , next_reachable , loop_scope , function_table , symtable , ns , ) ; next_reachable &= resolved_exec_block . 1 ; loop_scope . leave_scope ( ) ; let resolved_post_block = resolve_yul_block ( & yul_for . post_block . loc , & yul_for . post_block . statements , context , next_reachable , loop_scope , function_table , symtable , ns , ) ; symtable . leave_scope ( ) ; function_table . leave_scope ( ns ) ; Ok ( ( YulStatement :: For { loc : yul_for . loc , reachable , init_block : resolved_init_block . 0 , condition : resolved_cond , post_block : resolved_post_block . 0 , execution_block : resolved_exec_block . 0 , } , resolved_init_block . 1 , ) ) }
Resolve a for-loop statement
Returns the resolved block and a bool to indicate if the next statement is reachable.
Resolve a for - loop statement Returns the resolved block and a bool to indicate if the next statement is reachable .
yul_for
&pt::YulFor
context
&ExprContext
reachable
bool
loop_scope
&mut LoopScopes
symtable
&mut Symtable
function_table
&mut FunctionsTable
ns
&mut Namespace
yul_for
&pt::YulFor
context
&ExprContext
reachable
bool
loop_scope
&mut LoopScopes
symtable
&mut Symtable
function_table
&mut FunctionsTable
ns
&mut Namespace