ruff/crates/ruff_python_parser/tests/snapshots/valid_syntax@nonlocal_stmt.py.snap
Ibraheem Ahmed 7abc41727b
[ty] Shrink size of AstNodeRef (#20028)
## Summary

Removes the `module_ptr` field from `AstNodeRef` in release mode, and
change `NodeIndex` to a `NonZeroU32` to reduce the size of
`Option<AstNodeRef<_>>` fields.

I believe CI runs in debug mode, so this won't show up in the memory
report, but this reduces memory by ~2% in release mode.
2025-08-22 17:03:22 -04:00

78 lines
2.8 KiB
Text

---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/ok/nonlocal_stmt.py
---
## AST
```
Module(
ModModule {
node_index: NodeIndex(None),
range: 0..45,
body: [
FunctionDef(
StmtFunctionDef {
node_index: NodeIndex(None),
range: 0..44,
is_async: false,
decorator_list: [],
name: Identifier {
id: Name("_"),
range: 4..5,
node_index: NodeIndex(None),
},
type_params: None,
parameters: Parameters {
range: 5..7,
node_index: NodeIndex(None),
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Nonlocal(
StmtNonlocal {
node_index: NodeIndex(None),
range: 13..23,
names: [
Identifier {
id: Name("x"),
range: 22..23,
node_index: NodeIndex(None),
},
],
},
),
Nonlocal(
StmtNonlocal {
node_index: NodeIndex(None),
range: 28..44,
names: [
Identifier {
id: Name("x"),
range: 37..38,
node_index: NodeIndex(None),
},
Identifier {
id: Name("y"),
range: 40..41,
node_index: NodeIndex(None),
},
Identifier {
id: Name("z"),
range: 43..44,
node_index: NodeIndex(None),
},
],
},
),
],
},
),
],
},
)
```