Skip to content

Commit 3b12597

Browse files
author
hartsantler
committed
fixed yield generator functions.
1 parent 09c5f68 commit 3b12597

1 file changed

Lines changed: 6 additions & 29 deletions

File tree

pythonjs/python_to_pythonjs.py

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3874,38 +3874,15 @@ class GeneratorFunctionTransformer( PythonToPythonJS ):
38743874
38753875
'''
38763876
def __init__(self, node, compiler=None):
3877-
self._with_ll = False
3878-
self._with_js = False
3879-
self._with_dart = False
3880-
self._with_coffee = False
3881-
self._with_lua = False
3882-
self._with_rpc = None
3883-
self._with_rpc_name = None
3884-
self._with_inline = False
3885-
self._in_while_test = False
3886-
self._in_lambda = False
3877+
assert '_stack' in dir(compiler)
3878+
#self.__dict___ = compiler.__dict__ ## share all state
3879+
for name in dir(compiler):
3880+
if name not in dir(self):
3881+
setattr(self, name, (getattr(compiler, name)))
38873882

3888-
if compiler._with_dart: ## TODO
3889-
self._with_dart = True
3890-
elif compiler._with_coffee:
3891-
self._with_coffee = True
3892-
elif compiler._with_lua:
3893-
self._with_lua = True
3894-
else:
3895-
self._with_js = True
3896-
3897-
self._typedef_vars = compiler._typedef_vars
3898-
self._direct_operators = compiler._direct_operators
3899-
self._builtin_functions = compiler._builtin_functions
3900-
self._js_classes = compiler._js_classes
3901-
self._global_functions = compiler._global_functions
3902-
self._addop_ids = compiler._addop_ids
3903-
self._cache_for_body_calls = False
3904-
self._source = compiler._source
3905-
self._instances = dict()
39063883
self._head_yield = False
39073884
self.visit( node )
3908-
compiler._addop_ids = self._addop_ids
3885+
compiler._addop_ids = self._addop_ids ## note: need to keep id index insync
39093886

39103887
def visit_Yield(self, node):
39113888
if self._in_head:

0 commit comments

Comments
 (0)