gh-104799: Move location of type_params AST fields (#104828)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Jelle Zijlstra 2023-05-26 05:54:37 -07:00 committed by GitHub
parent 6e1eccdcce
commit ba73473f4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 297 additions and 266 deletions

View file

@ -752,22 +752,25 @@ _PyPegen_function_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty f
assert(function_def != NULL);
if (function_def->kind == AsyncFunctionDef_kind) {
return _PyAST_AsyncFunctionDef(
function_def->v.FunctionDef.name, function_def->v.FunctionDef.type_params,
function_def->v.FunctionDef.args,
function_def->v.FunctionDef.body, decorators, function_def->v.FunctionDef.returns,
function_def->v.FunctionDef.type_comment, function_def->lineno,
function_def->col_offset, function_def->end_lineno, function_def->end_col_offset,
p->arena);
function_def->v.AsyncFunctionDef.name,
function_def->v.AsyncFunctionDef.args,
function_def->v.AsyncFunctionDef.body, decorators,
function_def->v.AsyncFunctionDef.returns,
function_def->v.AsyncFunctionDef.type_comment,
function_def->v.AsyncFunctionDef.type_params,
function_def->lineno, function_def->col_offset,
function_def->end_lineno, function_def->end_col_offset, p->arena);
}
return _PyAST_FunctionDef(
function_def->v.FunctionDef.name, function_def->v.FunctionDef.type_params,
function_def->v.FunctionDef.name,
function_def->v.FunctionDef.args,
function_def->v.FunctionDef.body, decorators,
function_def->v.FunctionDef.returns,
function_def->v.FunctionDef.type_comment, function_def->lineno,
function_def->col_offset, function_def->end_lineno,
function_def->end_col_offset, p->arena);
function_def->v.FunctionDef.type_comment,
function_def->v.FunctionDef.type_params,
function_def->lineno, function_def->col_offset,
function_def->end_lineno, function_def->end_col_offset, p->arena);
}
/* Construct a ClassDef equivalent to class_def, but with decorators */
@ -776,9 +779,10 @@ _PyPegen_class_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty clas
{
assert(class_def != NULL);
return _PyAST_ClassDef(
class_def->v.ClassDef.name, class_def->v.ClassDef.type_params,
class_def->v.ClassDef.name,
class_def->v.ClassDef.bases, class_def->v.ClassDef.keywords,
class_def->v.ClassDef.body, decorators,
class_def->v.ClassDef.type_params,
class_def->lineno, class_def->col_offset, class_def->end_lineno,
class_def->end_col_offset, p->arena);
}