mirror of
https://github.com/astral-sh/ruff
synced 2026-01-07 22:54:28 -05:00
Fix decorator ranges
Incorrectly merged LALRPOP file
This commit is contained in:
@@ -966,7 +966,7 @@ WithItem<Goal>: ast::WithItem = {
|
||||
};
|
||||
|
||||
FuncDef: ast::Stmt = {
|
||||
<decorator_list:Decorator*> <location:@L> <is_async:"async"?> "def" <name:Identifier> <type_params:TypeParamList?> <args:Parameters> <r:("->" <Test<"all">>)?> ":" <body:Suite> => {
|
||||
<location:@L> <decorator_list:Decorator*> <is_async:"async"?> "def" <name:Identifier> <type_params:TypeParamList?> <args:Parameters> <r:("->" <Test<"all">>)?> ":" <body:Suite> => {
|
||||
let args = Box::new(args);
|
||||
let returns = r.map(|x| Box::new(x));
|
||||
let end_location = body.last().unwrap().end();
|
||||
@@ -1152,7 +1152,7 @@ KwargParameter<ArgType>: Option<Box<ast::Arg>> = {
|
||||
};
|
||||
|
||||
ClassDef: ast::Stmt = {
|
||||
<decorator_list:Decorator*> <location:@L> "class" <name:Identifier> <type_params:TypeParamList?> <a:("(" ArgumentList ")")?> ":" <body:Suite> => {
|
||||
<location:@L> <decorator_list:Decorator*> "class" <name:Identifier> <type_params:TypeParamList?> <a:("(" ArgumentList ")")?> ":" <body:Suite> => {
|
||||
let (bases, keywords) = match a {
|
||||
Some((_, arg, _)) => (arg.args, arg.keywords),
|
||||
None => (vec![], vec![]),
|
||||
|
||||
46
parser/src/python.rs
generated
46
parser/src/python.rs
generated
@@ -1,5 +1,5 @@
|
||||
// auto-generated: "lalrpop 0.20.0"
|
||||
// sha3: fb75a0c8eb018485c7dee0a97c87552ada8f64b81475cc02e5036865d3fa45c9
|
||||
// sha3: 9e5724a38f8390a2c0d8ec2e482038cf75c50fb170533d93f85cf122a887d14a
|
||||
use crate::{
|
||||
ast::{self as ast, Ranged, bigint::BigInt},
|
||||
lexer::{LexicalError, LexicalErrorType},
|
||||
@@ -32192,8 +32192,8 @@ fn __action157<
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn __action158<
|
||||
>(
|
||||
(_, decorator_list, _): (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
(_, location, _): (TextSize, TextSize, TextSize),
|
||||
(_, decorator_list, _): (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
(_, is_async, _): (TextSize, core::option::Option<token::Tok>, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
(_, name, _): (TextSize, ast::Identifier, TextSize),
|
||||
@@ -32353,8 +32353,8 @@ fn __action166<
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn __action167<
|
||||
>(
|
||||
(_, decorator_list, _): (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
(_, location, _): (TextSize, TextSize, TextSize),
|
||||
(_, decorator_list, _): (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
(_, _, _): (TextSize, token::Tok, TextSize),
|
||||
(_, name, _): (TextSize, ast::Identifier, TextSize),
|
||||
(_, type_params, _): (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
@@ -39208,8 +39208,8 @@ fn __action651<
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn __action652<
|
||||
>(
|
||||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, TextSize, TextSize),
|
||||
__0: (TextSize, TextSize, TextSize),
|
||||
__1: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, token::Tok, TextSize),
|
||||
__4: (TextSize, ast::Identifier, TextSize),
|
||||
@@ -39243,8 +39243,8 @@ fn __action652<
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn __action653<
|
||||
>(
|
||||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, TextSize, TextSize),
|
||||
__0: (TextSize, TextSize, TextSize),
|
||||
__1: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
@@ -39415,8 +39415,8 @@ fn __action658<
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn __action659<
|
||||
>(
|
||||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, TextSize, TextSize),
|
||||
__0: (TextSize, TextSize, TextSize),
|
||||
__1: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
@@ -39450,8 +39450,8 @@ fn __action659<
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn __action660<
|
||||
>(
|
||||
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__1: (TextSize, TextSize, TextSize),
|
||||
__0: (TextSize, TextSize, TextSize),
|
||||
__1: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
|
||||
__2: (TextSize, token::Tok, TextSize),
|
||||
__3: (TextSize, ast::Identifier, TextSize),
|
||||
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
|
||||
@@ -41722,16 +41722,16 @@ fn __action753<
|
||||
__8: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
{
|
||||
let __start0 = __0.2;
|
||||
let __end0 = __1.0;
|
||||
let __start0 = __0.0;
|
||||
let __end0 = __0.0;
|
||||
let __temp0 = __action384(
|
||||
&__start0,
|
||||
&__end0,
|
||||
);
|
||||
let __temp0 = (__start0, __temp0, __end0);
|
||||
__action659(
|
||||
__0,
|
||||
__temp0,
|
||||
__0,
|
||||
__1,
|
||||
__2,
|
||||
__3,
|
||||
@@ -41754,16 +41754,16 @@ fn __action754<
|
||||
__5: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
{
|
||||
let __start0 = __0.2;
|
||||
let __end0 = __1.0;
|
||||
let __start0 = __0.0;
|
||||
let __end0 = __0.0;
|
||||
let __temp0 = __action384(
|
||||
&__start0,
|
||||
&__end0,
|
||||
);
|
||||
let __temp0 = (__start0, __temp0, __end0);
|
||||
__action660(
|
||||
__0,
|
||||
__temp0,
|
||||
__0,
|
||||
__1,
|
||||
__2,
|
||||
__3,
|
||||
@@ -42818,16 +42818,16 @@ fn __action795<
|
||||
__8: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
{
|
||||
let __start0 = __0.2;
|
||||
let __end0 = __1.0;
|
||||
let __start0 = __0.0;
|
||||
let __end0 = __0.0;
|
||||
let __temp0 = __action384(
|
||||
&__start0,
|
||||
&__end0,
|
||||
);
|
||||
let __temp0 = (__start0, __temp0, __end0);
|
||||
__action652(
|
||||
__0,
|
||||
__temp0,
|
||||
__0,
|
||||
__1,
|
||||
__2,
|
||||
__3,
|
||||
@@ -42852,16 +42852,16 @@ fn __action796<
|
||||
__7: (TextSize, ast::Suite, TextSize),
|
||||
) -> ast::Stmt
|
||||
{
|
||||
let __start0 = __0.2;
|
||||
let __end0 = __1.0;
|
||||
let __start0 = __0.0;
|
||||
let __end0 = __0.0;
|
||||
let __temp0 = __action384(
|
||||
&__start0,
|
||||
&__end0,
|
||||
);
|
||||
let __temp0 = (__start0, __temp0, __end0);
|
||||
__action653(
|
||||
__0,
|
||||
__temp0,
|
||||
__0,
|
||||
__1,
|
||||
__2,
|
||||
__3,
|
||||
|
||||
@@ -5,7 +5,7 @@ expression: parse_ast
|
||||
[
|
||||
FunctionDef(
|
||||
StmtFunctionDef {
|
||||
range: 14..34,
|
||||
range: 0..34,
|
||||
name: Identifier {
|
||||
id: "test",
|
||||
range: 18..22,
|
||||
@@ -44,7 +44,7 @@ expression: parse_ast
|
||||
),
|
||||
ClassDef(
|
||||
StmtClassDef {
|
||||
range: 53..73,
|
||||
range: 36..73,
|
||||
name: Identifier {
|
||||
id: "Abcd",
|
||||
range: 59..63,
|
||||
|
||||
Reference in New Issue
Block a user