From 1048aa933f096c33738f5088c7362a00e2c5b85c Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Fri, 14 Sep 2001 23:17:55 +0000 Subject: [PATCH] Add code generator for yield stmt --- Lib/compiler/pycodegen.py | 5 +++++ Tools/compiler/compiler/pycodegen.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py index bfb50597b9a..0097482447c 100644 --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -909,6 +909,11 @@ def visitReturn(self, node): self.visit(node.value) self.emit('RETURN_VALUE') + def visitYield(self, node): + self.set_lineno(node) + self.visit(node.value) + self.emit('YIELD_STMT') + # slice and subscript stuff def visitSlice(self, node, aug_flag=None): diff --git a/Tools/compiler/compiler/pycodegen.py b/Tools/compiler/compiler/pycodegen.py index bfb50597b9a..0097482447c 100644 --- a/Tools/compiler/compiler/pycodegen.py +++ b/Tools/compiler/compiler/pycodegen.py @@ -909,6 +909,11 @@ def visitReturn(self, node): self.visit(node.value) self.emit('RETURN_VALUE') + def visitYield(self, node): + self.set_lineno(node) + self.visit(node.value) + self.emit('YIELD_STMT') + # slice and subscript stuff def visitSlice(self, node, aug_flag=None):