Add stub type_params handling for class and function definitions

This commit is contained in:
Zanie 2023-07-10 14:00:34 -05:00
parent df2b5dfed0
commit 7b0aeeec4b
13 changed files with 29 additions and 1 deletions

5
parser/src/python.rs generated
View file

@ -30685,6 +30685,7 @@ fn __action157(
let returns = r.map(|x| Box::new(x));
let end_location = body.last().unwrap().end();
let type_comment = None;
let type_params = Vec::new();
if is_async.is_some() {
ast::StmtAsyncFunctionDef {
name,
@ -30693,6 +30694,7 @@ fn __action157(
decorator_list,
returns,
type_comment,
type_params,
range: (location..end_location).into(),
}
.into()
@ -30704,6 +30706,7 @@ fn __action157(
decorator_list,
returns,
type_comment,
type_params,
range: (location..end_location).into(),
}
.into()
@ -30842,12 +30845,14 @@ fn __action164(
None => (vec![], vec![]),
};
let end_location = body.last().unwrap().end();
let type_params = Vec::new();
ast::Stmt::ClassDef(ast::StmtClassDef {
name,
bases,
keywords,
body,
decorator_list,
type_params,
range: (location..end_location).into(),
})
}

View file

@ -65,6 +65,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -85,6 +85,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -28,6 +28,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -102,6 +102,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -122,6 +122,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -131,6 +131,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -140,6 +140,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -65,6 +65,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -85,6 +85,7 @@ Ok(
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],

View file

@ -1,6 +1,6 @@
---
source: parser/src/parser.rs
expression: "parse_program(source, \"<test>\").unwrap()"
expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
---
[
ClassDef(
@ -68,6 +68,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
FunctionDef(
@ -129,10 +130,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
decorator_list: [],
returns: None,
type_comment: None,
type_params: [],
},
),
],
decorator_list: [],
type_params: [],
},
),
]

View file

@ -90,6 +90,7 @@ expression: parse_ast
),
),
type_comment: None,
type_params: [],
},
),
]