Narrow precedence for call statement

This commit is contained in:
rocky 2020-09-03 04:35:59 -04:00
parent 8879708da7
commit b4db22d525
2 changed files with 9 additions and 1 deletions

View File

@ -327,7 +327,10 @@ TABLE_DIRECT = {
# For compatibility with older Python, we'll use "%" instead of
# a format string.
"string_at_beginning": ('%|"%%s" %% %c\n', 0),
"call_stmt": ("%|%p\n", (0, 200)),
"call_stmt": ( "%|%p\n",
# When a call statement contains only a named_expr (:=)
# the named_expr should have parenthesis around it.
(0, PRECEDENCE["named_expr"]-1)),
"break": ("%|break\n",),
"continue": ("%|continue\n",),
"raise_stmt0": ("%|raise\n",),

View File

@ -149,6 +149,11 @@ def customize_for_version37(self, version):
(1, "store"), (0, "get_aiter"), (3, "list_iter"),
),
"list_afor": (
" async for %[1]{%c} in %c%[1]{%c}",
(1, "store"), (0, "get_aiter"), (3, "list_iter"),
),
"list_if37": (" if %p%c", (0, 27), 1),
"list_if37_not": (" if not %p%c", (0, 27), 1),
"testfalse_not_or": ("not %c or %c", (0, "expr"), (2, "expr")),