fn decode<T: AbiEncoding>(typ: T, location: AbiDecodeLocation) -> yul::Statement {
    let func_name = names::decode_name(&typ, location.clone());

    let decode_expr = match typ.abi_type() {
        AbiType::Uint { .. } => decode_uint(location),
        AbiType::Array { inner, size } => match size {
            AbiArraySize::Static { size } => decode_static_array(*inner, size, location),
            AbiArraySize::Dynamic => decode_dyn_array(*inner, location),
        },
        AbiType::Tuple { elems } => decode_tuple(elems, location),
    };

    function_definition! {
         function [func_name](start_ptr, offset) -> decoded_ptr {
            (let head_ptr := add(start_ptr, offset))
            (decoded_ptr := [decode_expr])
         }
    }
}
/// Generates a decoding function for a single type parameter in either
/// calldata or memory.
Generates a decoding function for a single type parameter in either
calldata or memory.
Generates a decoding function for a single type parameter in either calldata or memory .
fn decode<T: AbiEncoding>(typ: T, location: AbiDecodeLocation) -> yul::Statement {
    let func_name = names::decode_name(&typ, location.clone());
    let decode_expr = match typ.abi_type() {
        AbiType::Uint { .. } => decode_uint(location),
        AbiType::Array { inner, size } => match size {
            AbiArraySize::Static { size } => decode_static_array(*inner, size, location),
            AbiArraySize::Dynamic => decode_dyn_array(*inner, location),
        },
        AbiType::Tuple { elems } => decode_tuple(elems, location),
    };
    function_definition! {
         function [func_name](start_ptr, offset) -> decoded_ptr {
            (let head_ptr := add(start_ptr, offset))
            (decoded_ptr := [decode_expr])
         }
    }
}
fn decode < T : AbiEncoding > ( typ : T , location : AbiDecodeLocation ) -> yul :: Statement { let func_name = names :: decode_name ( & typ , location . clone ( ) ) ; let decode_expr = match typ . abi_type ( ) { AbiType :: Uint { .. } => decode_uint ( location ) , AbiType :: Array { inner , size } => match size { AbiArraySize :: Static { size } => decode_static_array ( * inner , size , location ) , AbiArraySize :: Dynamic => decode_dyn_array ( * inner , location ) , } , AbiType :: Tuple { elems } => decode_tuple ( elems , location ) , } ; function_definition ! { function [ func_name ] ( start_ptr offset ) decoded_ptr { ( let head_ptr add ( start_ptr offset ) ) ( decoded_ptr [ decode_expr ] ) } } }
Generates a decoding function for a single type parameter in either
calldata or memory.
Generates a decoding function for a single type parameter in either calldata or memory .
typ
T
location
AbiDecodeLocation
typ
T
location
AbiDecodeLocation