Skip to content

Commit 25cc1da

Browse files
committed
Include decorators in Class and FunctionDef range
1 parent 33a3c40 commit 25cc1da

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

parser/src/python.lalrpop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ WithItem<Goal>: ast::Withitem = {
964964
};
965965

966966
FuncDef: ast::Stmt = {
967-
<decorator_list:Decorator*> <location:@L> <is_async:"async"?> "def" <name:Identifier> <args:Parameters> <r:("->" <Test<"all">>)?> ":" <body:Suite> => {
967+
<location:@L> <decorator_list:Decorator*> <is_async:"async"?> "def" <name:Identifier> <args:Parameters> <r:("->" <Test<"all">>)?> ":" <body:Suite> => {
968968
let args = Box::new(args);
969969
let returns = r.map(|x| Box::new(x));
970970
let end_location = body.last().unwrap().end();
@@ -1135,7 +1135,7 @@ KwargParameter<ArgType>: Option<Box<ast::Arg>> = {
11351135
};
11361136

11371137
ClassDef: ast::Stmt = {
1138-
<decorator_list:Decorator*> <location:@L> "class" <name:Identifier> <a:("(" ArgumentList ")")?> ":" <body:Suite> => {
1138+
<location:@L> <decorator_list:Decorator*> "class" <name:Identifier> <a:("(" ArgumentList ")")?> ":" <body:Suite> => {
11391139
let (bases, keywords) = match a {
11401140
Some((_, arg, _)) => (arg.args, arg.keywords),
11411141
None => (vec![], vec![]),

parser/src/python.rs

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)