fn resolve_for_init_block(
    init_block: &pt::YulBlock,
    context: &ExprContext,
    reachable: bool,
    loop_scope: &mut LoopScopes,
    symtable: &mut Symtable,
    function_table: &mut FunctionsTable,
    ns: &mut Namespace,
) -> Result<(YulBlock, bool), ()> {
    for item in &init_block.statements {
        if matches!(item, pt::YulStatement::FunctionDefinition(_)) {
            ns.diagnostics.push(Diagnostic::error(
                item.loc(),
                "function definitions are not allowed inside for-init block".to_string(),
            ));
            return Err(());
        }
    }

    let (body, next_reachable) = process_statements(
        &init_block.statements,
        context,
        reachable,
        symtable,
        loop_scope,
        function_table,
        ns,
    );

    Ok((
        YulBlock {
            loc: init_block.loc,
            reachable,
            body,
        },
        next_reachable,
    ))
}
/// Resolve for initialization block.
/// Returns the resolved block and a bool to indicate if the next statement is reachable.
Resolve for initialization block.
Returns the resolved block and a bool to indicate if the next statement is reachable.
Resolve for initialization block . Returns the resolved block and a bool to indicate if the next statement is reachable .
fn resolve_for_init_block(
    init_block: &pt::YulBlock,
    context: &ExprContext,
    reachable: bool,
    loop_scope: &mut LoopScopes,
    symtable: &mut Symtable,
    function_table: &mut FunctionsTable,
    ns: &mut Namespace,
) -> Result<(YulBlock, bool), ()> {
    for item in &init_block.statements {
        if matches!(item, pt::YulStatement::FunctionDefinition(_)) {
            ns.diagnostics.push(Diagnostic::error(
                item.loc(),
                "function definitions are not allowed inside for-init block".to_string(),
            ));
            return Err(());
        }
    }
    let (body, next_reachable) = process_statements(
        &init_block.statements,
        context,
        reachable,
        symtable,
        loop_scope,
        function_table,
        ns,
    );
    Ok((
        YulBlock {
            loc: init_block.loc,
            reachable,
            body,
        },
        next_reachable,
    ))
}
fn resolve_for_init_block ( init_block : & pt :: YulBlock , context : & ExprContext , reachable : bool , loop_scope : & mut LoopScopes , symtable : & mut Symtable , function_table : & mut FunctionsTable , ns : & mut Namespace , ) -> Result < ( YulBlock , bool ) , ( ) > { for item in & init_block . statements { if matches ! ( item pt YulStatement FunctionDefinition ( ) ) { ns . diagnostics . push ( Diagnostic :: error ( item . loc ( ) , " " . to_string ( ) , ) ) ; return Err ( ( ) ) ; } } let ( body , next_reachable ) = process_statements ( & init_block . statements , context , reachable , symtable , loop_scope , function_table , ns , ) ; Ok ( ( YulBlock { loc : init_block . loc , reachable , body , } , next_reachable , ) ) }
Resolve for initialization block.
Resolve for initialization block .
init_block
&pt::YulBlock
context
&ExprContext
reachable
bool
loop_scope
&mut LoopScopes
symtable
&mut Symtable
function_table
&mut FunctionsTable
ns
&mut Namespace
init_block
&pt::YulBlock
context
&ExprContext
reachable
bool
loop_scope
&mut LoopScopes
symtable
&mut Symtable
function_table
&mut FunctionsTable
ns
&mut Namespace