bpo-40334: Support suppressing of multiple optional variables in Pegen (GH-20367)

(cherry picked from commit cba5031510)

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-05-24 15:38:47 -07:00 committed by GitHub
parent 1a4e9e6f35
commit 82c274e3ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -694,8 +694,8 @@ class CParserGenerator(ParserGenerator, GrammarVisitor):
if v == "_cut_var": if v == "_cut_var":
v += " = 0" # cut_var must be initialized v += " = 0" # cut_var must be initialized
self.print(f"{var_type}{v};") self.print(f"{var_type}{v};")
if v == "_opt_var": if v.startswith("_opt_var"):
self.print("UNUSED(_opt_var); // Silence compiler warnings") self.print(f"UNUSED({v}); // Silence compiler warnings")
with self.local_variable_context(): with self.local_variable_context():
if is_loop: if is_loop: