From c986edb4438e561554893522dfe605d3d82c17ed Mon Sep 17 00:00:00 2001 From: cocolato Date: Thu, 24 Oct 2024 22:07:39 +0800 Subject: [PATCH] add change log --- doc/build/unreleased/140.rst | 10 ++++++++++ mako/pyparser.py | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 doc/build/unreleased/140.rst diff --git a/doc/build/unreleased/140.rst b/doc/build/unreleased/140.rst new file mode 100644 index 00000000..608b5f2d --- /dev/null +++ b/doc/build/unreleased/140.rst @@ -0,0 +1,10 @@ +.. change:: + :tags: bug, lexer, codegen + :tickets: 140 + + During the lexical analysis phase, add an additional + prefix for undeclared identifiers that have the same name + as built-in flags, and determine the final filter to be used + during the code generation phase based on the context + provided by the user. + Pull request courtesy Hai Zhu. \ No newline at end of file diff --git a/mako/pyparser.py b/mako/pyparser.py index 8f91e729..3786c809 100644 --- a/mako/pyparser.py +++ b/mako/pyparser.py @@ -198,16 +198,12 @@ def visit_Tuple(self, node): p.declared_identifiers ) lui = self.listener.undeclared_identifiers - # self.listener.undeclared_identifiers = lui.union( - # p.undeclared_identifiers - # ) undeclared_identifiers = lui.union(p.undeclared_identifiers) conflict_identifiers = undeclared_identifiers.intersection( DEFAULT_ESCAPES ) if conflict_identifiers: _map = {i: CONFLICT_PREFIX + i for i in conflict_identifiers} - # for k, v in _map.items(): for i, arg in enumerate(self.listener.args): if arg in _map: self.listener.args[i] = _map[arg]