Skip to content

Commit 37412d8

Browse files
committed
Fix range field order
1 parent 6a85b99 commit 37412d8

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ast/asdl_rs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,10 @@ def visitProduct(self, product, type, depth):
471471
self.emit_attrs(depth)
472472

473473
self.emit(f"pub struct {product_name}<R = TextRange> {{", depth)
474+
self.emit_range(product.attributes, depth + 1)
474475
for f in product.fields:
475476
self.visit(f, type_info, "pub ", depth + 1)
476477
assert bool(product.attributes) == type_info.no_cfg(self.type_info)
477-
self.emit_range(product.attributes, depth + 1)
478478
self.emit("}", depth)
479479

480480
field_names = [f'"{f.name}"' for f in product.fields]

ast/src/gen/generic.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,11 +2047,11 @@ impl Node for Cmpop {
20472047

20482048
#[derive(Clone, Debug, PartialEq)]
20492049
pub struct Comprehension<R = TextRange> {
2050+
pub range: OptionalRange<R>,
20502051
pub target: Expr<R>,
20512052
pub iter: Expr<R>,
20522053
pub ifs: Vec<Expr<R>>,
20532054
pub is_async: bool,
2054-
pub range: OptionalRange<R>,
20552055
}
20562056

20572057
impl<R> Node for Comprehension<R> {
@@ -2089,14 +2089,14 @@ impl<R> Node for Excepthandler<R> {
20892089

20902090
#[derive(Clone, Debug, PartialEq)]
20912091
pub struct Arguments<R = TextRange> {
2092+
pub range: OptionalRange<R>,
20922093
pub posonlyargs: Vec<Arg<R>>,
20932094
pub args: Vec<Arg<R>>,
20942095
pub vararg: Option<Box<Arg<R>>>,
20952096
pub kwonlyargs: Vec<Arg<R>>,
20962097
pub kw_defaults: Vec<Expr<R>>,
20972098
pub kwarg: Option<Box<Arg<R>>>,
20982099
pub defaults: Vec<Expr<R>>,
2099-
pub range: OptionalRange<R>,
21002100
}
21012101

21022102
impl<R> Node for Arguments<R> {
@@ -2114,10 +2114,10 @@ impl<R> Node for Arguments<R> {
21142114

21152115
#[derive(Clone, Debug, PartialEq)]
21162116
pub struct Arg<R = TextRange> {
2117+
pub range: R,
21172118
pub arg: Identifier,
21182119
pub annotation: Option<Box<Expr<R>>>,
21192120
pub type_comment: Option<String>,
2120-
pub range: R,
21212121
}
21222122

21232123
impl<R> Node for Arg<R> {
@@ -2127,9 +2127,9 @@ impl<R> Node for Arg<R> {
21272127

21282128
#[derive(Clone, Debug, PartialEq)]
21292129
pub struct Keyword<R = TextRange> {
2130+
pub range: R,
21302131
pub arg: Option<Identifier>,
21312132
pub value: Expr<R>,
2132-
pub range: R,
21332133
}
21342134

21352135
impl<R> Node for Keyword<R> {
@@ -2139,9 +2139,9 @@ impl<R> Node for Keyword<R> {
21392139

21402140
#[derive(Clone, Debug, PartialEq)]
21412141
pub struct Alias<R = TextRange> {
2142+
pub range: R,
21422143
pub name: Identifier,
21432144
pub asname: Option<Identifier>,
2144-
pub range: R,
21452145
}
21462146

21472147
impl<R> Node for Alias<R> {
@@ -2151,9 +2151,9 @@ impl<R> Node for Alias<R> {
21512151

21522152
#[derive(Clone, Debug, PartialEq)]
21532153
pub struct Withitem<R = TextRange> {
2154+
pub range: OptionalRange<R>,
21542155
pub context_expr: Expr<R>,
21552156
pub optional_vars: Option<Box<Expr<R>>>,
2156-
pub range: OptionalRange<R>,
21572157
}
21582158

21592159
impl<R> Node for Withitem<R> {
@@ -2163,10 +2163,10 @@ impl<R> Node for Withitem<R> {
21632163

21642164
#[derive(Clone, Debug, PartialEq)]
21652165
pub struct MatchCase<R = TextRange> {
2166+
pub range: OptionalRange<R>,
21662167
pub pattern: Pattern<R>,
21672168
pub guard: Option<Box<Expr<R>>>,
21682169
pub body: Vec<Stmt<R>>,
2169-
pub range: OptionalRange<R>,
21702170
}
21712171

21722172
impl<R> Node for MatchCase<R> {

0 commit comments

Comments
 (0)