mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-13 16:15:07 +00:00
Box type params and arguments fields on the class definition node (#6275)
## Summary This PR boxes the `TypeParams` and `Arguments` fields on the class definition node. These fields are optional and often emitted, and given that class definition is our largest enum variant, we pay the cost of including them for every statement in the AST. Boxing these types reduces the statement size by 40 bytes, which seems like a good tradeoff given how infrequently these are accessed. ## Test Plan Need to benchmark, but no behavior changes.
This commit is contained in:
parent
8c40886f87
commit
8a0f844642
23 changed files with 87 additions and 102 deletions
|
@ -1,5 +1,5 @@
|
|||
// auto-generated: "lalrpop 0.20.0"
|
||||
// sha3: aadf067e37a9f39d450f1403b759a9659c60e697758ddd2b8c2b5fa2d0d73672
|
||||
// sha3: f99d8cb29227bfbe1fa07719f655304a9a93fd4715726687ef40c091adbdbad5
|
||||
use num_bigint::BigInt;
|
||||
use ruff_text_size::TextSize;
|
||||
use ruff_python_ast::{self as ast, Ranged, MagicKind};
|
||||
|
@ -33583,10 +33583,10 @@ fn __action170<
|
|||
ast::Stmt::ClassDef(
|
||||
ast::StmtClassDef {
|
||||
name,
|
||||
arguments,
|
||||
arguments: arguments.map(Box::new),
|
||||
body,
|
||||
decorator_list,
|
||||
type_params,
|
||||
type_params: type_params.map(Box::new),
|
||||
range: (location..end_location).into()
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue