---
source: crates/aiken-lang/src/parser/definition/function.rs
description: "Code:\n\nfn foo(Foo { my_field }: Foo) {\n    my_field * 2\n}\n"
---
Fn(
    Function {
        arguments: [
            UntypedArg {
                by: ByPattern(
                    Constructor {
                        is_record: true,
                        location: 7..23,
                        name: "Foo",
                        arguments: [
                            CallArg {
                                label: Some(
                                    "my_field",
                                ),
                                location: 13..21,
                                value: Var {
                                    location: 13..21,
                                    name: "my_field",
                                },
                            },
                        ],
                        module: None,
                        constructor: (),
                        spread_location: None,
                        tipo: (),
                    },
                ),
                location: 7..28,
                annotation: Some(
                    Constructor {
                        location: 25..28,
                        module: None,
                        name: "Foo",
                        arguments: [],
                    },
                ),
                doc: None,
                is_validator_param: false,
            },
        ],
        body: BinOp {
            location: 36..48,
            name: MultInt,
            left: Var {
                location: 36..44,
                name: "my_field",
            },
            right: UInt {
                location: 47..48,
                value: "2",
                base: Decimal {
                    numeric_underscore: false,
                },
            },
        },
        doc: None,
        location: 0..29,
        name: "foo",
        public: false,
        return_annotation: None,
        return_type: (),
        end_position: 49,
        on_test_failure: FailImmediately,
    },
)
