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:
Charlie Marsh 2023-08-02 12:47:06 -04:00 committed by GitHub
parent 8c40886f87
commit 8a0f844642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 87 additions and 102 deletions

View file

@ -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()
},
)