Skip to content

Commit eaaf699

Browse files
authored
pythongh-120733: rename internal compiler functions according to naming convention (python#120734)
1 parent 0f3e364 commit eaaf699

File tree

1 file changed

+23
-30
lines changed

1 file changed

+23
-30
lines changed

Python/compile.c

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,7 +1763,7 @@ compiler_apply_decorators(struct compiler *c, asdl_expr_seq* decos)
17631763
}
17641764

17651765
static int
1766-
compiler_visit_kwonlydefaults(struct compiler *c, location loc,
1766+
compiler_kwonlydefaults(struct compiler *c, location loc,
17671767
asdl_arg_seq *kwonlyargs, asdl_expr_seq *kw_defaults)
17681768
{
17691769
/* Push a dict of keyword-only default values.
@@ -1828,7 +1828,7 @@ compiler_visit_annexpr(struct compiler *c, expr_ty annotation)
18281828
}
18291829

18301830
static int
1831-
compiler_visit_argannotation(struct compiler *c, identifier id,
1831+
compiler_argannotation(struct compiler *c, identifier id,
18321832
expr_ty annotation, Py_ssize_t *annotations_len, location loc)
18331833
{
18341834
if (!annotation) {
@@ -1862,14 +1862,14 @@ compiler_visit_argannotation(struct compiler *c, identifier id,
18621862
}
18631863

18641864
static int
1865-
compiler_visit_argannotations(struct compiler *c, asdl_arg_seq* args,
1866-
Py_ssize_t *annotations_len, location loc)
1865+
compiler_argannotations(struct compiler *c, asdl_arg_seq* args,
1866+
Py_ssize_t *annotations_len, location loc)
18671867
{
18681868
int i;
18691869
for (i = 0; i < asdl_seq_LEN(args); i++) {
18701870
arg_ty arg = (arg_ty)asdl_seq_GET(args, i);
18711871
RETURN_IF_ERROR(
1872-
compiler_visit_argannotation(
1872+
compiler_argannotation(
18731873
c,
18741874
arg->arg,
18751875
arg->annotation,
@@ -1880,39 +1880,39 @@ compiler_visit_argannotations(struct compiler *c, asdl_arg_seq* args,
18801880
}
18811881

18821882
static int
1883-
compiler_visit_annotations_in_scope(struct compiler *c, location loc,
1884-
arguments_ty args, expr_ty returns,
1885-
Py_ssize_t *annotations_len)
1883+
compiler_annotations_in_scope(struct compiler *c, location loc,
1884+
arguments_ty args, expr_ty returns,
1885+
Py_ssize_t *annotations_len)
18861886
{
18871887
RETURN_IF_ERROR(
1888-
compiler_visit_argannotations(c, args->args, annotations_len, loc));
1888+
compiler_argannotations(c, args->args, annotations_len, loc));
18891889

18901890
RETURN_IF_ERROR(
1891-
compiler_visit_argannotations(c, args->posonlyargs, annotations_len, loc));
1891+
compiler_argannotations(c, args->posonlyargs, annotations_len, loc));
18921892

18931893
if (args->vararg && args->vararg->annotation) {
18941894
RETURN_IF_ERROR(
1895-
compiler_visit_argannotation(c, args->vararg->arg,
1895+
compiler_argannotation(c, args->vararg->arg,
18961896
args->vararg->annotation, annotations_len, loc));
18971897
}
18981898

18991899
RETURN_IF_ERROR(
1900-
compiler_visit_argannotations(c, args->kwonlyargs, annotations_len, loc));
1900+
compiler_argannotations(c, args->kwonlyargs, annotations_len, loc));
19011901

19021902
if (args->kwarg && args->kwarg->annotation) {
19031903
RETURN_IF_ERROR(
1904-
compiler_visit_argannotation(c, args->kwarg->arg,
1904+
compiler_argannotation(c, args->kwarg->arg,
19051905
args->kwarg->annotation, annotations_len, loc));
19061906
}
19071907

19081908
RETURN_IF_ERROR(
1909-
compiler_visit_argannotation(c, &_Py_ID(return), returns, annotations_len, loc));
1909+
compiler_argannotation(c, &_Py_ID(return), returns, annotations_len, loc));
19101910

19111911
return 0;
19121912
}
19131913

19141914
static int
1915-
compiler_visit_annotations(struct compiler *c, location loc,
1915+
compiler_annotations(struct compiler *c, location loc,
19161916
arguments_ty args, expr_ty returns)
19171917
{
19181918
/* Push arg annotation names and values.
@@ -1938,7 +1938,7 @@ compiler_visit_annotations(struct compiler *c, location loc,
19381938
}
19391939
Py_DECREF(ste);
19401940

1941-
if (compiler_visit_annotations_in_scope(c, loc, args, returns, &annotations_len) < 0) {
1941+
if (compiler_annotations_in_scope(c, loc, args, returns, &annotations_len) < 0) {
19421942
if (annotations_used) {
19431943
compiler_exit_scope(c);
19441944
}
@@ -1956,7 +1956,7 @@ compiler_visit_annotations(struct compiler *c, location loc,
19561956
}
19571957

19581958
static int
1959-
compiler_visit_defaults(struct compiler *c, arguments_ty args,
1959+
compiler_defaults(struct compiler *c, arguments_ty args,
19601960
location loc)
19611961
{
19621962
VISIT_SEQ(c, expr, args->defaults);
@@ -1970,13 +1970,13 @@ compiler_default_arguments(struct compiler *c, location loc,
19701970
{
19711971
Py_ssize_t funcflags = 0;
19721972
if (args->defaults && asdl_seq_LEN(args->defaults) > 0) {
1973-
RETURN_IF_ERROR(compiler_visit_defaults(c, args, loc));
1973+
RETURN_IF_ERROR(compiler_defaults(c, args, loc));
19741974
funcflags |= MAKE_FUNCTION_DEFAULTS;
19751975
}
19761976
if (args->kwonlyargs) {
1977-
int res = compiler_visit_kwonlydefaults(c, loc,
1978-
args->kwonlyargs,
1979-
args->kw_defaults);
1977+
int res = compiler_kwonlydefaults(c, loc,
1978+
args->kwonlyargs,
1979+
args->kw_defaults);
19801980
RETURN_IF_ERROR(res);
19811981
if (res > 0) {
19821982
funcflags |= MAKE_FUNCTION_KWDEFAULTS;
@@ -2342,7 +2342,7 @@ compiler_function(struct compiler *c, stmt_ty s, int is_async)
23422342
}
23432343
}
23442344

2345-
int annotations_flag = compiler_visit_annotations(c, loc, args, returns);
2345+
int annotations_flag = compiler_annotations(c, loc, args, returns);
23462346
if (annotations_flag < 0) {
23472347
if (is_generic) {
23482348
compiler_exit_scope(c);
@@ -6111,7 +6111,7 @@ compiler_with(struct compiler *c, stmt_ty s, int pos)
61116111
}
61126112

61136113
static int
6114-
compiler_visit_expr1(struct compiler *c, expr_ty e)
6114+
compiler_visit_expr(struct compiler *c, expr_ty e)
61156115
{
61166116
location loc = LOC(e);
61176117
switch (e->kind) {
@@ -6280,13 +6280,6 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
62806280
return SUCCESS;
62816281
}
62826282

6283-
static int
6284-
compiler_visit_expr(struct compiler *c, expr_ty e)
6285-
{
6286-
int res = compiler_visit_expr1(c, e);
6287-
return res;
6288-
}
6289-
62906283
static bool
62916284
is_two_element_slice(expr_ty s)
62926285
{

0 commit comments

Comments
 (0)