Skip to content
Myr

Optimize emitting of forced yields

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent e5e3e61 · Browse files · 1 file+3 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−4 removed

  • other:+3 added−4 removed

1 file+3 added−4 removed

modified:jinja2/compiler.py+3 added-4 removed
343 unmodified lines
344 def blockvisit(self, nodes, frame):345 """Visit a list of nodes as block in a frame. If the current frame346 is no buffer a dummy ``if 0: yield None`` is written automatically.347 """348 if frame.buffer is None:349 self.writeline('if 0: yield None')350 else:351 self.writeline('pass')348 try:349 if not nodes:350 self.writeline('pass')351 for node in nodes:352 self.visit(node, frame)353 except CompilerExit:354 pass
197 unmodified lines
552553 def write_commons(self):554 self.writeline('resolve = context.resolve_or_missing')555 self.writeline('undefined = environment.undefined')556 self.writeline('if 0: yield None')557558 # -- Statement Visitors559560 def visit_Template(self, node, frame=None):
980 unmodified lines