---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/ok/nested_async_comprehension_py311.py
---
## AST

```
Module(
    ModModule {
        range: 0..277,
        body: [
            FunctionDef(
                StmtFunctionDef {
                    range: 44..111,
                    is_async: true,
                    decorator_list: [],
                    name: Identifier {
                        id: Name("f"),
                        range: 54..55,
                    },
                    type_params: None,
                    parameters: Parameters {
                        range: 55..57,
                        posonlyargs: [],
                        args: [],
                        vararg: None,
                        kwonlyargs: [],
                        kwarg: None,
                    },
                    returns: None,
                    body: [
                        Return(
                            StmtReturn {
                                range: 59..111,
                                value: Some(
                                    ListComp(
                                        ExprListComp {
                                            range: 66..111,
                                            elt: ListComp(
                                                ExprListComp {
                                                    range: 67..92,
                                                    elt: Name(
                                                        ExprName {
                                                            range: 68..69,
                                                            id: Name("x"),
                                                            ctx: Load,
                                                        },
                                                    ),
                                                    generators: [
                                                        Comprehension {
                                                            range: 70..91,
                                                            target: Name(
                                                                ExprName {
                                                                    range: 80..81,
                                                                    id: Name("x"),
                                                                    ctx: Store,
                                                                },
                                                            ),
                                                            iter: Call(
                                                                ExprCall {
                                                                    range: 85..91,
                                                                    func: Name(
                                                                        ExprName {
                                                                            range: 85..88,
                                                                            id: Name("foo"),
                                                                            ctx: Load,
                                                                        },
                                                                    ),
                                                                    arguments: Arguments {
                                                                        range: 88..91,
                                                                        args: [
                                                                            Name(
                                                                                ExprName {
                                                                                    range: 89..90,
                                                                                    id: Name("n"),
                                                                                    ctx: Load,
                                                                                },
                                                                            ),
                                                                        ],
                                                                        keywords: [],
                                                                    },
                                                                },
                                                            ),
                                                            ifs: [],
                                                            is_async: true,
                                                        },
                                                    ],
                                                },
                                            ),
                                            generators: [
                                                Comprehension {
                                                    range: 93..110,
                                                    target: Name(
                                                        ExprName {
                                                            range: 97..98,
                                                            id: Name("n"),
                                                            ctx: Store,
                                                        },
                                                    ),
                                                    iter: Call(
                                                        ExprCall {
                                                            range: 102..110,
                                                            func: Name(
                                                                ExprName {
                                                                    range: 102..107,
                                                                    id: Name("range"),
                                                                    ctx: Load,
                                                                },
                                                            ),
                                                            arguments: Arguments {
                                                                range: 107..110,
                                                                args: [
                                                                    NumberLiteral(
                                                                        ExprNumberLiteral {
                                                                            range: 108..109,
                                                                            value: Int(
                                                                                3,
                                                                            ),
                                                                        },
                                                                    ),
                                                                ],
                                                                keywords: [],
                                                            },
                                                        },
                                                    ),
                                                    ifs: [],
                                                    is_async: false,
                                                },
                                            ],
                                        },
                                    ),
                                ),
                            },
                        ),
                    ],
                },
            ),
            FunctionDef(
                StmtFunctionDef {
                    range: 122..192,
                    is_async: true,
                    decorator_list: [],
                    name: Identifier {
                        id: Name("g"),
                        range: 132..133,
                    },
                    type_params: None,
                    parameters: Parameters {
                        range: 133..135,
                        posonlyargs: [],
                        args: [],
                        vararg: None,
                        kwonlyargs: [],
                        kwarg: None,
                    },
                    returns: None,
                    body: [
                        Return(
                            StmtReturn {
                                range: 137..192,
                                value: Some(
                                    ListComp(
                                        ExprListComp {
                                            range: 144..192,
                                            elt: DictComp(
                                                ExprDictComp {
                                                    range: 145..173,
                                                    key: Name(
                                                        ExprName {
                                                            range: 146..147,
                                                            id: Name("x"),
                                                            ctx: Load,
                                                        },
                                                    ),
                                                    value: NumberLiteral(
                                                        ExprNumberLiteral {
                                                            range: 149..150,
                                                            value: Int(
                                                                1,
                                                            ),
                                                        },
                                                    ),
                                                    generators: [
                                                        Comprehension {
                                                            range: 151..172,
                                                            target: Name(
                                                                ExprName {
                                                                    range: 161..162,
                                                                    id: Name("x"),
                                                                    ctx: Store,
                                                                },
                                                            ),
                                                            iter: Call(
                                                                ExprCall {
                                                                    range: 166..172,
                                                                    func: Name(
                                                                        ExprName {
                                                                            range: 166..169,
                                                                            id: Name("foo"),
                                                                            ctx: Load,
                                                                        },
                                                                    ),
                                                                    arguments: Arguments {
                                                                        range: 169..172,
                                                                        args: [
                                                                            Name(
                                                                                ExprName {
                                                                                    range: 170..171,
                                                                                    id: Name("n"),
                                                                                    ctx: Load,
                                                                                },
                                                                            ),
                                                                        ],
                                                                        keywords: [],
                                                                    },
                                                                },
                                                            ),
                                                            ifs: [],
                                                            is_async: true,
                                                        },
                                                    ],
                                                },
                                            ),
                                            generators: [
                                                Comprehension {
                                                    range: 174..191,
                                                    target: Name(
                                                        ExprName {
                                                            range: 178..179,
                                                            id: Name("n"),
                                                            ctx: Store,
                                                        },
                                                    ),
                                                    iter: Call(
                                                        ExprCall {
                                                            range: 183..191,
                                                            func: Name(
                                                                ExprName {
                                                                    range: 183..188,
                                                                    id: Name("range"),
                                                                    ctx: Load,
                                                                },
                                                            ),
                                                            arguments: Arguments {
                                                                range: 188..191,
                                                                args: [
                                                                    NumberLiteral(
                                                                        ExprNumberLiteral {
                                                                            range: 189..190,
                                                                            value: Int(
                                                                                3,
                                                                            ),
                                                                        },
                                                                    ),
                                                                ],
                                                                keywords: [],
                                                            },
                                                        },
                                                    ),
                                                    ifs: [],
                                                    is_async: false,
                                                },
                                            ],
                                        },
                                    ),
                                ),
                            },
                        ),
                    ],
                },
            ),
            FunctionDef(
                StmtFunctionDef {
                    range: 200..267,
                    is_async: true,
                    decorator_list: [],
                    name: Identifier {
                        id: Name("h"),
                        range: 210..211,
                    },
                    type_params: None,
                    parameters: Parameters {
                        range: 211..213,
                        posonlyargs: [],
                        args: [],
                        vararg: None,
                        kwonlyargs: [],
                        kwarg: None,
                    },
                    returns: None,
                    body: [
                        Return(
                            StmtReturn {
                                range: 215..267,
                                value: Some(
                                    ListComp(
                                        ExprListComp {
                                            range: 222..267,
                                            elt: SetComp(
                                                ExprSetComp {
                                                    range: 223..248,
                                                    elt: Name(
                                                        ExprName {
                                                            range: 224..225,
                                                            id: Name("x"),
                                                            ctx: Load,
                                                        },
                                                    ),
                                                    generators: [
                                                        Comprehension {
                                                            range: 226..247,
                                                            target: Name(
                                                                ExprName {
                                                                    range: 236..237,
                                                                    id: Name("x"),
                                                                    ctx: Store,
                                                                },
                                                            ),
                                                            iter: Call(
                                                                ExprCall {
                                                                    range: 241..247,
                                                                    func: Name(
                                                                        ExprName {
                                                                            range: 241..244,
                                                                            id: Name("foo"),
                                                                            ctx: Load,
                                                                        },
                                                                    ),
                                                                    arguments: Arguments {
                                                                        range: 244..247,
                                                                        args: [
                                                                            Name(
                                                                                ExprName {
                                                                                    range: 245..246,
                                                                                    id: Name("n"),
                                                                                    ctx: Load,
                                                                                },
                                                                            ),
                                                                        ],
                                                                        keywords: [],
                                                                    },
                                                                },
                                                            ),
                                                            ifs: [],
                                                            is_async: true,
                                                        },
                                                    ],
                                                },
                                            ),
                                            generators: [
                                                Comprehension {
                                                    range: 249..266,
                                                    target: Name(
                                                        ExprName {
                                                            range: 253..254,
                                                            id: Name("n"),
                                                            ctx: Store,
                                                        },
                                                    ),
                                                    iter: Call(
                                                        ExprCall {
                                                            range: 258..266,
                                                            func: Name(
                                                                ExprName {
                                                                    range: 258..263,
                                                                    id: Name("range"),
                                                                    ctx: Load,
                                                                },
                                                            ),
                                                            arguments: Arguments {
                                                                range: 263..266,
                                                                args: [
                                                                    NumberLiteral(
                                                                        ExprNumberLiteral {
                                                                            range: 264..265,
                                                                            value: Int(
                                                                                3,
                                                                            ),
                                                                        },
                                                                    ),
                                                                ],
                                                                keywords: [],
                                                            },
                                                        },
                                                    ),
                                                    ifs: [],
                                                    is_async: false,
                                                },
                                            ],
                                        },
                                    ),
                                ),
                            },
                        ),
                    ],
                },
            ),
        ],
    },
)
```
