Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Commit ac1f6bd

Browse files
committed
Include decorators in Class and FunctionDef range
1 parent 69d27d9 commit ac1f6bd

File tree

2 files changed

+112
-12
lines changed

2 files changed

+112
-12
lines changed

parser/src/python.lalrpop

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

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

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

parser/src/python.rs

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

0 commit comments

Comments
 (0)