Skip to content

Commit 385c522

Browse files
committed
Update auto-generated ast code
1 parent 33092d8 commit 385c522

File tree

3 files changed

+56
-12
lines changed

3 files changed

+56
-12
lines changed

ast/src/gen/fold.rs

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2896,13 +2896,24 @@ pub fn fold_type_param_type_var<U, F: Fold<U> + ?Sized>(
28962896
#[allow(unused)] folder: &mut F,
28972897
node: TypeParamTypeVar<U>,
28982898
) -> Result<TypeParamTypeVar<F::TargetU>, F::Error> {
2899-
let TypeParamTypeVar { name, bound, range } = node;
2899+
let TypeParamTypeVar {
2900+
name,
2901+
bound,
2902+
default_value,
2903+
range,
2904+
} = node;
29002905
let context = folder.will_map_user(&range);
29012906

29022907
let name = Foldable::fold(name, folder)?;
29032908
let bound = Foldable::fold(bound, folder)?;
2909+
let default_value = Foldable::fold(default_value, folder)?;
29042910
let range = folder.map_user(range, context)?;
2905-
Ok(TypeParamTypeVar { name, bound, range })
2911+
Ok(TypeParamTypeVar {
2912+
name,
2913+
bound,
2914+
default_value,
2915+
range,
2916+
})
29062917
}
29072918
impl<T, U> Foldable<T, U> for TypeParamParamSpec<T> {
29082919
type Mapped = TypeParamParamSpec<U>;
@@ -2917,12 +2928,21 @@ pub fn fold_type_param_param_spec<U, F: Fold<U> + ?Sized>(
29172928
#[allow(unused)] folder: &mut F,
29182929
node: TypeParamParamSpec<U>,
29192930
) -> Result<TypeParamParamSpec<F::TargetU>, F::Error> {
2920-
let TypeParamParamSpec { name, range } = node;
2931+
let TypeParamParamSpec {
2932+
name,
2933+
default_value,
2934+
range,
2935+
} = node;
29212936
let context = folder.will_map_user(&range);
29222937

29232938
let name = Foldable::fold(name, folder)?;
2939+
let default_value = Foldable::fold(default_value, folder)?;
29242940
let range = folder.map_user(range, context)?;
2925-
Ok(TypeParamParamSpec { name, range })
2941+
Ok(TypeParamParamSpec {
2942+
name,
2943+
default_value,
2944+
range,
2945+
})
29262946
}
29272947
impl<T, U> Foldable<T, U> for TypeParamTypeVarTuple<T> {
29282948
type Mapped = TypeParamTypeVarTuple<U>;
@@ -2937,12 +2957,21 @@ pub fn fold_type_param_type_var_tuple<U, F: Fold<U> + ?Sized>(
29372957
#[allow(unused)] folder: &mut F,
29382958
node: TypeParamTypeVarTuple<U>,
29392959
) -> Result<TypeParamTypeVarTuple<F::TargetU>, F::Error> {
2940-
let TypeParamTypeVarTuple { name, range } = node;
2960+
let TypeParamTypeVarTuple {
2961+
name,
2962+
default_value,
2963+
range,
2964+
} = node;
29412965
let context = folder.will_map_user(&range);
29422966

29432967
let name = Foldable::fold(name, folder)?;
2968+
let default_value = Foldable::fold(default_value, folder)?;
29442969
let range = folder.map_user(range, context)?;
2945-
Ok(TypeParamTypeVarTuple { name, range })
2970+
Ok(TypeParamTypeVarTuple {
2971+
name,
2972+
default_value,
2973+
range,
2974+
})
29462975
}
29472976
impl<T, U> Foldable<T, U> for ArgWithDefault<T> {
29482977
type Mapped = ArgWithDefault<U>;

ast/src/gen/generic.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// File automatically generated by ast/asdl_rs.py.
22

33
use crate::text_size::TextRange;
4-
#[derive(Clone, Debug, PartialEq, is_macro::Is)]
4+
#[derive(Clone, Debug, PartialEq)]
5+
#[derive(is_macro::Is)]
56
pub enum Ast<R = TextRange> {
67
#[is(name = "module")]
78
Mod(Mod<R>),
@@ -3131,11 +3132,12 @@ pub struct TypeParamTypeVar<R = TextRange> {
31313132
pub range: R,
31323133
pub name: Identifier,
31333134
pub bound: Option<Box<Expr<R>>>,
3135+
pub default_value: Option<Box<Expr<R>>>,
31343136
}
31353137

31363138
impl<R> Node for TypeParamTypeVar<R> {
31373139
const NAME: &'static str = "TypeVar";
3138-
const FIELD_NAMES: &'static [&'static str] = &["name", "bound"];
3140+
const FIELD_NAMES: &'static [&'static str] = &["name", "bound", "default_value"];
31393141
}
31403142
impl<R> From<TypeParamTypeVar<R>> for TypeParam<R> {
31413143
fn from(payload: TypeParamTypeVar<R>) -> Self {
@@ -3153,11 +3155,12 @@ impl<R> From<TypeParamTypeVar<R>> for Ast<R> {
31533155
pub struct TypeParamParamSpec<R = TextRange> {
31543156
pub range: R,
31553157
pub name: Identifier,
3158+
pub default_value: Option<Box<Expr<R>>>,
31563159
}
31573160

31583161
impl<R> Node for TypeParamParamSpec<R> {
31593162
const NAME: &'static str = "ParamSpec";
3160-
const FIELD_NAMES: &'static [&'static str] = &["name"];
3163+
const FIELD_NAMES: &'static [&'static str] = &["name", "default_value"];
31613164
}
31623165
impl<R> From<TypeParamParamSpec<R>> for TypeParam<R> {
31633166
fn from(payload: TypeParamParamSpec<R>) -> Self {
@@ -3175,11 +3178,12 @@ impl<R> From<TypeParamParamSpec<R>> for Ast<R> {
31753178
pub struct TypeParamTypeVarTuple<R = TextRange> {
31763179
pub range: R,
31773180
pub name: Identifier,
3181+
pub default_value: Option<Box<Expr<R>>>,
31783182
}
31793183

31803184
impl<R> Node for TypeParamTypeVarTuple<R> {
31813185
const NAME: &'static str = "TypeVarTuple";
3182-
const FIELD_NAMES: &'static [&'static str] = &["name"];
3186+
const FIELD_NAMES: &'static [&'static str] = &["name", "default_value"];
31833187
}
31843188
impl<R> From<TypeParamTypeVarTuple<R>> for TypeParam<R> {
31853189
fn from(payload: TypeParamTypeVarTuple<R>) -> Self {

ast/src/gen/visitor.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,13 +853,24 @@ pub trait Visitor<R = crate::text_size::TextRange> {
853853
if let Some(value) = node.bound {
854854
self.visit_expr(*value);
855855
}
856+
if let Some(value) = node.default_value {
857+
self.visit_expr(*value);
858+
}
856859
}
857860
fn visit_type_param_param_spec(&mut self, node: TypeParamParamSpec<R>) {
858861
self.generic_visit_type_param_param_spec(node)
859862
}
860-
fn generic_visit_type_param_param_spec(&mut self, node: TypeParamParamSpec<R>) {}
863+
fn generic_visit_type_param_param_spec(&mut self, node: TypeParamParamSpec<R>) {
864+
if let Some(value) = node.default_value {
865+
self.visit_expr(*value);
866+
}
867+
}
861868
fn visit_type_param_type_var_tuple(&mut self, node: TypeParamTypeVarTuple<R>) {
862869
self.generic_visit_type_param_type_var_tuple(node)
863870
}
864-
fn generic_visit_type_param_type_var_tuple(&mut self, node: TypeParamTypeVarTuple<R>) {}
871+
fn generic_visit_type_param_type_var_tuple(&mut self, node: TypeParamTypeVarTuple<R>) {
872+
if let Some(value) = node.default_value {
873+
self.visit_expr(*value);
874+
}
875+
}
865876
}

0 commit comments

Comments
 (0)