fn generate_code_for_funccall_param(
    generator: &mut impl Generator,
    param_node: &Box<ASTnode>,
) -> u8 {
    match &param_node.right {
        Some(n) => {
            let data_size = generator.data_type_to_size(n.data_type);
            let r = generate_code_for_node(generator, n);
            match r {
                Some(r) => {
                    // Symtable entry should be available here, this shouldn't ever
                    // fail for FUNCPARAMs
                    generator.move_to_position(
                        r,
                        &param_node.symtable_entry.as_ref().unwrap().borrow().posn,
                        data_size,
                    );
                }
                None => {
                    // This branch should never be invoked.
                    panic!("Expression to be used an argument to function is returned nothing.");
                }
            };
        }
        None => {
            // This should never happen.
            panic!("Empty right node for ASTop::FUNCPARAM node.");
        }
    }

    if let Some(next_node) = &param_node.left {
        generate_code_for_funccall_param(generator, next_node) + 1
    } else {
        1
    }
}
// Returns the number of params that we generated code for
Returns the number of params that we generated code for
Returns the number of params that we generated code for
fn generate_code_for_funccall_param(
    generator: &mut impl Generator,
    param_node: &Box<ASTnode>,
) -> u8 {
    match &param_node.right {
        Some(n) => {
            let data_size = generator.data_type_to_size(n.data_type);
            let r = generate_code_for_node(generator, n);
            match r {
                Some(r) => {
                    // Symtable entry should be available here, this shouldn't ever
                    // fail for FUNCPARAMs
                    generator.move_to_position(
                        r,
                        &param_node.symtable_entry.as_ref().unwrap().borrow().posn,
                        data_size,
                    );
                }
                None => {
                    // This branch should never be invoked.
                    panic!("Expression to be used an argument to function is returned nothing.");
                }
            };
        }
        None => {
            // This should never happen.
            panic!("Empty right node for ASTop::FUNCPARAM node.");
        }
    }
    if let Some(next_node) = &param_node.left {
        generate_code_for_funccall_param(generator, next_node) + 1
    } else {
        1
    }
}
fn generate_code_for_funccall_param ( generator : & mut impl Generator , param_node : & Box < ASTnode > , ) -> u8 { match & param_node . right { Some ( n ) => { let data_size = generator . data_type_to_size ( n . data_type ) ; let r = generate_code_for_node ( generator , n ) ; match r { Some ( r ) => { // Symtable entry should be available here, this shouldn't ever // fail for FUNCPARAMs generator . move_to_position ( r , & param_node . symtable_entry . as_ref ( ) . unwrap ( ) . borrow ( ) . posn , data_size , ) ; } None => { // This branch should never be invoked. panic ! ( " " ) ; } } ; } None => { // This should never happen. panic ! ( " " ) ; } } if let Some ( next_node ) = & param_node . left { generate_code_for_funccall_param ( generator , next_node ) + 1 } else { 1 } }
Returns the number of params that we generated code for
Returns the number of params that we generated code for
generator
&mut impl Generator
param_node
&Box<ASTnode>